I've seen some post to run codeunits from outside NAV but they all use som kind of listener.
Is there any way to run a codeunit from outside NAV without using any automations that listen for events?
Then in codeunit 1 at the end of Function "LogInStart"
IF CODEUNIT.RUN(CODEUNIT::"Autostart control") THEN ;
Then in the OnRun of codeunit "Autostart control"
I := STRPOS(UPPERCASE(COMMANDLINE), 'ID=');
IF I = 0 THEN EXIT ELSE BEGIN
Str := COPYSTR(COMMANDLINE, I+3);
I := STRPOS(Str, ',');
IF I > 0 THEN BEGIN
IF I > 1 THEN
Str := COPYSTR(Str, 1, I-1)
ELSE
Str := '';
END;
I := STRPOS(Str, '-C');
IF I = 0 THEN EXIT;
Str := COPYSTR(Str, I+2);
IF NOT EVALUATE(CodeunitNo, Str) THEN
EXIT;
CODEUNIT.RUN(CodeunitNo);
END;
The problem, of course, is exiting Navision once the codeunit has finished. Perhaps you can do some sendkeys stuff to simulate an Alt-F4. I have a few bits of code that will crash Navision ... but that's not very nice.
More likely a better solution is to look for an automation and start Navision if it's not there before trying again.
Comments
eg:
Then in codeunit 1 at the end of Function "LogInStart"
Then in the OnRun of codeunit "Autostart control"
The problem, of course, is exiting Navision once the codeunit has finished. Perhaps you can do some sendkeys stuff to simulate an Alt-F4. I have a few bits of code that will crash Navision ... but that's not very nice.
More likely a better solution is to look for an automation and start Navision if it's not there before trying again.
TVision Technology Ltd
viewtopic.php?f=7&t=15879
http://www.BiloBeauty.com
http://www.autismspeaks.org
Thx all.
NAV Freelance Consultant