applescript在终端中渲染nuke脚本

时间:2015-10-12 14:45:35

标签: applescript nuke

我希望能够将Nuke脚本放到Applescript应用程序上,然后让Nuke脚本开始在终端中渲染。

脚本需要获取已删除项目的文件路径,然后将其粘贴到终端窗口以及“nuke -xi”#39;然后点击返回。到目前为止,我有..

on open dropped_item
   get the POSIX path of dropped_item

和......

tell application "Terminal"
    if not (exists window 1) then reopen
    activate
end tell

非常感谢任何想法。

2 个答案:

答案 0 :(得分:1)

这不应该是困难的。只需设计一个好的Droplet格式来处理文件。您希望将所选文件的别名转换为该文件的posix路径。

on run
    set this_item to choose file with prompt "Select nuke script to run."
    process_item(this_item)
end run

-- This droplet processes files dropped onto the applet 
on open these_items
    repeat with i from 1 to the count of these_items
        set this_item to item i of these_items
        process_item(this_item)
    end repeat
end open

-- this sub-routine processes files 
on process_item(this_item)
    set p to POSIX path of this_item
    tell application "Terminal"
        activate
        do script "nuke -xi " & quoted form of p
    end tell
end process_item

答案 1 :(得分:0)

我不知道Nuke正在做什么,但我认为它会创建一个文件作为输出,所以我建议不要使用Terminal,而是“do shell script”命令。

您的终端命令如下所示:nuke -xi / Users / file_path

下面的脚本执行该操作而不打开终端窗口

on open MyNukeScript -- trigger the script when file is droped on it
set MypathScript to quoted form of (POSIX path of MyNukeScript)
try
    do shell script "nuke -xi " & MypathScript
end try
end open