I’m trying to bring a specific window to the front in Safari but it’s not quite working. Here’s a small script that shows the problem.
tell application "Safari"
activate
set g_windows to name of every document
set thisOne to (choose from list g_windows)
if (thisOne is not false) then set index of window (first item of thisOne) to 1
end tell
While this does bring the window to the front it’s not active. The only thing I’ve found to make it active is to set the visibility of window 2 to false. The unfortunate side-effect of this is that the window name then disappears from the Safari Window menu.
Any ideas?
Jim
Safari Version 2.0.4 (419.3)
Mac OS X 10.4.7 (Build 8j135)
tell application "Safari"
activate
set g_windows to name of every document
set thisOne to (choose from list g_windows)
if (thisOne is not false) then set index of window (first item of thisOne) to 1
set miniaturized of window 2 to true
end tell
What works here is to set the visible of the chosen window to false and then to reinstate it.
tell application "Safari"
activate
set g_windows to name of every document
set thisOne to (choose from list g_windows)
if (thisOne is not false) then
set thisOne to item 1 of thisOne
set visible of window thisOne to false
set visible of window thisOne to true
end if
end tell