I have two cases where I call exiftool. Below are the code snippets for the Windows implementation, which work as expected.
The first case (creating a comprehensive list of keywords) includes sorting, reducing the list to unique entries, and outputting to a file. Because this is piped it required that I execute it by first calling "cmd /c". Here's the working Windows code.
Code: Select all
CodeSelect
Workingdirectory$=""
Commandline$ = " /c exiftool -r " + Chr(34) + Input_Directory$ + Chr(34) + " -Keywords -b -sep " + Chr(34) + "\n" + Chr(34) + " -sep " + Chr(34) + "\n" + Chr(34) + " | sort /unique > " + Chr(34) + Output_Directory$ + "Keyword Listing.txt" + Chr(34)
Result = RunProgram("cmd",Commandline$,Workingdirectory$,#PB_Program_Hide|#PB_Program_Wait)
Code: Select all
Exiftool$ = "exiftool"
Workingdirectory$=""
Commandline$ = " -r " + Chr(34) + Input_Directory$ + Chr(34) + " -if " + Chr(34) + "$rating >="+Rating$ + Keyword_Filter$ + Chr(34) + " -o " + Chr(34) + Output_Directory$ + Output_String$ + Chr(34)
Result=RunProgram(Exiftool$,Commandline$,Workingdirectory$,#PB_Program_Hide | #PB_Program_Wait)
So I'm 100% new to the mac world. I've scoured the internet, looking also for python equivalent examples, etc. and seen some posts on this site too. I've believe I've accounted for special characters and have substituted with Char(39) to use a single quote where needed (though not reflected in the original working Windows posted above). It seems that my difficulties are more fundamental and that exiftool is never really even called. I've experimented with using either "open", "sh" or "bash" in the same fashion as "cmd /c" but as of yet, no luck. As mentioned in my previous post, when directly entering a good command string in to a Terminal window, things are good.
On the Mac, how do I call exiftool with all the associated syntax for these two cases - one to mimic using "cmd /c" as the principle program called with exiftool and its syntax passed as the argument and the other to call exiftool and its argument directly? As you can see my calling program (PureBasic) is flexible - it allows me to specify the command, command line string, and working directory. In addition, I can stipulate if I wish to have it execute hidden, to hold execution, etc..
An answer to either would be great, both would be fantastic. Do you have a tutorial on this?