How do I use a variable in AppleScript (called from within Automator) -
instead of "asdf"
, want use input
variable here.
seems should easy, reason can't figure out.
on run {input, parameters} -- type 'asdf' delay 1.900231 set timeoutseconds 2.0 set uiscript "keystroke \"asdf\"" dowithtimeout(uiscript, timeoutseconds) return input end run on dowithtimeout(uiscript, timeoutseconds) set enddate (current date) + timeoutseconds repeat try run script "tell application \"system events\" " & uiscript & " end tell" exit repeat on error errormessage if ((current date) > enddate) error "can not " & uiscript end if end try end repeat end dowithtimeout
for example, if try set uiscript "keystroke input"
, error automator:
the action “run applescript” encountered error. check actionʼs properties , try running workflow again.
figured out myself. feel dumb now.
set uiscript "keystroke \"" & input & "\""
Comments
Post a Comment