2012-01-10 33 views
2

我正在尝试编写一个可改变狮子会滚动条(System Preferences> General)的可见性的applescript。通常我喜欢保持在“自动根据输入设备”设置,但在家里我使用Wacom数位板,所以我需要切换到始终用AppleScript(狮子)更改滚动条的可见性

这是我到目前为止有:

tell application "System Preferences" 
    activate 
    set current pane to pane "com.apple.preference.general" 
end tell 
tell application "System Events" 
    if UI elements enabled then 
     try 
      tell process "System Preferences" 
       click radio button "Always" 
      end tell 
    end try 
    end if 
end tell 

但我总是最后一个错误

--> error number -1728 from «class radB» "Always" of «class prcs» "System Preferences" 

在行“点击电台......”

我尝试过各种变化

click radio button 3 of Window 1 

click radio button 3 of radio group 1 of window 1  -- error number -1719 

我明显做错了什么,但搞不清楚是什么。

回答

2

如果你有安装了开发工具,还有一个访问性检查应用程序,它会告诉你一个特定的UI元素的层次结构:

click radio button "Always" of radio group 2 of window 1 
+0

谢谢!我不知道辅助功能检查员。 – nxtwrld 2012-02-01 20:01:45