Help with Scripting 'Do Shell Script'

Hi, I am trying to get Terminal to open some files for me rather than doing it through the application directly, for reasons of speed (the files I want to open are loading through a slow external server and I don’t want my Filemaker held up for the time it takes to load them). I’ve racked my brains with this for hours but am running into a wall, could someone possibly help me?

This script works fine:

tell application “Terminal”
set theimage to quoted form of POSIX path of “/Users/pp/Main/Important Stuff/Banners Sept 2010/master container/100x300_1.psd”
do shell script "open " & theimage
end tell

and the images load in Photoshop (the default app for TIF files), nicely loading in the “background” as far as Terminal is concerned.

The issue is when I try to load from a remote server, escaping the filename so that it will work becomes an impossible process, and I get errors. Remotely in terminal, this works fine:

open /Volumes/Mac\ HD/Scans\ Master/image\ archive/f5/loose_y46.psd

and the image is loaded normally. How can I convert this command, say, to something that will run properly embeded in a “do shell script” command? Nothing I can do will make the file come up, but instead gives “file not found” or other errors.

Model: Macbook Pro
Browser: Safari 534.3
Operating System: Mac OS X (10.6)

Hi,

you have the answer in your first script.
quoted form escapes all critical characters reliably.
But you don’t need the POSIX path coercion. Slash separated paths are POSIX paths by definition


do shell script "open " & quoted form of "/Volumes/Mac HD/Scans Master/image archive/f5/loose_y46.psd"

Wow, thank you very much! Works great now.