Macos Mac自动机:在shell&;中使用变量;咆哮通知

Macos Mac自动机:在shell&;中使用变量;咆哮通知,macos,terminal,applescript,automator,growl,Macos,Terminal,Applescript,Automator,Growl,我正在使用应用程序自动机文件接收一个设置为变量file的文件,然后使用Ask-For-Text设置一个名为name的变量 我需要在两个地方使用它: shell脚本 咆哮着通知 我尝试了许多组合,但我无法让变量在其中工作。正确的语法是什么?尝试将其添加到automator工作流中: on run {input, parameters} -- Get name from automator tell application "Finder" to set theName to nam

我正在使用应用程序自动机文件接收一个设置为变量
file
的文件,然后使用Ask-For-Text设置一个名为
name
的变量

我需要在两个地方使用它:

  • shell脚本
  • 咆哮着通知

  • 我尝试了许多组合,但我无法让变量在其中工作。正确的语法是什么?

    尝试将其添加到automator工作流中:

    on run {input, parameters}
        -- Get name from automator
        tell application "Finder" to set theName to name of file input
    
        -- pass name into shell script and get variable back
        set xxx to do shell script "echo " & theName
    
        display dialog xxx
    end run
    

    尝试将此添加到automator工作流中:

    on run {input, parameters}
        -- Get name from automator
        tell application "Finder" to set theName to name of file input
    
        -- pass name into shell script and get variable back
        set xxx to do shell script "echo " & theName
    
        display dialog xxx
    end run
    

    您不需要键入任何脚本。如果转到Growl应用程序,右键单击,显示目录,目录-->库-->自动机

    双击该文件,咆哮动作将添加到Automator。
    享受;)

    您不需要键入任何脚本。如果转到Growl应用程序,右键单击,显示目录,目录-->库-->自动机

    双击该文件,咆哮动作将添加到Automator。
    享受;)

    谢谢,但是你不能那样使用变量谢谢,但是你不能那样使用变量