Image checklist and add keywords
Image check list and adding keywords,
What I would like the script to do.
As images (PSD) arrive in the folder.
tick it off the checklist.
Use the checklist to add keywords to the PSD file.
If all the images are in the folder and match the completed checklist then turn the folder label green.
I'm already using this script, this allows me to turn the files green if they fit the correct ratio. So ideally I will sandwich the new script within this one as they operate as watch folder via the LaunchDaemons.
property type_list : {"TIFF", "JPEG", "PNGf", "PICT"}
property extension_list : {"tif", "tiff", "jpg", "jpeg", "png", "pict", "psd"}
--BH
try
tell application "Finder" to set bh_folders to (get every folder of desktop whose name starts with "BH")
if bh_folders is not {} then
set aBHFolder to item 1 of bh_folders
tell application "Finder" to set bh_files to every file of the aBHFolder whose ¬
file type is in the type_list or name extension is in the extension_list
repeat with i from 1 to the count of bh_files
set bh_path to (item i of bh_files) as string
tell application "Image Events"
set bh_image to openfilebh_path
copy the dimensions of bh_image to {xbhwidth, ybhheight}
closebh_image
end tell
set bhRatio to 1348 / 1832
if xbhwidth / ybhheight is greater than bhRatio - 1.0E-3 and xbhwidth / ybhheight is less than bhRatio + 1.0E-3 then
my BH_CorrectRatio(xbhwidth, ybhheight, bh_path)
else
my BH_CheckRatio(xbhwidth, ybhheight, bh_path)
end if
end repeat
end if
on error error_message
display dialogerror_messagebuttons {"OK"} default button 1
--UPPERCASE CHANGER
set the source_folder to aBHFolder
tell application "Finder"
repeat with this_item in entire contents of source_folder
set the current_name to the name of this_item as text
set the name of this_item to my change_case(the current_name, "upper")
end repeat
end tell
--UPPERCASE CHANGERend try
on BH_CorrectRatio(xbhwidth, ybhheight, bh_path)
tell application "Finder"
set label index of document file bh_path to 6
end tell
end BH_CorrectRatio
on BH_CheckRatio(xbhwidth, ybhheight, bh_path)
tell application "Finder"
set label index of document file bh_path to 5
end tell
end BH_CheckRatio
--END BH
-- Burt
try
tell application "Finder" to set Burt_folders to (get every folder of desktop whose name starts with "Burt")
if Burt_folders is not {} then
set aBurtFolder to item 1 of Burt_folders
tell application "Finder" to set Burt_files to every file of the aBurtFolder whose ¬
file type is in the type_list or name extension is in the extension_list
repeat with i from 1 to the count of Burt_files
set Burt_path to (item i of Burt_files) as string
tell application "Image Events"
set Burt_image to openfileBurt_path
copy the dimensions of Burt_image to {xBurtwidth, yBurtheight}
closeBurt_image
end tell
set BurtRatio to 1020 / 1385
if xBurtwidth / yBurtheight is greater than BurtRatio - 1.0E-3 and xBurtwidth / yBurtheight is less than BurtRatio + 1.0E-3 then
my Burt_CorrectRatio(xBurtwidth, yBurtheight, Burt_path)
else
my Burt_CheckRatio(xBurtwidth, yBurtheight, Burt_path)
end if
end repeat
end if
on error error_message
display dialogerror_messagebuttons {"OK"} default button 1
--UPPERCASE CHANGER
set the source_folder to aBurtFolder
tell application "Finder"
repeat with this_item in entire contents of source_folder
set the current_name to the name of this_item as text
set the name of this_item to my change_case(the current_name, "upper")
end repeat
end tell
--UPPERCASE CHANGER
end try
on Burt_CorrectRatio(xBurtwidth, yBurtheight, Burt_path)
tell application "Finder"
set label index of document file Burt_path to 6
end tell
end Burt_CorrectRatio
on Burt_CheckRatio(xBurtwidth, yBurtheight, Burt_path)
tell application "Finder"
set label index of document file Burt_path to 5
end tell
end Burt_CheckRatio
on Season_CorrectRatio(xSeasonwidth, ySeasonheight, Season_path)
tell application "Finder"
set label index of document file Season_path to 6
end tell
end Season_CorrectRatio
on Season_CheckRatio(xSeasonwidth, ySeasonheight, Season_path)
tell application "Finder"
set label index of document file Season_path to 5
end tell
end Season_CheckRatio
-- AppleScript 'change_case' handler
on change_case(this_text, this_case)
if this_case is "lower" then
set the comparison_string to "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
set the source_string to "abcdefghijklmnopqrstuvwxyz"
else
set the comparison_string to "abcdefghijklmnopqrstuvwxyz"
set the source_string to "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
end if
set the new_text to ""
repeat with thisChar in this_text
set x to the offsetofthisCharin the comparison_string
if x is not 0 then
set the new_text to (the new_text & character x of the source_string) as string
else
set the new_text to (the new_text & thisChar) as string
end if
end repeat
return the new_text
end change_case
--UPPERCASE CHANGER
The checklist is in the format of a CSV file and looks like this (there is no header line)
Filename, Title, Description, keywords
MA00XX01234AA5BB.PSD, MA00XX01234AA5BB, image of cat, cat paw
" " " "
and so on….
Now when the file arrives in the folder, check it against the checklist add a Y (for yes) or ✔ ifthatispossible?
NOW Keywords i'll come back to that)
IfallthefileshaveaY or ✔ nextto them the file is complete so change the label to green.
Now the keywords.
So when the files arrive in the folder not only will a checkmark be added to the list but I would like it to a take the file ad add the keywords to the file.
In terms of software I have Photoshop CS5, Adobe bridge, however I would like to avoid using them to add the keywords since it will involve reopening the file just to add the keyword, it needs to happen in the background as much as possible.
Now there is ExifTool but like many know from my posts on here I have really no idea how to attempt to implement any of this. 🙂
Many Thanks in advance
Matt
iMac, Mac OS X (10.6.8)