Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'AppleScript better and worse' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
AppleScript better and worse
Authored by: Krioni on Apr 14, '03 08:00:31PM

They added a do Javascript command, which is very nice!
However, they did NOT allow access to tabs. In other words, any
script that gets the document of window 1, for example, has no
idea that window 1 actually contains many tabs. Thanks a lot.

I'm going to have to leave tabs turned off, since I run a
background script that saves a list of the URLs of my currently
open windows to a text file every minute or so. That way, when I
crash, I can open all my unread pages back up and not miss
anything. If I used tabs, I'd be screwed, since only the current
tab of each window would be saved.

I was afraid they'd add the feature of tabs, but not bother adding
it completely.



[ Reply to This | # ]
GUI scripting can do it but it's to obnoxious
Authored by: robJ on Apr 15, '03 06:19:18PM
I know that GUI scripting would be too intrusive for this particular task but it does make it possible to gather info from a multi-tab window. :-)

set targetURLs to {}
tell application "Safari" to activate

tell application "System Events" to tell application process "Safari"
set tabNames to name of radio buttons of window 1
end tell

tell application "Safari"
repeat with thisTab in tabNames
tell application "System Events"
tell application process "Safari"
tell radio button named thisTab of window 1 to click
end tell
end tell
copy {aURL:URL of document of window named thisTab, aTab:contents of thisTab} to end of targetURLs
end repeat
end tell
targetURLs


The script will gather the page name and URL for window 1 in Safari.

[ Reply to This | # ]