Skip to main content
Participant
March 12, 2011
Question

IPTC Core

  • March 12, 2011
  • 2 replies
  • 1922 views

I've been able to get a lot of this to work, but I've run into a problem I can't figure out. Here it is...

I have a Microsoft Excel 2008 spreadsheet that includes titles, descriptions, and keywords for my JPEGs.

I have the following Applescript for Adobe Photoshop CS4 to pull that information from Excel to the opened JPEG file...

tell application "Adobe Photoshop CS4"

     tell info of the current document

          set author to "My Name"

          set author position to "Illustrator"

          tell application "Microsoft Excel" to copy range (cell 2 of row 53 of worksheet "Keywording 2")

          set caption to (the clipboard)

          tell application "Microsoft Excel" to copy range (cell 3 of row 53 of worksheet "Keywording 2")

          set keywords to (the clipboard)

          set copyright notice to "Stephen Hobson"

          set copyrighted to copyrighted work

          tell application "Microsoft Excel" to copy range (cell 1 of row 53 of worksheet "Keywording 2")

          set title to (the clipboard)

     end tell

save the current document appending lowercase extension in ("Primary Hard Drive:Microstock:Files | Adobe Illustrator:Automating Now:10 | Series - Shined:6 | JPEG #1:" & (the clipboard) & ".jpg") as JPEG with options {embed color profile:true, class:JPEG save options, quality:12, format options:optimized} with copying

end tell

Everything pulls over and is inserted into the JPEG file with the only "odd" part is that the Keywords field is the only one that copies the information with quotations around it. That shouldn't be a problem though because when I go over to Adobe Bridge CS4 and look at the metadata everything is there and it looks fine.

Here's where the problem is...

When I upload these JPEG files to microstock sites, like Shutterstock for instance, that pull the metadata information and insert it onto the site, only the first 55 to 58 characters of the keywords are inserted then the rest abruptly cuts off? If I copy the keywords from Excel and insert them manually using Bridge and upload the file again, everything is there.

So, the problem must be with Photoshop writing the keywords? I was wondering if it's not getting enough time to save the metadata information before I save and close the file? I thought maybe it was the way I saved things to the clipboard, but every field except Keywords is correct so that probably isn't it. I thought that since the keywords are the only information pulled from a cell with the formula type "=Keywording!F6&Keywording!E6" in Excel that it was giving Photoshop problems? Is there something missing from my script?

I'm just not sure what the trick is so I thought I'd post the problem and see if someone could help? I have an older, more clumsy script that uses the keyboard that works fine, but I'd rather use better scripting to reduce the chance of error. If you need more information please let me know.

Additional Information: When I upload to Graphic Leftovers, I upload one Illustrator EPS file and the one matching JPEG file. However, the site uploads two identical JPEG files with only a few bytes difference. I'm thinking that the larger sized file has all of the metadata and the smaller sized file has the cut-off version. But, why on earth would it upload two JPEG files when I only selected one? Unfortunately, the metadata from the incorrect version is imported, so I think it goes back to the above problem of Photoshop insert and saving all the keywords correctly.

If you have any clues or thoughts please let me know!

Thanks!

This topic has been closed for replies.

2 replies

Participant
March 12, 2011

Hey Guys,

Thanks for trying to help me out with this. What you're saying is working as far as getting the metadata into the file. I tried these and couldn't get them to work, but I'm not sure if they would or wouldn't anyway.

The problem that I'm running into now is that unless I use Bridge's interface specifically to input the keywords field, none of the microstock sites I'm submitting to recognize the data correctly. Sure, I can get Photoshop and Bridge and all of my software to see the metadata there and it's inputed correctly with ";" between the words I need them to be between and all of the fields get put in nicely. But, the microstock sites either won't recognize any keywords or the input looks like, "keyword 1 keyword 2 keyword 3" with nothing separating them. It's pretty frustrating and I'm not sure whether to point the finger at Adobe or the sites or myself for not being better at scripting it so the sites will recognize it?

Unfortunately, I guess I'll have to go around it the long way and use Bridge's "File > File Info... > wait > and input the Kewords field using an crappy applescript that uses the keyboard and clipboard > wait for Bridge to write the keywords to the file". It's a way long way around it, but if I can't get the microstock sites to recognize the keywords then I might as well not automate it.

Thanks for helping though! This is the first time I've posted something in the forums here and I really got some good replies because I was at a dead end before. If you guys run across someone else submitting to sites reading metadata and figured out how to automate it better, please remember me!

Paul Riggott
Inspiring
March 12, 2011

Those scripts were not generic, I have a newer version "DIYMetadata" here http://www.scriptsrus.talktalk.net/index.htm

This will allow you to choose the fields/order from the checkboxs.

Muppet_Mark-QAl63s
Inspiring
March 12, 2011

I can't help with the pulling of data from an Excel spreadsheet but… Photoshop expects info 'key words' to be an AppleScript list… If you are getting a single item "quoted" then you are suppling it a string… You can't use comma or colon in a string as the item delimiters. Only a list will give you separated items… As you will see the first 2 of these don't work but the third does…

tell application "Adobe Photoshop CS5"

set Doc_Ref to the current document

tell Doc_Ref

-- set Key_Words to "My, key, words, as, a, list"

-- set Key_Words to "My; key; words; as; a; list"

set Key_Words to {"My", "key", "words", "as", "a", "list"}

set keywords of info to Key_Words

end tell

end tell

Muppet_Mark-QAl63s
Inspiring
March 12, 2011

Oh a possible solution if this is the case would be to ask for words of the clipboard. Like so…

set the clipboard to "My, key, words, as, a, list" -- A string

tell application "Adobe Photoshop CS5"

set Doc_Ref to the current document

tell Doc_Ref

-- This will create a list of words from clipboard text

set Key_Words to words of (the clipboard)

set keywords of info to Key_Words

end tell

end tell

Participant
March 12, 2011

Wait, I re-read what you posted and realized you were still using a typed string set to the clipboard.

What I changed was this...

tell application "Microsoft Excel" to copy range (cell 3 of row 53 of worksheet "Keywording 2")

set key_words to the words of (the clipboard)

set keywords to key_words

It did help me get everything recognized on Shutterstock. It was just missing the ";" between the keywords, so Shutterstock just recognized it as one long string of text.

Since the problem of getting every word recognized is fixed and now that I know Photoshop only takes its keywords in list form, I guess what I'm really working in is Excel now.

I'm not sure if you can help, but this is what I was thinking...

If my keywording looks like this in Excel..."keyword1", "keyword2", "keyword keyword 3"...and since Photoshop won't recognize the "," if it's pasted from the clipboard, is there a way to...

a) Set the contents of the clipboard as a list when copying?

b) Have the script place "," between pairs of quotes when it pastes (the clipboard) into Photoshop?

c) I'm really running out of ideas, I am beating a dead horse, I should give it up?

d) Any other suggestions?

Message was edited by: lightlens