deek5 deek5 - 1 year ago 183
AppleScript Question

How to debug droplets using AppleScript

Just 3 lines of script to be able to test a droplet application without leaving applescript editor

set fich to POSIX file "/Appli/" as string

tell application "Finder" to open POSIX file "/Users/yourusername/Desktop/somefile" using application file fich

If there are errors in your droplet a display dialog will be opened by the script editor applescript

Answer Source

Here's a pragmatic alternative using do shell script, which potentially allows you to specify multiple file arguments:

do shell script "open -a /Appli/ ~/Desktop/somefile1 ~/Desktop/somefile2"

The above paths happen not to need quoting (escaping) for the shell, but when using variables to specify the file paths, it's best to use quoted form of (to pass multiple arguments, apply quoted form of to each):

do shell script "open -a " & quoted form of fileappli & " " & quoted form of fileargument
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download