MacOS – Web browser or extension to move multiple tabs between windows in a single action

macossafarisoftware-recommendationweb-browser

In Safari, I'd like to be able select multiple tabs at once, and move them all to an open or new window. Looking for extension (or magic Safari invocation) that can do this, I find no viable solutions.

Since Safari lacks this feature, is there any browser on OS X that does a better job of this, out of the box, or with an extension.

Best Answer

You might run a script like this in AppleScript Editor:

tell application "Safari"
    set w to window 1
    set namelist to name of tabs of window 1
    repeat with i from 1 to (count namelist)
        set item i of namelist to (i & " " & (item i of namelist)) as text
    end repeat
    set answer to choose from list namelist with multiple selections allowed
    if answer is false then return
    make new document
    repeat with i in (reverse of answer)
        move tab ((word 1 of i) as integer) of w to beginning of tabs of window 1
    end repeat
    delete tab -1 of window 1
end tell

This moves the current tab and all tabs right of it to a new window:

tell application "Safari"
    set l to tabs of window 1 where index ≥ (get index of current tab of window 1)
    make new document
    repeat with t in (reverse of l)
        move t to beginning of tabs of window 1
    end repeat
    delete tab -1 of window 1
end tell

Both scripts reload each tab though.

I normally just copy the URLs of tabs as text:

set text item delimiters to linefeed
tell application "Safari" to URL of tabs of window 1
set the clipboard to result as text

I can then for example copy part of the lines and run open $(pbpaste).