如何在单独的自动化变量中获得这些结果? [英] How do I get these results in separate automator variables?
问题描述
我制作了一个小的自动化脚本,该脚本运行bash shell脚本并获得两个输出...在查看结果时,如下所示...
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"
并在查看结果时显示了这一点(我希望将它们作为称为 count 和 duration ).我希望将其发送到显示通知,其中字幕显示为" 计数 个文件已处理",消息显示为" 持续时间 >已过去".我该如何实现?
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?
推荐答案
您可以通过applescript修改Automator变量.变量必须存在于工作流中,因此您首先应添加两个变量,以在下一张图像上获得类似的内容:
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:
您可以将Anyting设置为其初始值...
You can set anyting as their initial value...
上面的操作之后,您可以在shell脚本之后使用下一个applescript
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.
所以下一个:
您的自动化变量 Count
将包含200,而变量 Duration
将包含文本.
Your automator variable Count
will contain 200, and the variable Duration
will contain the text.
这篇关于如何在单独的自动化变量中获得这些结果?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!