Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

So I have this small bundle with applescript made, and it even seems to work as it should. However, it appearently doesnt open my files when it is asked to via the open utility. It works though when I use the finder. Can anybody help me? My code is this:

on open theFile
    set runner to ((path to me)'s POSIX path) & "Contents/MacOS/desk_parse"
    -- We need to escape some stuff here.
    -- Expected output: '/path/to/' '/path/to/app.desk'
    do shell script "'" & runner & "' '" & (POSIX path of theFile) & "' &"
    --display dialog runner
end open

Again, it works from finder, but not from command line like:

open "theFile.ext"

My Info.plist rads and also accepts the extension I saved into it. So that association actualy works.

share|improve this question

That is normal behavior: the open handler applies to:

  • Files dropped on the application from Finder
  • Files opened with for example tell app "Finder" open ... using path to "Your Application"

But not to:

  • Files passed as arguments to open -a
  • Files opened in the application if the application is made the default application for a file type

You might create the application with Automator or Platypus instead.

With Automator, use a Run AppleScript action like this:

on run {input, parameters}
    say (POSIX path of item 1 of input)
end run

With Platypus, check "Accept dropped items" and use a normal run handler:


on run argv
    say item 1 of argv
share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .