using applescript to edit IPTC data?

Dear List,

This is my first posting and I hope it is on topic.

I am a photographer using Photoshop (CS1 ) and have a query that I hope some of you experts may be able to solve! It’s very simple, but I’m not a programmer so I need some guidance. I would like to be able to copy a file name (of a tiff, jpg or RAW file and paste it into the transmission reference field displayed in the file browser (and I assume other applications displaying IPTC data).

Is there an available script that could be used perhaps with Automator that could do this as a batch command? I could have up to several hundred files to do at a time - doing this by hand probably isn’t fun!

Best wishes,

Paul

That’s totally on topic.

You can set metadata tags using the metadata tag class of Image Events’ Image suite. Or you can script Photoshop. If you don’t know how to write applescript, you can usually find answers to the really common issues like this by googling.

This should help…
http://www.creativepro.com/story/feature/22897.html

Thanks for this - downloaded the CS action pack and the IPTC editor action does work and copies the file name to a few fields. I would like to add another field if possible (transmission reference) to the choices available and idealy copy the name without the file extension. Are the scripts contained within the pack easily editable and would this be easy for a novice applescripter?!

Thanks,

Paul

Paul, what fields do you want to add data to and will most of this be the same with the exception of transmission reference field? I have a batch script for this but its at home. Here is just a basic example you can run on an open file. Setting up a batch script to run on a folder of images is fairly straight forward.

-- TodaysDate as Shell yyyy mm dd the date has to be in this format to work correctly
set TodaysDate to do shell script "date \"+%Y %m %d\""
tell application "Adobe Photoshop CS"
	activate
	set display dialogs to never
	set docRef to the current document
	tell docRef
		set docName to name of docRef
		set docBaseName to getBaseName(docName) of me
		set creation date of info to TodaysDate as Unicode text
		set transmission reference of info to docBaseName as Unicode text
	end tell
end tell
--
on getBaseName(fName)
	set baseName to fName
	repeat with idx from 1 to (length of fName)
		if (item idx of fName = ".") then
			set baseName to (items 1 thru (idx - 1) of fName) as string
			exit repeat
		end if
	end repeat
	return baseName
end getBaseName

Hi Mark,

At the moment, all I need to do is add the file name without file extension to the transmission reference. Other fields to remain untouched. In theory it’s a really simple action that I need! Other fields will be dealt with on an individual basis such as captions and keywords which I will add in Photoshop. I may make a template with copyright and URL info using the cs action pack and add it to the same workflow, but that’s about it.

Appreciate your help with this,

Regards,

Paul

Paul, this should do what you require. When run just point finder to your folder of images. The script is using a name handler to remove the extension so your file naming should have no “.” in them other than for the file format extension. Hope it helps.

set inputFolder to choose folder
tell application "Finder"
	set filesList to files in inputFolder
end tell
repeat with aFile in filesList
	set fileIndex to 0
	tell application "Finder"
		set theFile to aFile as alias
	end tell
	tell application "Adobe Photoshop CS"
		activate
		set display dialogs to never
		open theFile
		set docRef to the current document
		tell docRef
			set docName to name of docRef
			set docBaseName to getBaseName(docName) of me
			set transmission reference of info to docBaseName as Unicode text
		end tell
		close current document with saving
	end tell
end repeat
--
on getBaseName(fName)
	set baseName to fName
	repeat with idx from 1 to (length of fName)
		if (item idx of fName = ".") then
			set baseName to (items 1 thru (idx - 1) of fName) as string
			exit repeat
		end if
	end repeat
	return baseName
end getBaseName