How do you get these results in separate automation variables?

I made a small automaton script that runs a bash shell script and gets two exits ... When viewing the results, it looks like this ...

Multiple Results

I want them in two automaton variables Suppose I used a script like

echo "200"
echo "19 hours, 4 minutes and 42.765 seconds"

      

and when viewing the results, it shows this (and I want each one to be an automatic variable called count and duration ). I want it to be sent to a notification with subtitles as " count files processed" and the message passed " duration ". How can I achieve this?

+3


source to share


1 answer


You can modify Automator variables with applescript. The variables must exist in the workflow , so you first need to add two variables to get something like the following image:

enter image description here

You can set anyting as your initial value ...

After the above, you can use the following applescript right after your shell script

on run {input, parameters}
    set value of variable "Count" of front workflow to item 1 of input
    set value of variable "Duration" of front workflow to item 2 of input
    return input
end run

      



It's not entirely correct (like not checking the number of arguments in the input), but you get the idea.

So after the following:

enter image description here

Your automator variable Count

will hold 200 and your variable Duration

will hold text.

+3


source







All Articles