作爲前言,我是非常新的AppleScript的。工作AppleScript在投入工作流時失敗
我有一個非常簡單的,工作的AppleScript時在Automator的工作流程/應用程序的一部分運行總是失敗。我知道該腳本可以工作,因爲我可以在腳本編輯器中多次運行它,並且沒有錯誤。
下面是腳本:
activate application "Chess"
tell application "System Events" to tell process "Chess"
click menu item "Preferences…" of menu "Chess" of menu bar item "Chess" of menu bar 1
tell window 1
repeat until sheet 1 exists
delay 0.1
end repeat
end tell
tell group "Speech" of sheet 1 of window 1
set checkboxOne to checkbox "Allow Player to Speak Moves"
set checkboxTwo to checkbox "Speak Computer Moves"
set checkboxThree to checkbox "Speak Human Moves"
tell checkboxOne
set checkBoxStatus to value of checkboxOne as boolean
if checkBoxStatus is true then click checkboxOne
end tell
tell checkboxTwo
set checkBoxStatus to value of checkboxTwo as boolean
if checkBoxStatus is true then click checkboxTwo
end tell
tell checkboxThree
set checkBoxStatus to value of checkboxThree as boolean
if checkBoxStatus is true then click checkboxThree
end tell
end tell
click button "OK" of sheet 1 of window 1
end tell
再次,自己獨立運行時,沒有錯誤。當作爲的Automator工作流/應用程序的一部分運行,我得到的錯誤:
System Events got an error: Can’t get sheet 1 of window 1 of process "Chess". Invalid index.
與突出顯示的行是
click button "OK" of sheet 1 of window 1
有我丟失的東西?爲什麼會發生此錯誤,我該如何解決?
在此先感謝您的幫助!
完美!我現在意識到遊戲中心登錄確認正在影響工作表的方式,導致錯誤。 – Red5Seeker7