'open location' always going to Safari?

I’ve got Firefox set as my default browser.

I’ve got something like:


open location "http://www.yahoo.com"

In my script.

I run it - it opens a Firefox tab to yahoo - groovy.
I save it as an application bundle & run it - it opens a Firefox tab - grovvy.

I create an Installer for my application bundle using PackageMaker - I then install my app & run it and BOOM - now it’s opening Safari.

I have seen this happen on both my machine & others (10.4)

Any ideas???

THANKS! Mark

Hi Mark,

I recommend to retrieve the default browser explicitly

set defaultBrowser to default_browser()
tell application defaultBrowser to open location "http://www.yahoo.com"

on default_browser()
	try
		set dB to (do shell script "defaults read com.apple.LaunchServices | grep 'http;' | cut -d \\\" -f 2")
	on error -- if not listed, then the system default
		set dB to "com.apple.safari"
	end try
	tell application "Finder" to return (get name of (application file id dB))
end default_browser

OOOh the triple-backslash! Didn’t see that coming.

Seriously thanks for that - seems to be working swimmingly

Mark

Out of curiosity, does your app work fine if you don’t use a package to distribute it?

Yes - if it’s just an Application Bundle’ it does the right thing.
Only when packaged via Package Maker (which is then put into a DMG) & installed does it always go to Safari.

Mark

the first backslash escapes the second one
the third backslash escapes the quote

" is the equivalent to the needed form for the shell [b][/b][b]"[/b]

Hey I’m all for it - of course there’s the more boring: ‘"’ as well (single quotes around " )

thanks again - BTW this forum REALLY rocks & I’ve learned tons here. It’s been goofy coming from a perl background but this is by far my main applescript resource. thanks again,
Mark