views:

55

answers:

1

So I want to associate a particular 'protocol' in my Opera browser with a shell script on OSX.

In Opera, I therefore did:

  1. <open preferences dialog>
  2. Advanced Tab -> Programs
  3. Added 'myProtocol' and set it to open with other application '~/bin/myScript.sh'
  4. Applied settings etc.

Now, when I go to myProtocol://some.url.or.other, opera is calling my script. However, $* shows that the only argument passed to the script is the OSX PSN.

i.e. in the script the line

echo $0 called with $*

outputs

/Users/me/bin/myScript.sh called with -psn_0_4588640

Why is it calling it with the PSN as the cmd line? Why not the URL? On ubuntu Opera passes the URL, what's with OSX?

Can I get it to call it with the URL? Is it going to be available as a environment variable instead?

A: 

Opera seems to use the Apple command open to open the file passed in

This launches the application yhen sends it an Apple Event using Launch Services http://developer.apple.com/documentation/Carbon/Conceptual/LaunchServicesConcepts/LSCConcepts/LSCConcepts.html

So to open a file the app will be started and then has to respond to an apple event

Your application will have to be a full OSX application not just a script

The -psn on the command line is apssed in from the Workspace

Mark
Makes sense. It worked on linux - a pity the same quick and dirty fix didn't work here too.Thanks!
nasbbig