Skip to content

Instantly share code, notes, and snippets.

@anastasiia-kornilova
Last active February 9, 2021 11:01
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anastasiia-kornilova/2b955e62c3cef7a509fc043a189ea3ff to your computer and use it in GitHub Desktop.
Save anastasiia-kornilova/2b955e62c3cef7a509fc043a189ea3ff to your computer and use it in GitHub Desktop.
Script example for running TRIK Studio 2d-model from external IDEs (PyCharm/VSCode), please, adapt it for your development process if necessary
@echo off
REM Usage: win_scr.cmd <full path to dir with fields> <relative path to js file>
for /f "tokens=2 delims=:." %%x in ('chcp') do set cp=%%x
chcp 1251>nul
SET TRIK_DIR=%~dp0
SET FIELDS_PATH=%1
echo %FIELDS_PATH%
SET DEFAULT_PROJECT=%FIELDS_PATH%\default.qrs
IF EXIST %DEFAULT_PROJECT% (
SET PROJECT_TYPE=xml
) ELSE (
SET PROJECT_TYPE=qrs
)
SET mydir=%cd%
pushd "%FIELDS_PATH%"
for %%f in (*.%PROJECT_TYPE%) do (
IF "%PROJECT_TYPE%"=="xml" (
"%TRIK_DIR%patcher.exe" -f %%f "%DEFAULT_PROJECT%"
"%TRIK_DIR%patcher.exe" -s "%mydir%\%2" "%DEFAULT_PROJECT%"
"%TRIK_DIR%2D-model.exe" --mode script -c --input "%mydir%\input.txt" "%DEFAULT_PROJECT%"
)
IF "%PROJECT_TYPE%"=="qrs" (
echo "%%f"
"%TRIK_DIR%patcher.exe" -s "%mydir%\%2" %%f
"%TRIK_DIR%2D-model.exe" --mode script -c --input "%mydir%\input.txt" %%f
)
)
chcp %cp%>nul
popd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment