Re: UI Scripting
Re: UI Scripting
- Subject: Re: UI Scripting
- From: roncross <email@hidden>
- Date: Thu, 22 Jan 2004 13:50:35 -0700
To do what you are doing you can do it on one line the way I have it
below. In one script that I use, I reduce the text size to the
smallest level and click each time. This is very effective. Also
notice the delay in the script. This is necessary when you are using
GUI scripting.
repeat 3 times
delay 2
click menu item "Make Text Smaller" of menu "View" of menu bar 1
delay 1
end repeat
In order to set your window size, you should use do JavaScript. In the
example below, I use do Javascript to move and resize the window, To
learn how to do this. Go to apple site and download the Safari Script
collection.
tell application "Safari"
do JavaScript
"self.moveTo(761,0);self.resizeTo(800,screen.availHeight)" in document 1
end tell
The problem with your script below is that it is not easy to follow. I
don't know why you have to activate Safari twice?
On Thursday, January 22, 2004, at 10:58 AM, Kenneth T. Davis wrote:
>
Received from Craig Sutherland on 1/22/04.
>
>
Craig:
>
>
I know what you're experiencing.
>
>
This is how I managed to "kick" the UI script into action, so the
>
menu items respond. It's ugly, but...
>
>
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
>
(You don't need to activate Safari again within your system event. It
>
throws off the flow of your program. Look at the examples above and
>
consider using PreFab)
>
tell application "Safari" to activate
>
click
>
end tell
>
click
>
--click
>
end tell
>
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
>
>
> On Jan 22, 2004, at 8:48 AM, Simon Forster wrote:
>
>
>
>> Why is it that with certain applications, when you use UI scripting
>
>> to
>
>> click a button, the button will highlight but nothing happens.
>
>
>
> An example would be helpful. What application? Post your script.
>
>
>
>>
>
>> Given that this happens, can anyone suggest a work around? Is it
>
>> possible to move the pointer to a location on the screen and then
>
>> emulate a mouse click? Will this make a difference?
>
>
>
> Perhaps.
>
>
>
>> Simon Forster
>
>
>
>
>
> Craig Sutherland
>
> _______________________________________________
>
> 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.
>
_______________________________________________
>
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.
>
>
thanks
Ronald Cross
_______________________________________________
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.