ISO script to tag attachments

Users asking other users for AppleScripts that work with Bookends.
Post Reply
DrJJWMac
Posts: 342
Joined: Sat Jun 22, 2019 8:04 am
Location: Alabama USA

ISO script to tag attachments

Post by DrJJWMac »

I want to add a Finder tag "annotated" to all attachments that have been annoted. In order to access the Finder tags to an attachment via AppleScript, I have to go out to the Finder level and use an approach that I am not yet comfortable applying. The reference is https://discussions.apple.com/thread/80 ... 1936614022.

I'd be grateful in anyone can translate the referenced approach to one that can be used in an AppleScript call in this way ...

Code: Select all

use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions

(*
applies a tag to PDFs of selected publications
2021-07-30
jjw
*)

-- name the Finder tag
property tagName : "annotated"

on run {}
	tell application "Bookends"
		activate
		set theSelectedList to the selected publication items of the front library window
		repeat with thePub in theSelectedList
			set theAttachments to the attachment items of thePub
			repeat with theAttachment in theAttachments
				set theFilePath to the path of theAttachment as text
				my setFinderTag(theFilePath)
			end repeat
		end repeat
	end tell
end run

on setFinderTag(theFilePath)
	-- need this function
end setFinderTag
--
JJW
Post Reply