Re: Getting popup menu item with System Events
Re: Getting popup menu item with System Events
- Subject: Re: Getting popup menu item with System Events
- From: yvan-koenig <email@hidden>
- Date: Mon, 7 Feb 2005 14:45:38 +0100
Le 7 févr. 2005 , à 13:54, Ralf Funke a écrit :
I am trying to use System Events to automate switching between sites
in Safari.
There is a popup menu that I have to access. I managed to get this
far:
tell application "System Events"
tell process "Safari"
click pop up button 1 of group 3 of UI element 2 of UI element 1 of
scroll area 1 of group 2 of window "xyz"
delay 3
keystroke (ASCII character 31)--the problem
end tell
end tell
Since I could not find a way to get the elements of the popup menu
directly I thought of just
using the arrow key to move down. And here is the problem. I cannot
find a way to simulate the key down. Tried keystroke down but this
also does not work. (I had a frustrating problem before when I could
not use keystroke to type numbers and had to use key code instead. But
I found the solution only by trial and error.) Is there a
documentation that helps? Anyone any idea?
As there is a bug in KeyStroke for french keyboard (keystroke "i" or
"I" send a "q" or "Q"), I was forced to look in key codes.
Here are the arrow codes and a sample code.
property theApp : "AppleWorks 6"
tell application theApp
activate
tell document 1
my rightArrowGUI()
end tell
end tell
-- ==================
on kCodeGUI(nb)
tell application "System Events"
if UI elements enabled then
set frontmost of process theApp to true
tell process theApp
key code nb
end tell -- to process
else
my GUImissing()
end if
end tell -- to System Events
end kCodeGUI
-- ==================
on enterGUI()
my kCodeGUI(76) (* enter key *)
end enterGUI
on leftArrowGUI()
my kCodeGUI(70) (* Left arrow *)
end leftArrowGUI
on upArrowGUI()
my kCodeGUI(77) (* Up Arrow *)
end upArrowGUI
on rightArrowGUI()
my kCodeGUI(66) (* Right arrow *)
end rightArrowGUI
on downArrowGUI()
my kCodeGUI(72) (* Down Arrow *)
end downArrowGUI
-- ==================
Yvan KOENIG
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden