Saturday, January 08, 2005

Wanted: An AppleScript for Safari that will open a viewed page in Firefox (OS X)

Apple - Discussions - Looking for: Open in Firefox AppleScript

From a post to the Apple Discussions Forum:
I use Firefox on Windows, but Safari on my Mac. (When Camino gets to the same Gecko engine as FF, and thus gets the web site support FF 1.0 now has, I'll probably switch to Camino on my Mac. I like Omniweb, but it has the same constituency problems as Safari.)

Although Safari works well most of the time, there are some sites, where I'd really like to use FF. Blogger, for example, provides its superb wysiwyg Compose editor only to the most recent FF/Moz release. Safari users are stuck with a barebones editor, Camino gets the previous Mozilla editor (for its version of Gecko).

Firefox on the PC has an "Open in IE" extension that lets me view some poorly implemented banking sites in IE. We need a similar "Open in FF" function for Safari. That way I could mostly work in Safari (for now), but switch to FF when I need it. (Ugly fonts and all.)

Has anyone done an "Open in Firefox" AppleScript for Safari?
Update: "Camelot" quickly replied with the script:
tell application "Safari"
set theURL to URL of document 1 -- get the current URL
end tell

tell application "Firefox" to Get URL theURL
For those who know even less AppleScript than I, this is what I did.

Wow. This works just as you described. It will help with Blogger and those other pages that don't quite work in Safari.

For those who know even less AppleScript than I, this is what I did.
1. Located the AppleScript folder in my Applications Folder.
2. Launched script editor and pasted in above (second example)
3. Saved script in my personal Library/Script/Safari folder.
4. Saved script again as an application. Unchecked StartUp Screen, checked Run Only. (This step is useful for LaunchBar integration, otherwise ignore it.)
Since I have the script icon on my toolbar (forget how I did that) I can click there and launch the script.

I also extended the script so FF would come to the front (not sure if this the right way to do so):
tell application "Safari"
set theURL to URL of document 1 -- get the current URL
end tell

tell application "Firefox" to Get URL theURL

tell application "Firefox"
activate
end tell

Lastly, by saving a copy of the script as an application, I had something that when I click on it just opens in FF. Then I configured Launchbar to index my scripts folder. Now when I activate launchbar and type 'OIF' FF launches.

I can start a post in Safari, and finish it in FF.

I can start a blog post in Safari, do Launchbar OIF, then complete editing it in FF. Works great.

No comments:

Post a Comment