Page 1 of 1
user defined application parameters
Posted: Sat Oct 15, 2011 3:48 am
by ghosttie
I can't get user defined application parameters to work. My command line is:
jade.exe server=singleUser app=TestApp schema=TestSchema path=f:\something\system ini=f:\something\system\jade.ini endJade "something something"
TestApp has an initialize method of:
Code: Select all
init(pSA_Args : HugeStringArray);
vars
begin
if pSA_Args = null then
app.msgBox("pSA_Args is null", "Test", 0);
else
app.msgBox(pSA_Args.display, "Test", 0);
endif;
end;
pSA_Args is always null.
It doesn't work thin client either.
Anyone have any ideas?
Re: user defined application parameters
Posted: Sat Oct 15, 2011 4:27 pm
by murray
Maybe Jade is being picky about the declaration of the parameter of the intialisation method?
In the manual (RuntimeApps.pdf) it states:
"An exception is raised if the initialize method does not have only one parameter of type Object".
At least see if you can reproduce the example there, on page 23, as a starting point.
Re: user defined application parameters
Posted: Mon Oct 17, 2011 8:40 am
by torrie
We use the process.getCommandLine to get the full command line and then process it for the parameters e.g.
Code: Select all
sCommandLine := process.getCommandLine();
iPos := sCommandLine.toUpper.pos( " ENDJADE ", 1 );
if iPos = 0 then
return 0;
else
iPos := iPos + 9; // Length of ENDJADE
iLength := sCommandLine.length;
if iPos < iLength then
while iPos > 0 do
psaParameters.add( sCommandLine.getNextCommandLineParameter( iPos ) );
iParameterCount := iParameterCount + 1;
endwhile;
endif;
return iParameterCount;
endif;
Where the getNextCommandLineParameter method looks for the space delimetered parameters
Re: user defined application parameters
Posted: Mon Oct 17, 2011 10:15 am
by BeeJay
I've only ever used the option where the parameters are automatically built into a HugeStringArray when running a non-GUI application with jadclient.exe.
(I'm not 100% sure, but I believe that this "automatic" option only works when using jadclient.exe to launch a non-GUI application?!?)
For jade.exe applications, I always use the getCommandLine option and then parse it manually, as already mentioned by Torrie.
Cheers,
BeeJay.
Re: user defined application parameters
Posted: Tue Oct 18, 2011 4:38 am
by ghosttie
Thanks guys, process.getCommandLine does the trick.
The documentation seems to imply that it'll work with jade.exe but I guess it only works with jadclient. I've put in a contact asking whether it's a documentation error or a bug.
Re: user defined application parameters
Posted: Wed Oct 19, 2011 9:55 am
by DarthVader
the method needs this parameter.
userMethod(initializeParameter : Object);
the object will be a HugeStringArray.