Last active
April 3, 2017 00:42
-
-
Save mitcdh/2cc4124768c70c58e117b06ef9edb266 to your computer and use it in GitHub Desktop.
Devonthink script to set the name of any selected records to their kMDItemTitle metadata property
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tell application id "DNtp" | |
try | |
set this_selection to the selection | |
set this_count to count of this_selection | |
if this_count > 0 then | |
show progress indicator "Renaming" steps this_count | |
repeat with this_item in this_selection | |
set this_metadata to meta data of this_item | |
try | |
set this_title to |kMDItemTitle| of this_metadata | |
on error | |
set this_title to missing value | |
end try | |
if this_title is not missing value and this_title is not "" then set the name of this_item to this_title | |
end repeat | |
hide progress indicator | |
end if | |
on error error_message number error_number | |
hide progress indicator | |
if the error_number is not -128 then display alert "DEVONthink Pro" message error_message as warning | |
end try | |
end tell |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment