【问题标题】:applescript to render nuke script in terminalapplescript 在终端中渲染 nuke 脚本
【发布时间】:2015-10-13 18:59:25
【问题描述】:

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

脚本需要获取被删除项目的文件路径,将其与“nuke -xi”一起粘贴到终端窗口,然后按回车键。到目前为止我有..

on open dropped_item
   get the POSIX path of dropped_item

还有……

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

任何想法将不胜感激。

【问题讨论】:

    标签: applescript nuke


    【解决方案1】:

    这应该不难。只需设计一个好的液滴格式来处理文件。您想将所选文件的别名转换为该文件的 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
    

    【讨论】:

    【解决方案2】:

    我不知道 Nuke 在做什么,但我认为它会创建一个文件作为输出,所以我建议不要使用终端,而是使用 '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
    

    【讨论】:

    • 这很好,但我需要从终端获得反馈,以便查看渲染时间等。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-12-11
    • 1970-01-01
    • 2011-11-04
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多