Re: Do Shell Script Bug (or feature)
Re: Do Shell Script Bug (or feature)
- Subject: Re: Do Shell Script Bug (or feature)
- From: Chris Norman <email@hidden>
- Date: Fri, 01 Jul 2005 14:14:15 -0700
On 7/1/05 1:26 PM, "Christopher Nebel" <email@hidden> wrote:
> On Jul 1, 2005, at 12:44 PM, Chris Norman wrote:
>
>> on process_item(this_item)
>> do shell script "/opt/local/bin/jhead -cmd \"/opt/local/bin/
>> jpegtran
>> -progressive &i &o \" -autorot -n%m-%d-%Y-%H-%M-%S " & this_item
>> end process_item
>>
>> So you will see that the jhead tool is not like other command line
>> tools
>> that pipe to other tools, and instead uses the -cmd argument to
>> call onto
>> jpegtran to do it's thing (which is the -autorot argument) and I am
>> also
>> having jhead rename the files according the their EXIF date and time.
>>
>> So when this script runs, it always tells me that the jpegtran
>> command can
>> not be found. I thought it might be something to do just with how
>> AS was
>> sending the command line to the system, so I created a shell script
>> that I
>> saved, and then called just the shell script, but got the same
>> error. But
>> when I run the same exact command from the terminal, things work.
>
> If you plan to be spending a lot of time using "do shell script",
> then you should read TN2065, "do shell script in AppleScript" <http://
> developer.apple.com/technotes/tn2002/tn2065.html>.
>
> Assuming that /opt/local/bin/jpegtran exists, then this is probably
> some sort of quoting bug. The placement of those internal double
> quotes looks a bit fishy to me, especially since you say that the "-
> autorot" is supposed to be an argument to jpegtran. Exactly what do
> you say in Terminal that works?
>
I have read the tech note. It was one of the first places I looked when I
started having problems.
There are two commands going on there. The -autorot is an argument for
jhead, which looks at the orientation tag in the EXIF data to determine if
the image needs to be rotated, and if so, if it is 90 or 270.
The example commands given on the website for jhead look like this:
jhead -cmd "jpegtran -progressive &i &o" -r *.jpg
So the quotes are there so that the jhead command knows where the data for
-cmd argument is at (that is an educated guess).
Another example would be using jhead with mogirify command that is a part of
ImageMagick. That command looks like this:
jhead -cmd "mogrify -quality 80 &i" -model S100 -r *.jpg
I have not tried that command out either in the terminal or as a part of an
applescript.
And yes /opt/local/bin/jpegtran exists. I believe that it is the default
location that Darwinports installs it's binaries into.
I think you are on the same track that I am, that the argument that calls
jpegtran from within jhead is a bit odd, and it is probably what is causing
the issue.
Chris Norman
Technology Manager
Kane and Finkel
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden