问题
I have made a small automator script that runs a bash shell script and gets two outputs... On viewing results it appears like this below...
I want them in two automator variables Assume I used a script like
echo "200"
echo "19 hours, 4 minutes and 42.765 seconds"
and on viewing the results it shows this (and I want each of these as automator variables called count and duration). I want it to be sent to a display notification with subtitle as "count files processed" and message as "duration elapsed". How can I achieve this?
回答1:
You can modify Automator variables by applescript. The variables must exists in the workflow, so you first should add two variables, to get something like on the next image:
You can set anyting as their initial value...
After the above, you can use the next 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 is not fully correct, (for example it isn't check the number of arguments on the input), but you get an idea.
So after the next:
Your automator variable Count
will contain 200, and the variable Duration
will contain the text.
来源:https://stackoverflow.com/questions/25576397/how-do-i-get-these-results-in-separate-automator-variables