How to view stdout of script run within automator How to view stdout of script run within automator shell shell

How to view stdout of script run within automator


In Automator arguments and variables can be passed using a special variable:

   $@

To get output from a script or task running in Automator you can click on the results (recessed button) below the script to see any output. Additionally you could setup another bash script to pass the output to stdout or wherever else you choose.

This example shows a python script sending output and variables to a bash script. You can pass input as arguments, or to stdin:

automator


I am not at my Mac, so this is untested but I am pretty sure it can be made to work with minor edits...

Change your script so it looks like this and your python script runs in the background saving its output to a temporary file $$.tmp where $$ is your process id (pid):

export PATH=${PATH}:/usr/local/bin:/usr/local/CrossPack-AVR/bincd /Applications/MyApp/Applications/MyApp/doIt.py "$1" > $$.tmp &

Now add the following lines at the end, so that you 1) create a script that tails your log file, 2) make it executable and 3) you execute it:

echo "tail -f $$.tmp" > x.commandchmod +x x.commandopen x.command

I would recommend renaming x.command as $$.command so that you can run it multiple times from multiple users without interactions between the various users. You should also clean up and delete the temporary files after use.