PhotoShop scripting

I did a search of the BBS here and found no references to “PhotoShop”. Is there a location here or elsewhere that I can post PhotoShop scripting questions? Thanks!

whatcha trying to do?

i have done a little bit of scripting for PS6.01
i’ll try to help

I have a text file that has a series of tab-delimited fields (filename, Title, Credit, Keywords) that has a matching list of images. I would like to merge the text file’s contents into the IPTC fields in the images. Why are these fields separate? Ask Photodisc, God only knows… The filename of the photos matches the content within the first tab-delim (“filename”).

Any help much appreciated, Joe.

Thanks.

I have never done anything with the file info in PS but brings up some ideas for me
so i think i may investigate a lil right now

as far as scripting PS there is not much you can do outside of the actions palette without scripting additions so i am playing around with it right now

Hay that’s great! Thank you for your input. I am running PS 7.0/OS 10.2.4, if that makes any difference. I am trying out the new PhotoShop dictionary as well.
Thanks!

can you post the dictionary
maybe that will shed some light

cause ps 6.0 only has open & do script
but if you have $$ to throw at the problem

Photoscripter, a Photoshop plug-in from Main Event Software is available
never used it though, no extra $$ to spend

From what i hear PS 7.0 has many advancements for us apple scripters
just can’t afford the upgrade yet

I’m sorry, I can’t post the dictionary. I am pretty sure that would be a copyright violation. I will continue to look into this problem, though, and will certainly post my findings what all is said and done.

Thanks for the goodwill, however!

Timothy

set olddelims to the AppleScript's text item delimiters
set AppleScript's text item delimiters to tab
set infoList to read file ((choose file with prompt "Choose the data file.") as text) as list using delimiter return
set {filename, the_Title, the_Credit, the_Keywords} to the text items of infoList
tell application "Adobe® Photoshop® 6.0.1"
	--stuff goes here
	make new document with properties {name:filename, Title:the_Title, credits:the_Credit, Keywords:the_Keywords} -- not sure if this will work i haven't seen the PS 7.0 dictionary
	set AppleScript's text item delimiters to olddelims
end tell

i havent tested it cause i do not have ps 7.0 but something like this might work

I setup the following example code under a few assumptions: the tab delimited text is a list of records delimited by a return and each record does not begin with a tab; you know what each tab delimited field is according to their order; and that there are a set number of tab delimited fields per return delimited file info record.


set propsPer to 5 -- set this number to the number of info items in each file's info that you will extract from the tab delimited text
set infoList to (read file "exampleDisk:exampleFolder:exampleFile" using delimiter {tab, return}) -- this is if each record is separated by a return and each record does not begin with a tab
if ((count of infoList) mod propsPer = 0) then
	set repCount to (count of infoList) div propsPer
else
	-- the count of fields divided by properties per file info is not what you expect
	error number -128
end if
repeat with i from 1 to repCount
	set propList to items (((i - 1) * propsPer) + 1) thru (((i - 1) * propsPer) + propsPer) of infoList
	tell application "Adobe Photoshop 7.0"
		set targetDoc to document (item 1 of propList)
		set properties of info of targetDoc to {author:item 2 of propList, author position:item 3 of propList, caption:item 4 of propList, caption writer:item 5 of propList}
	end tell
end repeat

Forgot to mention that it also assumes that the documents being modified are open in Photoshop.

Thanks Joeseph! I have copied the code and will play with it sometime today. However, what I really would like to do is “infuse” the IPTC fields with the extracted tab-delim data - to populate the images’ fileds. This avoids a re-save, as they are already JPEGs.

Thank you for your help! I have iView Media pro and am looking at this app to script and infuse.

Timothy

I believe this is what you are looking for…

tell application "Adobe Photoshop 7.0"
	tell document 1
		set title of info to "TEST"
		set keywords of info to {"item1", "item2"}
	end tell
end tell

all you need to do is read the tab seperated values from your list and apply them to the image with similar code as above.

I hope this helps…
Dave

I guess I also assumed that IPTC fields had something to do with Photoshop’s document info. I don’t know anything about iView Media, so I can’t help with that.