'I want to create an automator plugin that takes the spotlight comments of a chosen photo and copies these to an iptc field. ' - which 'IPTC' field?
As per 'GraphicConverter's AppleScripts' Library's 'GraphicConverter.asdictionary' file - there are:
IPTC caption, IPTC captionwriter, IPTC headline, IPTC specialinstructions, IPTC byline, IPTC bylinetitlee, IPTC credit, IPTC source, IPTC objectname, IPTC datecreated, IPTC city, IPTC state, IPTC country, IPTC reference, IPTC category, IPTC copyright, IPTC urgency, IPTC subcategory, and IPTC keywords
Sample AppleScript code:
-- Code starts here --
on run
open (choose file with multiple selections allowed)
end run
on open (dItems)
repeat with i in dItems
tell application "Finder" to set fComment to comment of i
try
tell application "GraphicConverter"
open i
tell window 1
set IPTC caption to fComment
close saving yes
end tell
end tell
end
end repeat
end open
-- Code ends here --
Save the above code as an application (AppleScript applet). The applet can be double clicked on, or files to be processed - dragged onto it.
---
Or replace the contents of 'Automator's 'Automator' Library's 'Run AppleScript' Action with ...
-- Code starts here --
on run {input, parameters}
tell application "GraphicConverter" to activate
delay 1.0
repeat with i in input
tell application "Finder" to set fComment to comment of i
try
tell application "GraphicConverter"
open i
tell window 1
set IPTC caption to fComment
close saving yes
end tell
end tell
end
end repeat
return input
end run
-- Code ends here --
Save the above code as an 'Automator' 'Finder' Plug-in.
---
If any other IPTC parameter is to contain the file's comment entry, then replace 'IPTC caption' in ...
set IPTC caption to fComment
... with the desired IPTC parameter.
The code segments provided above - offers minimal error capturing. One is to assume that only files capable of being opened and (an IPTC parameter) modified by 'GraphicConverter' - are dragged onto the applet, or selected via the 'Automator' 'Finder' Plug-in's contextual menu.