Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

IPTC Core

New Here ,
Mar 11, 2011 Mar 11, 2011

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!

TOPICS
Actions and scripting
1.9K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Guide ,
Mar 12, 2011 Mar 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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Mar 12, 2011 Mar 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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 12, 2011 Mar 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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Mar 12, 2011 Mar 12, 2011

Im not sure I understand what you are doing… You shouldn't need those ';' in your string Photoshop will add them as its delimiters?

Picture 1.png

In AppleScript using 'word' by definition returns a group of characters a-zA-Z any length greater than 1, no punctuation… If you need other characters then you will need to replace 'words of' with some other text command…

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 12, 2011 Mar 12, 2011

You're right. I looked at it and Photoshop is doing what it's suppose to. All of the keywords are showing up correctly in both Photoshop and Bridge. the microstock site Shutterstock is still not recognizing the ";" between the keywords and it's leaving them out. So, that problem is still there and I'm not sure why? But, using Photoshop to insert the metadata from an Excel Spreadsheet works; just not when I upload.

I think I'll take some of the script you've given me and combine with my older script that used the keyboard and see if I can't get Shutterstock to get it right in the end.

I'll go ahead and post the end result here when it's finished and works so other microstock contributors can use it too. Thanks for your help!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Mar 12, 2011 Mar 12, 2011

Mark how would you go on with keywords of two words or more?

Green Carrots; Blue Oranges  etc.

I would have thought this would be a magnitude faster doing all this in Bridge, as no files would have to opened/closed?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 12, 2011 Mar 12, 2011

Well, since the beginning of the automation process is to take Adobe Illustrator files (.ai) and open and rasterize them in Photoshop (.jpg), I figured the fasted way to insert the metadata would be before Photoshop saved the file out. That way, once Photoshop saves it the file has everything it needs. Also, as I've search Google, Adobe Bridge is evidently an impossible pain to script with Applescript. I think people are using JavaScript and a spreadsheet saved as a CVS, which I'd have to learn how to script all of that. So, I was hoping I could do it this way.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Mar 12, 2011 Mar 12, 2011

AI files can be a bummer and AppleScript is a complete none starter with Bridge, there might be a workaround and do it all in Bridge. In CS5 there is now the option to export to. (Window - Export Panel)

For adding the metadata most as you say use a csv file and JavaScript.

For an example of JavaScript you could look at my DIYMetadata http://www.scriptsrus.talktalk.net/index.htm

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Mar 12, 2011 Mar 12, 2011

Paul, AppleScript has 'text item delimiters' which you can set to just about anything… Think of it like someString.split(delim); so you can use almost anything you like. Words is just a simple example of its text handling (I just wanted any list)… As for me this would be done in bridge too… All that app switching back and forth in order to cut and paste. Using JavaScript in Bridge would rip this to ribbons…

AppleScript in Bridge has one command 'do javascript' now that is funny… Thanks for adding that Adobe…

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Mar 12, 2011 Mar 12, 2011

Thanks for that Mark, AppleScript is still a mystery to me and doubt if I could learn it as I only turn on my Macs if I really must

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Mar 12, 2011 Mar 12, 2011

Well Paul, you've proved you know more about macs than I do about pc's… Where would you find the on button? Actually I don't want to know…

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 12, 2011 Mar 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!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Mar 12, 2011 Mar 12, 2011
LATEST

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines