2012-01-10 46 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