2017-03-03 77 views
0

我遇到了这个applescript的问题。错误1719 Instruments app 我需要新的滑块值设置为2AppleScript错误1719

这是我的代码:

tell application "Instruments" 
    activate 
end tell 

activate application "Instruments" 

tell application "System Events" 

    tell process "Instruments" 

     keystroke "," using command down --Instruments menubar -> Preferences 

     tell window 1 
      click button "CPUs" of toolbar 1 

      set value of slider 1 of group 1 to 2 

     end tell   
    end tell  
end tell 

Image

感谢您的帮助

回答

0

这是一个引用错误。

滑块位于group 1 of group 1。当使用GUI脚本时,还建议在有时间关键的变化时等待特定的UI元素。

activate application "Instruments" 

tell application "System Events" 
    tell process "Instruments" 
     keystroke "," using command down --Instruments menubar -> Preferences 
     tell window 1 
      click button "CPUs" of toolbar 1 
      tell group 1 of group 1 
       repeat until exists slider 1 
        delay 0.2 
       end repeat 
       set value of slider 1 to 2 
      end tell 
     end tell 
    end tell 
end tell 
+0

太棒了!谢谢!! – robert