ExifTool Forum

ExifTool => Newbies => Topic started by: BlackWhite on February 24, 2016, 03:29:00 AM

Title: ExifTool in AppleScript on Mac's El Capitan: Path
Post by: BlackWhite on February 24, 2016, 03:29:00 AM
Hello,

I have a AppleScript (see below) in Hazel which uses ExifTool to generate PDF keywords from existing PDF comments. This Script works fine under Yosemite, but don't work under El Capitan.
In several posts it has recommended to add the path to ExifTool. So I have changed the code "exiftool -keywords " & myPosixPath" to "/usr/local/bin/exiftool -keywords " & myPosixPath, but it doesn't work. Perhaps I have to change other Paths settings (myPosixPath)?

Any suggestions?

tell application "Finder" to set Thecomment to comment of theFile

set myPosixPath to quoted form of POSIX path of theFile

set oldkeywords to do shell script "/usr/local/bin/exiftool -keywords " & myPosixPath

set oldDelimiters to AppleScript's text item delimiters

set {tid, AppleScript's text item delimiters} to {AppleScript's text item delimiters, ":"}

set Keywordstring to ""

try
set oldkeywords to text 2 thru -1 of text item 2 of oldkeywords

set AppleScript's text item delimiters to ", "

set oldkeywords to text items of oldkeywords

repeat with i from 1 to count of oldkeywords
set theKEYWORD to quoted form of item i of oldkeywords
if (count of theKEYWORD) < 66 then

set theKEYWORD to " -keywords=" & theKEYWORD
set Keywordstring to Keywordstring & theKEYWORD
else
display dialog "keyword zu lang: " & theKEYWORD giving up after 5
end if
end repeat
end try

try
set AppleScript's text item delimiters to ";"

set newkeywords to text items of Thecomment

repeat with i from 1 to count of newkeywords
set theKEYWORD to quoted form of item i of newkeywords
if (count of theKEYWORD) is not greater than 66 and (count of theKEYWORD) is not equal to 2 then

set theKEYWORD to " -keywords=" & theKEYWORD
set Keywordstring to Keywordstring & theKEYWORD
else
display dialog "Problem mit keyword: " & theKEYWORD giving up after 5
end if
end repeat
end try

set tid to AppleScript's text item delimiters

do shell script "exiftool" & Keywordstring & " " & myPosixPath


Title: Re: ExifTool in AppleScript on Mac's El Capitan: Path
Post by: StarGeek on February 24, 2016, 04:16:58 AM
Are you calling exiftool for a second time on the last line?  Try putting the full path there as well.
Title: Re: ExifTool in AppleScript on Mac's El Capitan: Path
Post by: BlackWhite on February 24, 2016, 08:58:25 AM
Hi,

Thank you very much for your response!

I have put now the full path on the last line, et voilĂ , exiftool is working fine!  ;D