====== ArmA 3 Batch File Examples ====== [[https://www.pmctactical.org/forum/viewforum.php?f=68|ArmA 3 Forum]], [[:arma3|ArmA 3]], [[arma3:config|ArmA 3 Config]], [[arma3:missions|ArmA 3 Missions]], [[arma3:modeling|ArmA 3 3D Modeling]], [[arma3:scripting|ArmA 3 Scripting]], [[arma3:terrain|ArmA 3 Terrain]], [[arma3:texturing|ArmA 3 Texturing]], [[arma3:tools|ArmA 3 Tools]] This is under ArmA 3 namespace but there are various batch file examples which suit all arma games or even generic tasks that has nothing to do with arma. ====== PMC MoveObject Setup ====== Here we show you how to change paths into model P3D, material RVMAT and terrain WRP files using [[arma3:tools:mikero-tools|Mikero Tools]] MoveObject. Main concept is these files. * _MASTER_paths.txt * _run_update_FILETYPE_list.bat * _run_moveobject.bat * _run_moveobject_log.bat _MASTER_paths.txt contains the moveobject replacement "source destination" list (refer to moveobject documentation for proper format etc). _run_update_FILETYPE_list.bat is to update file type list, this basically depends on which directory you are, if you're doing models then you use P3D bat, if you do rvmat's in Data\ directory, then you use rvmat bat and you guessed it, if you do terrains then you use WRP bat. _run_moveobject_log.bat file creates text file log out of the p3d/rvmat/wrp file content regarding textures, proxys etc. This log file is useful to track down what your file contains. Also note that often times it grows very large, so use [[:editing_tools#text_editing|proper text editor]] to open it and be very careful if you perform some search & replace etc operations to log file sized in 50+ megabytes. _run_moveobject.bat is the actual moveobject executing bat which runs the program using master paths text as config and after its done it runs log file creation. **How it works?** - run the _run_update__list.bat file to list all the filetype files in your directory. - create proper _MASTER_paths.txt of the replacements you want to make - run _run_moveobject.bat to execute - inspect _log.txt file for results ===== P3D Files ===== **_run_moveobject.bat** @echo off for /F %%i in (_p3d_list.txt) do ( moveobject %%i _MASTER_paths.txt >>_log.txt ) if exist *.old.p3d del *.old.p3d call _run_moveobject_log.bat pause exit **_run_moveobject_log.bat** @echo off del _log.txt for /F %%i in (_p3d_list.txt) do (moveobject -L "%%i" >>_log.txt) **_run_update_p3d_list.bat** dir *.p3d /o /b >_p3d_list.txt ===== RVMAT Files ===== 2019-01-22 Updated for ArmA 3 and Mikeros latest tools with the -P "no pause" option. **_run_moveobject.bat** @echo off for /F %%i in (_rvmat_list.txt) do ( moveobject -P %%i _MASTER_paths.txt >>_log.txt ) if exist *.old.rvmat del *.old.rvmat pause exit **_run_moveobject_log.bat** if exist _log.txt del _log.txt for /F %%i in (_rvmat_list.txt) do (moveobject -P -L "%%i" >>_log.txt) **_run_update_rvmat_list.bat** dir *.rvmat /o /b >_rvmat_list.txt ===== WRP Files ===== 2019-01-22 Updated for ArmA 3 and Mikeros latest tools with the -P "no pause" option. **_run_moveobject.bat** @echo off for /F %%i in (_wrp_list.txt) do ( moveobject -P %%i _MASTER_paths.txt >>_log.txt ) if exist *.old.wrp del *.old.wrp call _run_moveobject_log.bat pause exit **_run_moveobject_log.bat** if exist _log.txt del _log.txt for /F %%i in (_wrp_list.txt) do (moveobject -P -L "%%i" >>_log.txt) **_run_update_wrp_list.bat** dir *.wrp /o /b >_wrp_list.txt ====== ArmA 2 Binarize CMD Line ====== How to use bis binpbo to binarize using command line. This assumes you have text file list of all your addons to be binarized, here its named "pmc_ags_build_temp.txt". **_run_binarize_ags_build_temp.bat** @echo off set BINPBOPATH="C:\armatools\BinPBO\BinPBO.exe" set TEMPPATH="C:\temp" set DESTINATION="c:\arma2Projects\ags_build\addons" for /F %%i in (pmc_ags_build_temp.txt) do ( %BINPBOPATH% "P:\pmc\%%i" %DESTINATION% -BINARIZE -DEBUG -TEMP %TEMPPATH% -INCLUDE "c:\armatools\Binarize_Includes.txt" -PROJECT "P:\pmc" -PREFIX pmc\%%i ) pause exit ====== List Directories ====== Generates _list.txt file from directory names in current directory. No extra text / junk shown, just plain directory names. dir /b /ad >_list.txt ====== PNG to PAA early version ====== This is generic PNG to PAA conversion, if you are converting terrain layers\*.png then you should use [[arma2:terrain:howto-convert-layers-png-fast|arma2 terrain howto convert layers png fast]] or [[arma3:terrain:convert-layers-png-fast|arma3 terrain convert layers png fast]] **Pal2Pace to run all PNG files in Visitor 3 terrains:** FOR %%i IN (*.png) DO (D:\armatools\texview2\pal2pace %%i) ====== MoveObject Example 1 ====== **MoveObject from PboDll package:** set MOVEOBJECT="T:\pbodll\MoveObject.exe" FOR /F %%i IN (FileList.txt) DO ( FOR /F "tokens=1-5" %%a IN (ReplacePathAwithB.txt) DO ( %MOVEOBJECT% %%i %%a %%b ) ) ====== ExtractPbo Addons Dir ====== **ExtractPbo whole arma2 expansion to p:\** extractpbo c:\arma2\expansion\addons\ p:\ **ExtractPbo whole arma2 expansion configs only to p:\** extractpbo -F config.bin c:\arma2\expansion\addons\ p:\ **Old style with for loop:** for %%x in (c:\arma2\expansion\addons\*.pbo) do ( extractpbo %%x p:\ ) ====== DeRapify RVMAT ====== **DeRapify rvmat so that you don't have to rename all the .rvmat.txt files?** @echo off md tmp for %%x in (*.bisurf) do (derapify %%x tmp\%%x) move tmp\*.bisurf . for %%x in (*.rvmat) do (derapify %%x tmp\%%x) move tmp\*.rvmat . rd tmp pause exit ====== RegExp : RVMATs ====== Not actually a dos batch file, but hey :) **RegExp how to fix something.rvmat:ca\path\to\texture.paa with just ca\...** .*: ====== PAA to TGA / PNG ====== **Pal2Pace all PAA to TGA / PNG** @echo off MD temp FOR /F "tokens=1* delims=. " %%A in ('dir /b *.paa') do ( D:\armatools\texview2\Pal2PacE %%A.paa temp\%%A.tga if ERRORLEVEL 1 goto err ) rem move stuff to current dir and clean out temp dir. move temp\*.tga . rd temp pause Similar one found from Mikero's tools called "paxToTga" dir /b/s/a-h "%1%\*.paa" >listdir.txt dir /b/s/a-h "%1%\*.pac" >>listdir.txt FOR /F "tokens=1* usebackq delims=" %%A in (listdir.txt) do ( echo %%A pal2pace.exe "%%A" "%%A.tga" ====== PAA to TGA if tga doesnt exist ====== This batch file converts all PAA textures into TGA format using pal2pace.exe if TGA file doesn't already exist in the directory. Remember to change the pal2pace path to one you are using. @echo off dir /b *.paa >>_paa_list.txt MD temp FOR /F "tokens=1* delims=. " %%A in (_paa_list.txt) do ( if not exist %%A.tga "C:\program files (x86)\steamapps\common\Arma 3 Tools\TexView2\Pal2PacE" %%A.paa temp\%%A.tga if ERRORLEVEL 1 goto MyError ) rem del *.paa del _paa_list.txt move temp\*.tga . rd temp pause exit :MyError echo unknown error pause exit ====== Crete config.cpp from List ====== **Create config.cpp or model.cfg from list of P3D names** for /F %%i in (list.txt) do ( echo class Land_%%i: Land_ammostore2 >>new_config.cpp echo { >>new_config.cpp echo displayName = "(building) %%i"; >>new_config.cpp echo model = "\pmc\vte_bis_obj\%%i.p3d"; >>new_config.cpp echo }; >>new_config.cpp ) pause Same with RegExp for editpadpro: (.*) ===> class LAND_\1: House { displayName = "\1"; Armor = 10000; destrType="DestructNo"; model = "\x\ofpip\OFPIP\addons\p_bi_cwc_objects\\\1.p3d"; scope = 1; vehicleClass = "OFPIP_Objects"; }; ====== Get Todays Date ====== Get todays date for example to be used when creating backup archive files with time stamp. **Date** for /f "tokens=2-4 delims=/ " %%a in ('date /T') do set year=%%c for /f "tokens=2-4 delims=/ " %%a in ('date /T') do set month=%%a for /f "tokens=2-4 delims=/ " %%a in ('date /T') do set day=%%b echo %year%-%month%-%day% ====== Resize PAA Command Line ====== Resize PAA file from command line. This does all PAA files to 128 x 128 resolution in the current directory: for /R %CD% %%i in (*.paa) do ( echo %%i "\steamapps\common\Arma 3 Tools\ImageToPAA\imagetopaa.exe" -size=128 %%i %%i ) pause exit