Notifications
Clear all

[Closed] DOSCommand

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

3 Replies

have you tried ShellLaunch?

ShellLaunch “ConvertTexture” “”

1 Reply
(@davidm)
Joined: 10 months ago

Posts: 0

Thx, it did it

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