We are looking into Digital Asset Management software. One of the things we would love to do is add keywords to our product images using a script. I’ve written a sample script that would add keywords based on each dropped image’s filename to give everyone a better idea of what I’m trying to accomplish.
Since this is MacScripter and people here use macs and scripts, I was wondering if anyone knows of Digital Asset Management Software that has scripting capabilities. It would be great if the DAM software has AppleScript capabilities, but, if it doesn’t, JavaScript or other scripting languages may also work. Thanks Much! Any guidance on this is greatly appreciated!
on open of droppedfiles
with timeout of 900 seconds -->Changing timeout to 15 minutes. Default is 2 minutes.
repeat with afile in droppedfiles
-------------------------------------------------------------
--GETTING THE CHARACTERS OF THE FILENAME
-------------------------------------------------------------
tell application "Finder"
set fileName to name of afile as string
end tell
-------------------------------------------------------------
-------------------------------------------------------------
-------------------------------------------------------------
--ADDING A KEYWORD FOR EACH PREFIX
-------------------------------------------------------------
if text 1 thru 2 of fileName contains "AG" then
display dialog "Agriculture"
--tell application "Database/Digital Asset Management Program"
--Code to add keyword "Agriculture" would go here
--end tell
else if text 1 thru 2 of fileName contains "AU" then
display dialog "Automotive"
--tell application "Database/Digital Asset Management Program"
--Code to add keyword "Automotive" would go here
--end tell
end if
--More prefixes would go here
-------------------------------------------------------------
-------------------------------------------------------------
-------------------------------------------------------------
--ADDING A KEYWORD FOR EACH VENDOR NAME
-------------------------------------------------------------
if fileName contains "Adidas" or fileName contains "adidas" then
display dialog "Adidas"
--tell application "Database/Digital Asset Management Program"
--Code to add keyword "Adidas" would go here
--end tell
else if fileName contains "Alfred" and fileName contains "Dunner" then
display dialog "Alfred Dunner"
--tell application "Database/Digital Asset Management Program"
--Code to add keyword "Alfred Dunner" would go here
--end tell
end if
-- More vendor names would go here
-------------------------------------------------------------
-------------------------------------------------------------
-------------------------------------------------------------
--ADDING A KEYWORD FOR EACH SKU NUMBER
-------------------------------------------------------------
--Creating a list of all single digit numbers
set numberList to {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9"}
--Finding a six digit number that starts within the first few characters of the filename
if numberList contains (text 3 of fileName as string) then
if numberList does not contain text 9 of fileName as string then
if numberList contains (text 8 of fileName as string) then
display dialog text 3 thru 8 of fileName as string
--tell application "Database/Digital Asset Management Program"
--Code to add keyword SKU Number: (text 3 thru 8 of fileName as string) would go here
--end tell
end if
end if
else if numberList contains (text 4 of fileName as string) then
if numberList does not contain text 10 of fileName as string then
if numberList contains (text 9 of fileName as string) then
display dialog text 4 thru 9 of fileName as string
--tell application "Database/Digital Asset Management Program"
--Code to add keyword SKU Number: (text 4 thru 9 of fileName as string) would go here
--end tell
end if
end if
else if numberList contains (text 5 of fileName as string) then
if numberList does not contain text 11 of fileName as string then
if numberList contains (text 10 of fileName as string) then
display dialog text 5 thru 10 of fileName as string
--tell application "Database/Digital Asset Management Program"
--Code to add keyword SKU Number: (text 5 thru 10 of fileName as string) would go here
--end tell
end if
end if
-------------------------------------------------------------
-------------------------------------------------------------
-------------------------------------------------------------
--ADDING DATE FROM FILENAME
-------------------------------------------------------------
if fileName contains "(" and fileName contains ")" then
set leftParen to "("
set rightParen to ")"
--Getting the month from the filename
set monthOffset to (offset of leftParen in fileName) + 1 -->returns character right after (
set fileNameMonth to character monthOffset of fileName
--Getting all digits of the year from the filename
set fileNameYearOffset1 to (offset of leftParen in fileName) + 3
set fileNameYearOffset2 to (offset of rightParen in fileName) - 1
set fileNameYear1 to character fileNameYearOffset1 of fileName
set fileNameYear2 to character fileNameYearOffset2 of fileName
set fileNameYear to characters fileNameYearOffset1 thru fileNameYearOffset2 of fileName
set fileNameDate to fileNameMonth & "/" & fileNameyear
display dialog "Date: " & fileNameDate as string
--tell application "Database/Digital Asset Management Program"
--Code to add keyword fileNameDate would go here
--end tell
end if
-------------------------------------------------------------
-------------------------------------------------------------
end repeat
end timeout
end open