Posted By

ianthekirkland on 12/21/12


Tagged

applescript tag DEVONthink-Pro


Versions (?)

DTP-Add Tags to Selection of Single or Multiple Items


 / Published in: AppleScript
 

  1. tell application "DEVONthink Pro"
  2. set sel to the selection
  3. if (count of sel) is 1 then
  4. tell application "System Events"
  5. set devon_think to application process "DEVONthink Pro"
  6. set tag_bar to text field 1 of splitter group 1 of group 1 of splitter group 1 of splitter group 1 of window 1 of devon_think
  7. set focused of tag_bar to true
  8. end tell
  9. else
  10. -- More than 1 item is selected, add tags to selection via script dialog --
  11. tell application id "com.devon-technologies.thinkpro2"
  12. try
  13. set theSelection to the selection
  14. if theSelection is {} then error "Please select some items."
  15.  
  16. repeat
  17. set theTag to display name editor "Add Tags" info "Tags (separated by semicolons):"
  18. if theTag is not "" then exit repeat
  19. end repeat
  20.  
  21. set {od, AppleScript's text item delimiters} to {AppleScript's text item delimiters, ";"}
  22. set theTags to text items of theTag
  23. repeat with theRecord in theSelection
  24. set tags of theRecord to (parents of theRecord) & theTags
  25. end repeat
  26. set AppleScript's text item delimiters to od
  27. on error error_message number error_number
  28. if the error_number is not -128 then display alert "DEVONthink Pro" message error_message as warning
  29. end try
  30. end tell
  31. end if
  32. end tell
  33.  
  34.  

Report this snippet  

You need to login to post a comment.