applescript 在终端中渲染 nuke 脚本
applescript to render nuke script in terminal
我希望能够将 Nuke 脚本拖放到 Applescript 应用程序上,然后让 Nuke 脚本开始在终端中呈现。
脚本需要获取掉落物品的文件路径,将其与 'nuke -xi ' 一起粘贴到终端 window,然后点击 return。到目前为止我有..
on open dropped_item
get the POSIX path of dropped_item
和...
tell application "Terminal"
if not (exists window 1) then reopen
activate
end tell
如有任何想法,我们将不胜感激。
我不知道 Nuke 在做什么,但我假设它会创建一个文件作为输出,所以我建议不要使用终端,而是使用 'do shell script' 命令。
您的终端命令如下所示:nuke -xi /Users/file_path
下面的脚本在不打开终端的情况下执行 Window
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
这应该不难。只需设计一个好的 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
我希望能够将 Nuke 脚本拖放到 Applescript 应用程序上,然后让 Nuke 脚本开始在终端中呈现。
脚本需要获取掉落物品的文件路径,将其与 'nuke -xi ' 一起粘贴到终端 window,然后点击 return。到目前为止我有..
on open dropped_item
get the POSIX path of dropped_item
和...
tell application "Terminal"
if not (exists window 1) then reopen
activate
end tell
如有任何想法,我们将不胜感激。
我不知道 Nuke 在做什么,但我假设它会创建一个文件作为输出,所以我建议不要使用终端,而是使用 'do shell script' 命令。
您的终端命令如下所示:nuke -xi /Users/file_path
下面的脚本在不打开终端的情况下执行 Window
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
这应该不难。只需设计一个好的 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