export2bin script for easy use

broken avatar :(
Created 1707 days ago
by WantedThing
0 Members and 1 Guest are viewing this topic.
broken avatar :(
broken avatar :(
Location: fr
Date Registered: 1 October 2016
Last active: 1306 days ago
Forum Rank
Fresh Corpse
Primary Group
WantedThing's Groups
WantedThing's Contact & Social Links
I share with you a little script i have made, it let you convert your xmodel and xanim by just double clicking on them. After that, it's also easy to edit CodMayaTools.py so it will automatically run (then convert) your files after export.

How to install :

1. Make a new file called export2bin.cmd and put it in the same folder as export2bin.exe
2. Copy and paste the content of the script i provide you in the end of this post and save the file.
3. Configure your xmodel and xanim files to automatically open with export2bin.cmd

Now you can convert your files easely by just opening them.

If you want to edit your CodMayaTools.py so it will automatically open your files after export, do the following :

1. Open CodMayaTools.py with a good text editor like notepad++ or sublimeText
2. Search for the following (using ctrl+F) :
and add "os.startfile(filePath)" after it, so it looks like this :

#Start file for export2bin
3. Repeat one more time the step 2, so it will work both for xmodels and xanims

Now your files will be converted to bin automatically

If you want my script to automatically delete xmodels and xanims files after conversion, look for the following line in export2bin.cmd :
rem del %fileNameFull%
and replace it with :
del %fileNameFull%

Hope you like it :)

Code for export2bin.cmd :
@echo off
rem Put this script in the same folder as export2bin
rem Configure xmodel_export and xanim_export files to open with this script
rem for CodMayaTools.py add os.startfile(filePath) on lines 921 and 1308
rem -----------------------------------------------------------------------

set export2bin=%~dp0export2bin.exe

FOR %%i IN ("%~f1") DO (
set fileExtension=%%~xi
set fileNameFull=%%~nxi
set fileDrive=%%~di
set filePath=%%~pi )

set msgBox="%WinDir%\system32\msg.exe"
set msgLine=--------------------

if not "%fileExtension%" == ".xmodel_export" (
if not "%fileExtension%" == ".xanim_export" goto :BadfileName )

cd /d "%fileDrive%%filePath%"

for /f %%i in ('"%export2bin%" %fileNameFull%') do set RESULT=%%i
if %ERRORLEVEL% NEQ 0 goto :CommandError
if "%RESULT%" == "ERROR:" goto :Error

rem del %fileNameFull%
(((echo %msgLine%[export2bin script]%msgLine%) & echo.) & echo Conversion done !)|%msgBox% * /TIME:2

FOR /F "tokens=* USEBACKQ" %%F IN (`"%export2bin%" %fileNameFull%`) DO SET errorMessage=%%F
(((echo %msgLine%[export2bin.exe]%msgLine%) & echo.) & echo %errorMessage%)|%msgBox% *

((((echo %msgLine%[export2bin script]%msgLine%) & echo.) & echo Please provide a valid .xmodel_export or .xanim_export file.) & echo Your file extension : %fileExtension%)|%msgBox% *

((((echo %msgLine%[export2bin script]%msgLine%) & echo.) & echo Unable to execute export2bin.exe.) & echo export2bin path : %export2bin%)|%msgBox% *

Double Post Merge: October 10, 2016, 06:38:44 pm
Oups, I should have posted it under the BO3 section, sorry for that.
Last Edit: October 10, 2016, 06:38:44 pm by WantedThing



or login with an authentication provider below
Sign In with Google
Sign In with Twitter
Sign In with Discord
Sign In with Steam
Sign In with Facebook
Sign In with Twitch
Loading ...