iView home page
iView Multimedia Forum Index

FAQ FAQ     SearchSearch     MemberlistMemberlist     UsergroupsUsergroups    RegisterRegister  
ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Batch annotate

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    iView Multimedia Forum Index -> AppleScript
View previous topic :: View next topic  
Author Message
laurens



Joined: 02 Dec 2006
Posts: 4

PostPosted: Sat Dec 02, 2006 12:35 am    Post subject: Batch annotate Reply with quote

I've a few thousand JPEG pictures with keywords. I would like too add those keywords to the original TIFF files with the same name. I can perform that task with the script "annotate>copy from items with same name". It's working one picture at a time.
I tried to select all the JPEGs and run the script, but that doesn't work. Is there a work around so that I don't have to run the script picture by picture?
Laurens
Back to top
View user's profile Send private message
AlexB



Joined: 17 May 2004
Posts: 5

PostPosted: Sat Dec 16, 2006 6:36 am    Post subject: Copy from Items with Same Name broken? Reply with quote

I suspect the script "Copy from Items with Same Name" is broken. I also have had problems running it on a group of images -- in my case, I like to annotate the JPEG images and then copy the changes over to the RAW images.

To make it work, I opened the script in Script Editor and I removed all the code lines having to do with custom fields. Then it worked. I don't use custom fields so not an issue for me. I don't know what but I assume something in those lines doesn't work properly. Removing those lines causes the script to work on a whole bunch of images just fine.

The other change I made was to have it copy Rating and Label information -- my preference to copy those things as well between images of the same name.

Has anyone taken a closer look to figure out what's wrong with this script?

If you want to make these changes but are wondering where the heck the script is, on Mac OS X, you need to go to the iView application and right mouse (ctrl-Click) and Show Package Contents -- then look in Contents:SharedSupport:Plug-ins:Scripts:Annotate. You'll want to copy the script into your own library area -- in your user directory then Library:Application Support:iView:Plug-ins:Scripts.

-- Alex
Back to top
View user's profile Send private message
laurens



Joined: 02 Dec 2006
Posts: 4

PostPosted: Sat Dec 16, 2006 10:34 am    Post subject: Reply with quote

This is very good! Thanks for your reply :D
There is only one thing that's not good, when I right-click (anywhere) I never see "Show Package Contents":?
This sounds like a Windows message.
In my Library, on my Mac, I can see Application Support>iView>Plug-ins, but that plug-ins folder is empty:-(
So where can I find the script on a Mac?
Laurens
Back to top
View user's profile Send private message
laurens



Joined: 02 Dec 2006
Posts: 4

PostPosted: Sat Dec 16, 2006 10:56 am    Post subject: Reply with quote

Sorry, I found it myself. It was under the script sign >tools>reveal plug-ins folder>Plug-ins•iView MediaPro.
I've looked at the script in Script editor, but for me its a foreign laguage. I don't know which lines are connected to custom fields.
Is it possible to post your script here or, even better, send it by mail?
My address is lhhod at mac.com
Thanks in advance.
Laurens


Last edited by laurens on Sat Dec 16, 2006 7:15 pm; edited 1 time in total
Back to top
View user's profile Send private message
Old Toad



Joined: 30 Mar 2004
Posts: 2480
Location: Temecula, CA

PostPosted: Sat Dec 16, 2006 4:58 pm    Post subject: Reply with quote

Laurens:

Let me suggest you do not put your email address in the post but rather do it like: ihhod at mac.com. This way the spam email scanners cannot scan thru the posts to gather in email addresses for spam. I'd edit you post and change it. Can't be too careful these days.

Do you Twango?
_________________
15" MBP 2.16 Ghz; G5 Dual-core 2GHz, 4G RAM, 250G HD; Mac OS X (10.5.3); 750/250GB FW HDs; QT 7.4.5P; iVMP 3.1.3 (42E6); Photoshop CS3
Back to top
View user's profile Send private message Send e-mail Visit poster's website
AlexB



Joined: 17 May 2004
Posts: 5

PostPosted: Sun Dec 17, 2006 6:55 am    Post subject: Reply with quote

Here's my script ... I commented out the lines dealing with custom fields, added in lines to copy the rating and label. If anyone sees that I've made a mistake, please feel free to comment. And of course if anyone has an idea why the custom fields code doesn't work, I'm interested - haven't had time to experiment.

You should be able to copy this text into a new script in Script Editor and then save the script with some name of your own, save it into the folder <your home folder>:Library:Application Support:iView:Plug-ins:Scripts. When you run iView, it will look in this folder and add any scripts in there to the scripts menu.

-- Alex


-- Alex 12/15/2006
-- Copy of "Copy from Items with Same Name..." but added copying Ratings and Label
-- Removed custom field copying which was causing script to not work?!
global Lang
set Lang to User_Language()

beep
AboutScript()

set Selitems to GetItems(1)
if Selitems = {} then return

set theCount to 0
set Already to {}
tell application "iView MediaPro"
tell catalog 1
-- set cfList to the name of every custom field as list
repeat with TheMedia in Selitems
set mediaName to the name of TheMedia
if unique id of TheMedia is not in Already then
set Annots to annotations of TheMedia
set theLabel to the label index of TheMedia
set theRating to the rating of TheMedia
--display dialog "Label = " & theLabel & " and Rating = " & theRating
if Annots as list as string is not "" then
set end of Already to unique id of TheMedia
set ShortName to name of TheMedia
set X to 1 + (offset of "." in (reverse of characters of ShortName as text))
set ShortName to text 1 thru -X of ShortName
set DestMedias to (media items whose name starts with ShortName)
repeat with DestMedia in DestMedias
if unique id of DestMedia is not in Already then
set end of Already to unique id of DestMedia
set annotations of DestMedia to Annots
set label index of DestMedia to theLabel
set rating of DestMedia to theRating
--start custom fields
--repeat with theField in cfList
-- set cfName to the theField as string
-- set cfValue to custom field cfName of media item mediaName as text
-- set custom field cfName of DestMedia to cfValue
--end repeat
set theCount to theCount + 1
end if
end repeat
end if
end if
end repeat
end tell
end tell
set lib to item Lang of {"Completed !" & return & return & " Processed files: ", ¬
"Terminé !" & return & return & " Fichiers traités : "}
display dialog lib & theCount buttons "OK" default button 1 with icon note giving up after 5

on GetItems(Nitems)
if exists window 1 of application "iView MediaPro" then
set Plural to ""
if Nitems > 1 then set Plural to "s"
set selectedID to the selection of window 1 of application "iView MediaPro"
if (count of selectedID) ? Nitems then return selectedID
set lib to item Lang of {"It's necessary to select at least " & Nitems & " item" & Plural & " of the catalog.", ¬
"Il faut sélectionner au moins " & Nitems & " élément" & Plural & " du catalogue."}
else
set lib to item Lang of {"At least one opened catalog is needed to use this script.", ¬
"Il faut au moins un catalogue ouvert pour utiliser ce script."}
end if
beep
display dialog lib buttons {"OK"} default button 1 with icon stop giving up after 8
return {}
end GetItems

on AboutScript()
-- note that English text below was modified to include rating/label, French text was not
set lib to item Lang of {¬
"Copy annotations of selected items to items of same name but different suffix, or having the same full name in other folders INCLUDING Rating and Label", ¬
"Copie les annotations des éléments sélectionnés dans les éléments de même nom mais de suffixe différent ou de même nom complet dans d'autres dossiers."}
display dialog lib with icon note
end AboutScript

on User_Language()
set PathLang to (path to application support from user domain as string) & "iView:Plug-ins:User Language"
tell application "Finder" to if exists file PathLang then return run script PathLang as alias
return 1
end User_Language
Back to top
View user's profile Send private message
laurens



Joined: 02 Dec 2006
Posts: 4

PostPosted: Mon Dec 18, 2006 11:39 am    Post subject: Reply with quote

Hi, thanks for the script. My scripteditor gave a warning there was something wrong.

This is a part of the script:

on GetItems(Nitems)
if exists window 1 of application "iView MediaPro" then
set Plural to ""
if Nitems > 1 then set Plural to "s"
set selectedID to the selection of window 1 of application "iView MediaPro"
if (count of selectedID) ? Nitems then return selectedID

The questionmark seems not to be good in the last line. Expected "then".
I changed that, but then the next "then" seems not good. Can you help me?
Back to top
View user's profile Send private message
René Damkot



Joined: 26 Jun 2006
Posts: 3

PostPosted: Fri Feb 09, 2007 6:14 pm    Post subject: Reply with quote

Great. Thanks to this thread I finally got it to work...

The error is in this line: "if (count of selectedID) ? Nitems then return selectedID"

It should read: "if (count of selectedID) >= Nitems then return selectedID"

(just copy-paste it from the original script)
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    iView Multimedia Forum Index -> AppleScript All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



  © iView Multimedia Ltd. | All Rights Reserved Privacy Policy | Copyright | Site Map