これは私が持っている AppleScript です。Minecraft を開いて自動ログインするためのものです。アプリケーションにバンドルされていない場合は問題なく動作します。ただし、バンドルするたびに、最後に開いたままになり、「[スクリプト] の終わりがスクリプトの終わりを理解していません」というエラーが表示されます。私は何を間違っていますか?
if application "Minecraft" is running then
beep 1
display dialog "Error: Minecraft cannot be launched as it is already running." buttons {"Cancel"} default button 1
end if
tell application "Minecraft"
launch
activate
end tell
set timeoutSeconds to 1
set uiScript to "click Ul Element \"Login\" of window \"Minecraft Launcher\" of application process \"Minecraft\""
my doWithnmeout(uiScript, tlmeoutSeconds)
end run
on doWithnmeout(uiScript, tlmeoutSeconds)
set endDate to (current date) + timeoutSeconds
repeat
try
run script " tell application \"System Events\"
" & uiScript & "
end tell"
exit repeat
end try
end repeat
end doWithnmeout
end run
tell application "Minecraft"
activate
end tell
end run