Automator 变量是否持久?
Automator 变量在工作流程执行之间是否持续存在? 如果在工作流程执行期间设置了变量,那么再次执行工作流程后,我可以获取分配给变量的最后一个值吗?
Do Automator variable persist between executions of a workflow?
If a variable is set during the execution of a workflow, can I get the last value assigned to a variable, once the workflow is executed again?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
自动机变量不是持久的。
我从输出变量内容的工作流创建了一个测试服务,然后将变量内容设置为在主机应用程序中选择的文本;服务的调用总是返回有关变量的错误,这意味着变量内容不是持久的(不同的是,该错误只会在第一次报告)。
Automator variables are not persistent.
I created a test service from a workflow that outputs the content of a variable, and then sets the variable content to the text selected in the host application; the invocation of the service always returned an error about the variable, which means the variable content was not persistent (differently, the error would have been reported only the first time).
我不使用自动化所以我不确定。但是,我知道如果您使用 applescript,那么您可以通过将它们定义为属性来拥有持久变量。因此,您不应使用 (set myVar to "something"),而是使用 (property myVar : "something")。也许你可以在你的自动化代码中做类似的事情。除了 applescript 代码之外,您可能必须手动将值写入文件并读回以恢复它们。
I don't use automator so I'm not sure. However, I know that if you're using applescript then you can have persistent variables by defining them as a property. So instead of using (set myVar to "something") you'd use (property myVar : "something"). Maybe you can do something like that in your automator code. Other than applescript code, you'd probably have to manually write your values to a file and read them back to restore them.