3

の代わりに、ここで変数"asdf"を使用したいと思います。input

これは簡単なように思えますが、何らかの理由で理解できません。

on run {input, parameters}
-- Type 'asdf'
delay 1.900231
set timeoutSeconds to 2.0
set uiScript to "keystroke \"asdf\""
my doWithTimeout(uiScript, timeoutSeconds)
return input
end run

on doWithTimeout(uiScript, timeoutSeconds)
set endDate to (current date) + timeoutSeconds
repeat
    try
        run script "tell application \"System Events\"
" & uiScript & "
end tell"
    exit repeat
    on error errorMessage
        if ((current date) > endDate) then
            error "Can not " & uiScript
        end if
    end try
end repeat
end doWithTimeout

たとえば、 を試してみるとset uiScript to "keystroke input"、Automator から次のエラーが表示されます。

The action “Run AppleScript” encountered an error.
Check the actionʼs properties and try running the workflow again.
4

1 に答える 1

4

自分でそれを理解しました。私は今、ばかげていると感じています。

set uiScript to "keystroke \"" & input & "\""

于 2013-04-19T20:20:52.187 に答える