UI Element Example
UI Element Example
- Subject: UI Element Example
- From: "Kenneth T. Davis" <email@hidden>
- Date: Tue, 23 Dec 2003 10:40:19 -0800
Friends:
While experimenting with the UI elements capability (make sure you turn it on in preferences:Universal Access:Enable Access for Assistive Devices) I wrote this script to allow one to view the source page of an open web page and arrange the two pages side by side for comparison.
Of course, you must be using Safari as your browser, and you must be looking at the page of a web site.
You can tell by the clumsy nature of the script that a lot of experimentation was needed before I got it to work.
I found the script would "get stuck," and needed help by an invisible mouse click to the menu bar once or twice.
I post this to see if anyone has a better way to do the same thing--so that I may learn.
I ran the Apple-supplied "Probe Menu" script in the "UI Element Scripts" folder to discover how to specify the menu item.
Happy Holidays,
Ken
on viewSource()
tell application "System Events"
tell application process "Safari"
tell menu bar 1
tell menu bar item "View"
tell menu "View"
tell menu item "View Source"
click
end tell
end tell
tell application "Safari" to activate
click
end tell
click
--click
end tell
--change the bounds, of course, to your liking; to your screen's dimension or resolution
set bounds of window 1 of application "Safari" to {512, 22, 1022, 728}
try
set bounds of window 2 of application "Safari" to {0, 22, 511, 728}
on error
tell application "System Events" to click menu item "View" of menu bar 1 of application process "Safari"
end try
end tell
end tell
end viewSource
viewSource()
_______________________________________________
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.