Instead of "asdf"
, I want to use the input
variable here.
Seems like this should be easy, but for some reason I can't figure it out.
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
For example, if I try set uiScript to "keystroke input"
, I get the error from Automator:
The action “Run AppleScript” encountered an error.
Check the actionʼs properties and try running the workflow again.
set uiScript to "keystroke \"" & input & "\""
? – andrewdotn Apr 19 at 20:18