2017-07-18 41 views
0

我正在嘗試配置Atom,以便每次按某個鍵盤快捷鍵時(無關緊要),它會將當前在Atom中打開的文件的路徑作爲參數傳遞,並運行批處理文件論據。基本上,它應該將我從工作目錄(打開Atom的目錄)打開的文件複製到批處理腳本中指定的目錄。像這樣的東西存在於崇高的文本,有批處理腳本是這樣的:如何在Atom中使用快捷方式運行批處理腳本?

@echo off 
:: Renaming arguments 
set file_name=%1% 
set file_path=%2% 

:: Change this accordingly to your After Effects version 
set version=CC 2017 

:: Adobe After Effects folder location 
set base_path=C:\Program Files\Adobe 
set ae_folder_path=%base_path%\Adobe After Effects %version% 
set ae_scripts_folder_path=%ae_folder_path%\Support Files\Scripts 


cd "%file_path%" 

:: Copying script to Scripts folder 
copy "%file_name%" "%ae_scripts_folder_path%\%file_name%" 

cd "%ae_folder_path%\Support Files" 

:: Printing happy feedback in the console 
echo "Successfully compiled %file_name% to 
%ae_scripts_folder_path%\%file_name%"; 

而sublime_build本身看起來是這樣的:

{ 
    "cmd": [ 
    "sh '${packages}/AfterEffects/build.sh' '$file_name' && osascript 
    '${packages}/AfterEffects/run.scpt' '$file_name'" 
    ], 
    "shell": true, 
    "windows": 
    { 
    "cmd": ["${packages}/AfterEffects/build.bat", "$file_name", "$file_path"] 
    } 
} 

似乎很容易,但我不知道怎麼傳批處理腳本的當前文件名和文件路徑,並從Atom運行。

+0

在您的Windows版本上運行sh嗎?目錄分隔符是否正確(應該是/還是\)? – cup

回答

0

第一優先級是修復您的批處理文件。

@Echo Off 
Rem Renaming arguments 
Set "file_name=%1" 
Set "file_path=%2" 

Rem Change this accordingly to your After Effects version 
Set "version=CC 2017" 

Rem Adobe After Effects folder location 
Set "base_path=C:\Program Files\Adobe" 
Set "ae_folder_path=%base_path%\Adobe After Effects %version%" 
Set "ae_scripts_folder_path=%ae_folder_path%\Support Files\Scripts" 

CD /D "%file_path%" 

Rem Copying script to Scripts folder 
Copy "%file_name%" "%ae_scripts_folder_path%\%file_name%" 

CD /D "%ae_folder_path%\Support Files" 

Rem Printing happy feedback in the console 
Echo "Successfully compiled %file_name% to %ae_scripts_folder_path%\%file_name%"; 
相關問題