Search code examples
debuggingapplescriptdroplet

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/conv2spct.app" 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


Solution

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

    do shell script "open -a /Appli/conv2spct.app ~/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