PDA

View Full Version : DOSCommand


DavidM
02-25-2009, 09:08 PM
Hello everyone,

First of all I would like to precise that I am currently learning maxscript. I currently writing a simple script to export my selection, convert it to another format (.hpx wich is ascii based) and modify said .hpx to substitute .tif to .rgb.

CurrentFile = GetFileNameFile MaxFilename
ExportName = "X:\\SIMTHETIQ\\metavr\\P4\\Data\\Main\\Source\\Databases\\Afghanistan\\Openflight\\" + CurrentFile + ".flt"
exportFile Exportname #noPrompt selectedOnly:true
ConvertFormat = "oflt2hpx " + ExportName
DOSCommand ConvertFormat;
HPXName = "X:\\SIMTHETIQ\\metavr\\P4\\Data\\Main\\Source\\Databases\\Afghanistan\\Openflight\\" + CurrentFile + ".hpx"
ConvertTexture = "sed2.exe -e \"s/\.tif/\.rgb/g\" " + HPXName + " > " + HPXName + "temp.txt"
DOSCommand ConvertTexture
DOSCommand "copy " + HPXName + "temp.txt " + HPXName;
DOSCommand "del " + HPXName + "temp.txt";

The export part is working, conversion to hpx is working too. My problem resides with the Convert texture line. It opens a command prompt and shuts it down right after without doing anything. If I Print ConvertTexture and copy/paste it to a command prompt it runs just fine. I also tried calling a .cmd containing the last 3 lines without any success.

If you see any synthax error or think of another way to substitute text in a ascii file please let me know.

Thanks in advance,
David

dutch_delight
03-03-2009, 01:06 PM
have you tried ShellLaunch?


ShellLaunch "ConvertTexture" ""

Dmaxer
03-03-2009, 01:46 PM
I wrote a script that uses a small dos program . as said above I used shellLaunch , below is how I set up the arrguments to send to the exe . I hope this was some help :)



args = videomode + " " + Binnumb + " " + Vsync + " " + Dlay + " " -- 4 arrguments to send to FFTMAX.exe
prog = (scriptpath+" \\FFTMAX\\.FFTMAX.exe (file:///FFTMAX/.FFTMAX.exe)" )
shellLaunch prog args

DavidM
03-03-2009, 06:49 PM
have you tried ShellLaunch?


ShellLaunch "ConvertTexture" ""

Thx, it did it

CGTalk Moderation
03-03-2009, 06:49 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.