applescript 在终端中渲染核弹脚本 [英] applescript to render nuke script in terminal

查看:26
本文介绍了applescript 在终端中渲染核弹脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I want to be able to drop a Nuke script on to an Applescript application and then for the Nuke script to start rendering in a terminal.

脚本需要获取所放置项目的文件路径,将其与nuke -xi"一起粘贴到终端窗口中,然后按回车键.到目前为止,我已经..

The script needs to get the file path of the dropped item, paste that in to a terminal window along with 'nuke -xi ' and then hit return. So far I have..

on open dropped_item
   get the POSIX path of dropped_item

还有……

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

任何想法将不胜感激.

推荐答案

这应该不难.只需设计一个好的液滴格式来处理文件.您想将所选文件的别名转换为该文件的 posix 路径.

This shouldn't be hard. Just design a good droplet format to handle the file. You want to convert the alias of a file selected to a the posix path to that file.

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

这篇关于applescript 在终端中渲染核弹脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆