This is an app for quickly routing URLs from Firefox to Safari and back. Can be easily modified to allow for Chrome, or other popular choices. Often, Firefox is held as the most secure and ‘safe’ browser, but that entails disabling Flash and using a lot of privacy/security addons. Sometimes it is nice just to have an easy, casual browser and this enables sending back and forth, as needed.
Simply copy the URL onto the clipboard and trigger (ideally as a service/keyboard shortcut) and then select the destination browser. Initially, had it setup to auto-detect the “From” browser and send to the other, but then a new opportunity arose. If you have a list of links (separated by spaces, commas or line-breaks), it can route entire the group to the destination browser, one after another until all have loaded! So included browser choices in the dialog (defaulting to Safari).
For added stability, if the destination browser isn’t running, it will wait until the browser has completely loaded before sending the links.
Works reliably even on a Single-CPU PowerPC Mac (when configured for browser choices available, and using Spark for hotkey functionality).
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- A hotkey/keyboard-shortcut app for sending one or multiple URLs in-between Firefox & Safari browsers. Written by Adam Albrec (game_creator@hotmail.com) --
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- Prevents time-out while waiting for user response or browser to open.
with timeout of 86400 seconds
try
set incomingURLs to ""
set browserUp to false
set browserChoice to ""
set urlList to {}
set urlCount to ""
set runCount to 1
-- Gets URL/s from the clipboard.
try
set incomingURLs to (the clipboard) as text
end try
set incomingURLs to do shell script "echo " & quoted form of incomingURLs & " | sed 's/ htt/\\
htt/g;s/\\ //g;s/,htt/\\
htt/g;s/,//g' | awk 'NF'"
-- Prompts if no URL/s on clipboard (then exits).
if incomingURLs does not contain "http" then
beep
tell me
activate
display dialog "No Web-Address/s on the Clipboard!" with icon 2 buttons {"OK"} default button "OK"
end tell
error number -128
end if
-- Prompts for Browser Choice to send URL/s.
tell me
activate
display dialog " URL Dispatch" buttons {"Open with Firefox", "Open with Safari"} default button "Open with Safari"
end tell
set browserChoice to button returned of the result
if browserChoice is "Open with Safari" then
-- Safari
-- Delays until browser has loaded (if not already running).
launch application "Safari"
repeat while (not browserUp)
tell application "System Events"
tell process "Safari"
set browserUp to (exists entire contents of last UI element)
end tell
end tell
if browserUp is false then
delay 1
end if
end repeat
-- Sends URL/s to Browser (1 each second) until all have been sent.
tell application "Safari" to activate
set urlList to the paragraphs of incomingURLs as list
set urlCount to the number of items of urlList
repeat urlCount times
try
set thisURL to ""
set thisURL to item runCount of urlList
tell application "Safari" to open location thisURL
end try
delay 1
set runCount to runCount + 1
end repeat
else
-- Firefox
-- Delays until browser has loaded (if not already running).
launch application "Firefox"
repeat while (not browserUp)
tell application "System Events"
tell process "Firefox"
set browserUp to (exists entire contents of last UI element)
end tell
end tell
if browserUp is false then
delay 1
end if
end repeat
-- Sends URL/s to Browser (1 each second) until all have been sent.
tell application "Firefox" to activate
set urlList to the paragraphs of incomingURLs as list
set urlCount to the number of items of urlList
repeat urlCount times
try
set thisURL to ""
set thisURL to item runCount of urlList
tell application "Firefox" to open location thisURL
end try
delay 1
set runCount to runCount + 1
end repeat
end if
----
-- End of Script.
----
end try
end timeout