0

I am trying to configure Atom so that every time I press a certain keyboard shortcut (doesn't matter what specifically) it will pass a path of the file I have currently opened in Atom as an argument and run a batch file with that argument. Basically, it should copy the file I have opened from the working directory (the directory that Atom is opened in) to a directory specified in the batch script. Something like this exists in Sublime Text and there the batch script looks like this:

@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%";

while the sublime_build itself looks like this:

{
  "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"]
  }
}

It seems easy, but I have no idea how to pass a current file name and file path to a batch script and run it from Atom.

1
  • Does sh work on your version of windows? Is the directory separator correct (should it be / or \ )?
    – cup
    Jul 18, 2017 at 12:32

1 Answer 1

0

The first priority is to fix your batch file.

@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%";

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.