Just to clarify: in MIDI Translator Pro, all AppleScript actions are blocking, i.e. the next AppleScript action waits for completion of the current AppleScript action. If an AppleScript action takes a long time, MT Pro will wait for it.
There are a number of (good) reasons for this, mainly that MT Pro keeps one AppleScript execution environment in memory so that whenever an AppleScript is to be executed, it happens fast. Otherwise, every AppleScript action would need to first set up the AppleScript environment, which takes a long time, especially when running time sensitive scripts.
In your case, you seem to be calling curl
from your AppleScript. The time when that script terminates is not determined by MIDI Translator Pro or AppleScript, but by the curl
process when it is done (i.e. when it terminates). So I suggest to set a low timeout in your call to curl
. I see this option in the curl manual:
--connect-timeout 0.5
which will wait at maximum half a second to connect to the PTZ camera.
Alternatively or additionally, there is probably a way in AppleScript to call curl
and not wait for its termination. You will have to look this up on your own, depending on how your script is set up.
Of course, you can also use Steve’s suggestion to use MT Pro’s Execute File outgoing action and call a shell script movecamera.sh
which just calls curl
without waiting for it. Because you can use it as general replacement for curl
, I’d name it curl_nowait.sh
:
curl_nowait.sh:
#!/bin/sh
nohup curl "$@" &
The & at the end will execute the command in background, while the nohup
command will prevent the shell to wait for termination of its background processes.
You can also replace the call to curl
in your AppleScript with a call to curl_nowait.sh
(with same parameters).
I hope that gives you some ideas how to improve your situation.