In my case I have many tabs opened in Safari and I want to move to Firefox. I know I can note down all the url in a text file and open all of them again one by one in another browser. But I'm looking for any shortcut way.
Asked
Active
Viewed 6,318 times
3 Answers
8
You could use the following AppleScript:
tell application "Firefox"
activate
set newTabURLs to takeSafariTabURLs() of me
repeat with tabURL in newTabURLs
open location tabURL
delay 1
end repeat
end tell
on takeSafariTabURLs()
set tabURLs to {}
tell application "Safari"
repeat with w in windows
if name of w is not "" then --in case of zombie windows
repeat with t in tabs of w
set tabURL to URL of t
set the end of tabURLs to tabURL
end repeat
end if
end repeat
return tabURLs
end tell
end takeSafariTabURLs
John Sidiropoulos
- 111
- 1
- 2
2
I tried following what Ramhound has mentioned, and it turned out to be very helpful. I saved all the bookmarks in a folder in Safari, and then imported the bookmarks in Firefox. It was just a simple process.
Shubhankar Raj
- 121
2
Minor changes to preserve windows. I put a gist of this as well...if others want to improve it. see https://gist.github.com/amanuel/81e70673b057687e904a248218c50ce2
tell application "Firefox"
activate
set safariWindows to getSafariWindows() of me
repeat with w in safariWindows
set newTabURLs to takeSafariTabURLs(w) of me
repeat with tabURL in newTabURLs
open location tabURL
delay 0.5
end repeat
tell application "System Events" to keystroke "n" using command down
delay 1
end repeat
end tell
on getSafariWindows()
set safariWindows to {}
tell application "Safari"
repeat with w in windows
if name of w is not "" then --in case of zombie windows
set the end of safariWindows to w
end if
end repeat
return safariWindows
end tell
end getSafariWindows
on takeSafariTabURLs(w)
set tabURLs to {}
tell application "Safari"
repeat with t in tabs of w
set tabURL to URL of t
set the end of tabURLs to tabURL
end repeat
return tabURLs
end tell
end takeSafariTabURLs