我正在尝试配置Atom,以便每当我按某个键盘快捷键(具体是什么)时,它将传递我当前在Atom中打开的文件的路径作为参数并运行批处理文件那个论点。基本上,它应该将我从工作目录(打开Atom的目录)打开的文件复制到批处理脚本中指定的目录。 Sublime Text中存在类似的东西,批处理脚本如下所示:
@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 :(得分: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%";