• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Accessing Tabs in Safari
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Accessing Tabs in Safari


  • Subject: Re: Accessing Tabs in Safari
  • From: Michael Schmidt <email@hidden>
  • Date: Thu, 27 Nov 2003 12:39:32 +0100

Hi, all!

Am 26.11.2003 um 22:18 schrieb Timothy Bates:

You can't. The only answer is to ask apple to expose the tabs in
applescript, which they haven't done.

I would like to refresh all tabs in Safari via Applescript.
So I want to walk through all tabs doing the following:

tell application "Safari"
set p to count windows
repeat with i from 1 to p
set thisURL to URL of document 1 of window i
do JavaScript "self.location=\"" & thisURL & "\";" in document 1 of
window i
end repeat
end tell


I tried the whole day and did it via GUI Scripting and System Events:

on refreshAll()
-- to get access to the window, it must be visible
set isMinimized to false
set isHidden to false
tell application "Safari"
set isHidden to not visible of window 1
if isHidden then
set isMinimized to miniaturized of window 1
if isMinimized then
set miniaturized of window 1 to false
set isHidden to false
end if
end if
end tell
set activeTab to 1
if isHidden then
tell application "Safari" to set visible of window 1 to true
end if

-- the real script starts here
tell application "System Events"
tell process "Safari"
set tabCount to count radio buttons of window 1
repeat with i from 1 to tabCount
if value of attribute "AXValue" of radio button i of window 1 = 1 then
-- to activate the now active tab after doing the refreshs
set activeTab to i
end if
end repeat
repeat with i from 1 to tabCount
-- activate each tab
click radio button i of window 1
-- tell it to refresh via JavaScript
tell application "Safari"
tell window 1
set thisURL to URL of document 1
do JavaScript "self.location=\"" & thisURL & "\";" in document 1
end tell
end tell
end repeat
-- return to the starttab
click radio button activeTab of window 1
end tell
end tell
if isMinimized then
-- if the window was minimized, minimize it again
tell application "Safari" to set miniaturized of window 1 to true
end if
if isHidden then
-- if the window was hidden, hide it again
tell application "Safari" to set visible of window 1 to false
end if
end refreshAll

Thanks,
Michael Schmidt
Hamburg
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: Accessing Tabs in Safari (From: Timothy Bates <email@hidden>)

  • Prev by Date: [ANN] iList 1.5 beta 1
  • Next by Date: save configuration
  • Previous by thread: Re: Re: Accessing Tabs in Safari
  • Next by thread: Re: Plz Help !
  • Index(es):
    • Date
    • Thread