Number of arguments in cxcalc on Windows

User a216001020

29-09-2006 11:59:45

Using Marvin Beans installed from marvinbeans-4_1_0-windows.exe on Windows XP I could not get some calculations with cxcalc when the command included too many arguments. I then edited the cxcalc.bat file and replaced the line





"%JVMPATH%" %JVMPARAM% chemaxon.marvin.Calculator %1%2%3...


with


"%JVMPATH%" %JVMPARAM% chemaxon.marvin.Calculator %*





It seems to have solved the problem. Would you please confirm this is a safe solution?

ChemAxon 7c2d26e5cf

29-09-2006 13:45:28

In most cases, this solution works but sometimes "%*" can cause problem.


In Marvin batch files we use the "shift" operator to filter JVM parameters from the parameter list of the batch file. "%*" prints all parameters (and ignore shift). It means that JVM parameters will be also passed to the Java application.


E.g.:
Code:
cxcalc.bat -Xmx128m mols-2d/caffeine.mol charge



The above command will be tranformed to


Code:
java -Xmx128m chemaxon.marvin.Calculator mols-2d/caffeine.mol charge



If you change "%1 %2 %3.." to "%*, the result will be the following:


Code:
java -Xmx128m chemaxon.marvin.Calculator -Xmx128m mols-2d/caffeine.mol charge



In this case, Calculator will throw an exception because "-Xmx128m" is an unknow option.


Instead of "%*", I suggest to enumerate more parameters in the batch file (e.g. enumerate them until 40).


Code:
"%JVMPATH%" %JVMPARAM% chemaxon.marvin.Calculator %1 %2 %3 %4 %5 %6 %7 %8 %9 %10% %11% ... %40%

User a216001020

02-10-2006 11:26:35

Tamas wrote:



Instead of "%*", I suggest to enumerate more parameters in the batch file (e.g. enumerate them until 40).


Code:
"%JVMPATH%" %JVMPARAM% chemaxon.marvin.Calculator %1 %2 %3 %4 %5 %6 %7 %8 %9 %10% %11% ... %40%
cmd doesn't support %10 %11 .





see http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/ntcmds_shelloverview.mspx?mfr=true





"Cmd.exe provides the batch parameter expansion variables %0 through %9"...


"To access arguments beyond %9, you need to use the shift command."

ChemAxon 7c2d26e5cf

12-09-2007 10:07:27

This issue will be fixed in next patch release of Marvin (Marvin 4.1.13).


Marvin batch files will support parameters until 40.


JChem batches already support 40 parameters.