Hello,
This UI script works fine but is very slow. Is there any way to accomplish this without UI scripting? Or even just speed it up somehow?
tell application "Safari" to activate
tell application "System Events"
click menu item "Move Tab to New Window" of menu "Window" of menu bar 1 of process "Safari"
end tell
The main reason to use the menu item is because Safari 4 doesn’t reload the page. It just ‘detaches’ it from the current window. No load time.
Hopefully it’s possible. Thanks.
Hi,
try this
tell application "Safari"
set currentTab to current tab of window 1
set newDoc to make new document
tell front window
move currentTab to end of tabs
delete tab 1
end tell
end tell
Thanks Stefan.
I was doing almost the same thing with this:
tell application "Safari"
activate
set tabNo to index of last tab of front window
set firstURL to URL of document 1
close current tab of first item of windows
set secondURL to URL of document 1
make new document
set URL of document 1 to firstURL
end tell
Your script is faster, but it still reloads the page in the new window.
If you drag a tab out of Safari using the mouse, it opens in its own window without reloading. It’s instant. The same instant separation of tabs into windows can be accessed via Safari’s “Window” menu using the “Move Tab to New Window” menu item. What I’m looking for is a way to access this functionality via a non UI AppleScript.
I think Stefan’s script reloads the page.