Command Line Application

Hi all!

I have a question regarding to the AnyBody Command Line Application.
I writed a program in C++ who should be able to start the AnyBodyCon.exe and open a macro file in it to load a model.
I did this with the C++ Funktion ShellExecute() and gave the function the path to the .exe-File and as parameter the string " runmacro “filename.anymcr” ".
When I compile and start my program there is no problem. Also the .exe-File openes directly but then AnyBodyCon.exe says that can`t open the macro file.
If I include the same command directly into the AnyBodyCon.exe out of my menu the macrofile runs without a problem.

I hope you can help me with my problem.
Dear, Anja.

Hello,

The ”runmacro” is not a program argument for AnyBodyCon. It is a command for the macro language.

You find the program arguments by calling AnyBodyCon.exe /?. This gives the following

AnyBodyCon.exe <arguments>:
This starts the AnyBody console application
in interactive modes.
AnyBodyCon.exe MacroFile.anymcr <arguments>:
This starts the AnyBody console application
and executes the macro script in the file MacroFile.anymcr.

ARGUMENTS :
/?, -?, --help
Help
/d <dirname>, -d <dirname>, --dir=<dirname>
Sets current directory to ‘dirname’.
/m <macrofile>, -m <macrofile>, --macro=<macrofile>
Specifies the macro file to execute to ‘macrofile’.

The solution should be “/m “filename.anymcr”” as argument to ShellExecute(…)
Equivalent is “-m “filename.anymcr”” or “–macro=“filename.anymcr””

Best regards,
Sebastian

Thank you for your reply.
I tried your solution before I made this posting.

Now I tried it again and I will shor your the error:
Current path: xxx
Error: " : runmacro: string parameter with file name expected
Error: : command expected
Warning: AnyBody.anymcr: has no effect.

My ShellExecute looks like this:
ShellExecute(NULL, “open”, tempString.c_str(),ex.c_str(),NULL,SW_SHOWNORMAL);
with the parameters:

//For the macro file
string ex = “/m “D:\Dokumente und Einstellungen\ajk$\Desktop\Thesis\Thesis\AnyBody.anymcr””;

//For the exe file
string tempString = “C:\Programme\AnyBody Technology\AnyBody.4.1\AnyBodyCon.exe”;

Maybe you find the error in my programming code…

Hi,
it seems the problem is related to your macro. Could you post it?
Best regards,
Sebastian

Jap, that’s no problem.
Here’s the file AnyBody.anymcr:

load “Z:\300\330obs\MA\Studenten\Anja Krauss\AnyBody\Tutorial_C3D\C3DTest.any”
operation Main.MyStudy.InverseDynamics
run
exit

I tried a little bit playing with my code and now I get a new error :wink:

My code looks like this:
string ex = “/m “D:\Dokumente und Einstellungen\ajk$\Desktop\Thesis\Thesis\AnyBody.anymcr””;
string tempString = “C:\Programme\AnyBody Technology\AnyBody.4.1\AnyBodyCon.exe”;

ShellExecute(NULL, "open", tempString.c_str(), ex.c_str(), NULL, SW_SHOW);

And then I get the error:
command line parser failure.

That`s it.
Anja.

Hi Anja,
the problem seems to be in the /m option. Without the option it works, at least in my machine. This is obviously a bug. Again, sorry for the inconvenience. It’s already forwarded to the development and will be included in the next release. Sorry for the trouble you experience in using the command line options.
Best regards,
Sebastian