Shell script execution blocks Apple Script code flow ?

Hello everybody,
I’m working on a little AS Studio project which plays and records TV streams using the technology of VLC Player with a shell script. My problem is that after the streaming/registration process has started there is other AppleScript code to be executed but the “code-flow” is blocked until the end of the streaming process. Just to give you an example:

do shell script "/Applications/VLCfolder/ -vvv udp://@ --sout '#duplicate{dst=display,dst=standard{access=file,mux=ts,url=/Users/Farid/Desktop/movie1.ts}}'"
display dialog "On Air"

If the recording of the tv stream lasts 2 hours the dialog “On Air” will appear only after 2 hours, which is bad.
Any ideas how to get the focus back on the AS Application while VLC (the shell script) is running?


This is standard AppleScript/do shell script stuff.

You need to put the shell script into the background so that it runs on its own and AppleScript doesn’t wait for the script to finish before continuing.

To do this append the cryptic string:

> /dev/null 2>&1 &

to the end of the ‘so shell script’ command. The ‘> /dev/null’ suppresses stdout of the command, ‘2>&1’ sends stderr to the same place as stdout (that is, /dev/null) and the ‘&’ detatches the shell process so it runs in the background.

do shell script "/Applications/VLCfolder/ -vvv udp://@ --sout '#duplicate{dst=display,dst=standard{access=file,mux=ts,url=/Users/Farid/Desktop/movie1.ts}}' >  /dev/null 2>&1 &" 
display dialog "On Air"

Camelot, thank you so much :!: That was it, everything perfect now :smiley:
Just for the record: is there any documentation about this “dev/null” thing and similar “Black Magic”? In the man pages maybe?

Thanks again & Ciao