I’m trying to write a ui script simply to click the apply now button in the network pref pane but it’s not working…
tell application “System Preferences”
activate
set current pane to pane “com.apple.preference.Network”
tell window “Network”
click button “Apply Now”
end
end tell
What it the proper way of clicking a normal button with ui scripting?
I had to use Extra Suites when I wanted to hit a button
on an app that wasn’t scriptable.
property theTicks : 200
selectMenuItem("GameRanger", 2, 1)
-----
on selectMenuItem(appl, theMenu, menuItem)
tell application "GameRanger" to quit
tell application "Extra Suites"
ES set screen resolution width 1024 height 768
ES pause theTicks
ES set volume 15
set mouseLoc to ES mouse location
ES move mouse {659, 337}
ES pause theTicks
ES click mouse
ES pause theTicks
ES pause theTicks
tell application "GameRanger" to activate
set mouseLoc to ES mouse location
ES move mouse {30, 15}
ES pause theTicks
ES click mouse
repeat theMenu times
ES type key "right arrow"
ES pause theTicks
end repeat
repeat menuItem times
ES type key "down arrow"
ES pause theTicks
end repeat
ES type key "return"
ES move mouse mouseLoc
ES type key "return"
ES pause theTicks
ES pause theTicks
ES pause theTicks
ES pause theTicks
tell application "Extra Suites"
ES pause theTicks
ES move mouse {720, 420}
ES click mouse
ES type key "return"
end tell
end tell
end selectMenuItem
i get what u mean, but i’m pretty sure there should be an easier way if the app is a cocoa app (like a prefpane). i know you can click other items like popup buttons much or easily like
click pop up button 1
but i can’t work out how to click an ordinary button