I am trying to rename a selection of files to their respective comments. As I do not have any idea about scripts I tried to combine the scripts which where already done to a new one which would do what I wanted: I came up with this:
tell application “DEVONthink Pro”
activate
try
set this_selection to the selection
if this_selection is {} then error “Please select some contents.”
repeat with this_item in this_selection
set current_comment to the comment of this_item
set new_item_comment to current_comment
set the comment of this_item to new_item_comment
end repeat
repeat with this_item in this_selection
set current_name to the name of this_item
set new_item_name to new_item_comment
set the name of this_item to new_item_name
end repeat
on error error_message number error_number
if the error_number is not -128 then
try
display alert "DEVONthink Pro" message error_message as warning
on error number error_number
if error_number is -1708 then display dialog error_message buttons {"OK"} default button 1
end try
end if
end try
end tell
However it does rename now all the files to the same comment of the first of the selected items. How do I amend the script so that it does one after the other?