2012-04-09 144 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

相關問題