2012-04-09 52 views
1

我需要通过一次性传递一系列参数来自动化我的应用程序。在Windows中,我将它们全部作为命令行从快捷方式传递,但我需要为OSX执行相同的操作。Automator,AppleScript或其他?

我一直在看AppleScript,但似乎我需要分别发送每个参数,如tell myapp to use <x>,然后tell myapp to use <y>。 Automator看起来像它可以做我想做的事情,但看起来太复杂了。

我的最终目标是通过将文件放到桌面上的图标上来发送一系列文本参数,然后发送一系列文件路径。

什么是最好的方法来实现这一目标?

+0

你能举个例子有参数和路径? – adayzdone 2012-04-09 14:12:15

回答

1

如果我理解正确,那么应用程序会接受命令行参数。然后,你需要的是一个AppleScript接收文件并将其路径为(空格分隔)的参数给shell命令液滴

on open these_items 
    set file_args to "" 
    repeat with one_item in these_items 
     set file_args to file_args & " " & quoted form of POSIX path of one_item 
    end repeat 
    set command to "open" -- replace this with your shell command + arguments 
    do shell script (command & file_args) 
end open 

(基于this forum post

相关问题