Using theFile to send file path to shell script?

Get help. Get answers. Let others lend you a hand.

Moderator: Mr_Noodle

Hi guys,

So basically I'm trying to get imageoptim to run automatically on my screenshots folder when I take one.

At the moment I've got it setup but I need to pass the new file created file name to the program, so I'm working on the embedded script as..

Code: Select all
do shell script "find " & theFile & " | /usr/local/bin/imageoptim -j -q"


Now the problem is, " & theFile & " sends "Macintosh HD:Directory:etc"

No good for a shell script, at the minute it gets stuck because the first space is terminating it, I'd need it sent as "Machintosh\ HD/Directory/etc" Any way I can do that?
realdannys
 
Posts: 2
Joined: Thu Jun 26, 2014 11:08 am

You'll need to get the posix path. Check out this page: http://en.wikibooks.org/wiki/AppleScrip ... _and_paths
Mr_Noodle
Site Admin
 
Posts: 11262
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Mr_Noodle wrote:You'll need to get the posix path. Check out this page: http://en.wikibooks.org/wiki/AppleScrip ... _and_paths


:shock: :shock: if only I could understand how to put that into action?!
realdannys
 
Posts: 2
Joined: Thu Jun 26, 2014 11:08 am

I suggest you read up more on AppleScript. It's probably a bad idea to do scripting blindly.
Mr_Noodle
Site Admin
 
Posts: 11262
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Support