AppleScript错误1719

时间:2017-03-03 14:21:10

标签: applescript

我对这个AppleScript有疑问。错误1719。 Instruments app 我需要将新滑块值设置为2。

这是我的代码:

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

感谢您的帮助

1 个答案:

答案 0 :(得分: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