简体   繁体   English

使用AppleScript的输出作为Automator中Shell脚本的输入

[英]using an output from AppleScript as input to a Shell Script in Automator

I'm using Apple Automator, and in my workflow, I have a "Run AppleScript". 我正在使用Apple Automator,在我的工作流程中,我有一个“运行AppleScript”。 I would like to present the user with a list of items: 我想向用户显示项目列表:

on run
    choose from list {"DRNyheder", "DR1", "DRVejret", "ditbt", "ekstrabladet"} with prompt "Please make your selection" without multiple selections allowed and empty selection allowed
    set aName to item 1 of the result
    display dialog aName
    return aName
end run

The next item in the pipeline is a "Run Shell Script". 管道中的下一项是“运行Shell脚本”。 In this case it's a python script. 在这种情况下,这是一个python脚本。 The idea is that I want to supply the output of the AppleScript as argv 1. I have verified that the AppleScript is returning a string, just like I expect. 这个想法是,我想将AppleScript的输出作为argv 1提供。我已经验证了AppleScript正在返回一个字符串,就像我期望的那样。

/Users/fred/my_script.py $@

The problem is, I don't see that the argument is being passed to my Python script. 问题是,我看不到参数正在传递给我的Python脚本。 Can anybody help? 有人可以帮忙吗?

If it helps, here is a screen shot of this part of the workflow: 如果有帮助,请参见以下工作流程的屏幕截图:

在此处输入图片说明

Ok, this was embarrassingly easily. 好吧,这很容易令人尴尬。 As it turns out, there's a setting in the upper-right hand corner of the Shell Scripts window, where you can pass inputs "as arguments". 事实证明,“ Shell脚本”窗口的右上角有一个设置,您可以在其中将输入“作为参数”传递。 That's the ticket. 那是票。

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM