Batch file conversion

 From:  Michael Gibson
2100.20 In reply to 2100.19 
Hi Micha - the problem is that you can't try to start the batchconvert.js file all by itself directly.

For example if you go to Start / Run in Windows and type in "batchconvert.js" there, or if you were to double-click on "batchconvert.js" in the Windows explorer, that is not going to work because your system will have the "wscript.exe" program (windows script host) set up to execute when any file with a ".js" extension is launched. So that will launch wscript.exe and not MoI.

This is similar to how double-clicking on a file that ends with ".doc" will open Microsoft word, etc...

Instead of running the windows script host, you want to run the MoI.exe program and tell MoI.exe to load the .js file by passing the file name as a parameter to MoI.exe.

You can't make this happen by trying to run the .js file directly (unless you change the file associations for .js files for your computer) - the primary thing you need to launch is "MoI.exe" and then you tell it to load batchconvert.js by giving a command-line parameter to MoI.exe .

To do this with the Rhino "Run" command, I think you will need to set up a separate batch file that runs MoI.exe, because I don't know if there is a way for Rhino's run command to group the MoI.exe path and the .js file path properly with " " characters around each of them.

I've attached a batch file here which I think will work for you - unzip the attached .zip file to get the file named LaunchMoIBatchConvert.cmd - that is a batch file which is set up to launch MoI.exe and pass it the batchconvert.js as a command line parameter, with the 2 parts grouped with quotes as required for things with spaces in them.

So to make it all work you can have Rhino's run command run that LaunchMoIBatchConvert.cmd and it should then work for you.

If you open up LaunchMoIBatchConvert.cmd in notepad you can see that it is just one line that says:

"C:\Program Files (x86)\MoI 2.0\MoI.exe" "C:\Program Files (x86)\MoI 2.0\batchconvert.js"

Note how there are 2 statements grouped with " " characters - the first one is for the path to Moi.exe which is the program you need to launch, and you need to put quotes around its path because there are spaces in it.

Then after the .exe is the path to batchconvert.js, which will be sent as a command-line parameter to MoI.exe after it is launched and MoI will see that and then load and execute that script file.

Does that make sense? Please let me know if you still have any problems.

- Michael