osx - Applescript not delaying in Automator -


i'm trying create scanner script. it's working in script editor, in automator delay not working. function executes instead.

on imagecaptureopen()     tell application "system events" (name of processes) contains "image capture" end imagecaptureopen  on scanimage()     tell application "system events"         tell process "image capture"              set scanwindow group 2 of splitter group 1 of window 1              set combobox combo box 1 of scroll area 1 of scanwindow             if value of combobox number less 300 set value of combobox "300"              if button "scan" of scanwindow exists click button "scan" of scanwindow          end tell     end tell end scanimage  if not imagecaptureopen()     tell application "image capture" activate     delay 30     scanimage() else     scanimage() end if 

any ideas why isn't working?

you should've posted workflow well, because that's problem. script not return value, following action after run script action not wait returned value before moving on next action. 1 solution try make next action dependent on receiving value previous script action. also, convoluted way of checking verify "image capture" running unnecessary. suggest:

tell application "image capture" activate tell application "system events"     tell process "image capture"          set scanwindow group 2 of splitter group 1 of window 1         set combobox combo box 1 of scroll area 1 of scanwindow         if value of combobox number less 300 set value of combobox "300"              if button "scan" of scanwindow exists click button "scan" of scanwindow         end tell end tell 

also, i'm not sure gui scripting reference work in situations, that's issue.


Comments

Popular posts from this blog

php - Submit Form Data without Reloading page -

linux - Rails running on virtual machine in Windows -

php - $params->set Array between square bracket -