我想在这里使用"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.
答案 0 :(得分:3)
自己想出来。我现在感到愚蠢。
set uiScript to "keystroke \"" & input & "\""