Name DataType Subtype Length
WSHShell Automation 'Windows Script Host Object Model'.WshShell
AppName Text 30
AppExe Text 30
WinStyle Variant
if isclear(WSHShell) then
create(WSHShell);
AppName := 'Rechner';
AppExe := 'calc.exe';
WinStyle := 1;
if not WSHShell.AppActivate(AppName) then
WSHShell.Run(AppExe,WinStyle) //Startet den calc.exe
else
WSHShell.Popup('Läuft bereits'); //Bringt den Rechner in den Vordergrund
clear(WSHShell);
I have been looking at the methods provided by WSHShell, and none of them allows me to check if an application (e.g is calc.exe ) is currenlty running.
A look at the following will illustrate what l am trying to say.
[...] none of them allows me to check if an application (e.g is calc.exe ) is currenlty running.
[...]
If you can't acitvate the application with WSHShell.AppActivate(AppName) then it could be that the application is not started (or you have searched for the wrong AppName).
After implementing the "Calculator" example, when l manually run the codeunit, ( l created a codeunit (50000)) that has the above code), everything is ok. When l execute CODEUNIT.RUN(50000) in some trigger, a new calculator is being started. My codeunit 50000 is as follows:
NB: Oyster is an OCX that has "SHELL" functionality and does not bring SHELL errors in some appliation paths.
IF ISCLEAR(WSHShell) THEN
CREATE(WSHShell);
Navision := COMPANYNAME;
NavisionExe := 'C:\Program Files\Microsoft Business Solutions-Navision 4.0\Client\finsql.exe';
AppName := 'Calculator';
AppExe := 'calc.exe';
IF NOT WSHShell.AppActivate(AppName) THEN BEGIN
Oyster.Oyster(AppExe);
SLEEP(800); //Wait until the CALC is up and running by waitng for 8 seconds.
END;
//Bring Navision back to be the active screen
IF NOT WSHShell.AppActivate(Navision) THEN
Oyster.Oyster(NavisionExe);
CLEAR(WSHShell);
Navision := COMPANYNAME;
NavisionExe := 'C:\Program Files\Microsoft Business Solutions-Navision 4.0\Client\finsql.exe';
Is it true, that the Navisionwindows name is only the companyname:?:
My Navision shows the companyname and " - Microsoft business Solutions-Navision"
That is right, COMPANYNAME only is not the title tar text, but its the one that is running the Navision client. l think the existance of spaces in the text raises confusing in the appactivate() function. if you check out the appactivate API, it checks if the parameter is "contained" in the apps that are running. :-k
Very handy thingy - but how can I kill the extra slave.exe 's :roll: :-k (or better use it within same slave), which is the result of running WSHShell.Run(AppExe,WinStyle) - the extra slave takes control over my printer and ... :-s ?
Anybody :-k ?
Comments
Thanks
>install Navision::4.0 SP1
>q
$
oOo
regards
>install Navision::4.0 SP1
>q
$
oOo
regards
A look at the following will illustrate what l am trying to say.
http://msdn.microsoft.com/archive/defau ... ShellM.asp
Unfortunately, that leaves my question open, but not as wide as it was at first.
Regards
>install Navision::4.0 SP1
>q
$
oOo
Microsoft Dynamics NAV Developer since 1997
MSDynamics.de - German Microsoft Dynamics Community - member of [clip]
Regards
Thanks guys!!!!!
=D>
>install Navision::4.0 SP1
>q
$
oOo
After implementing the "Calculator" example, when l manually run the codeunit, ( l created a codeunit (50000)) that has the above code), everything is ok. When l execute CODEUNIT.RUN(50000) in some trigger, a new calculator is being started. My codeunit 50000 is as follows:
NB: Oyster is an OCX that has "SHELL" functionality and does not bring SHELL errors in some appliation paths.
IF ISCLEAR(WSHShell) THEN
CREATE(WSHShell);
Navision := COMPANYNAME;
NavisionExe := 'C:\Program Files\Microsoft Business Solutions-Navision 4.0\Client\finsql.exe';
AppName := 'Calculator';
AppExe := 'calc.exe';
IF NOT WSHShell.AppActivate(AppName) THEN BEGIN
Oyster.Oyster(AppExe);
SLEEP(800); //Wait until the CALC is up and running by waitng for 8 seconds.
END;
//Bring Navision back to be the active screen
IF NOT WSHShell.AppActivate(Navision) THEN
Oyster.Oyster(NavisionExe);
CLEAR(WSHShell);
](*,)
>install Navision::4.0 SP1
>q
$
oOo
NavisionExe := 'C:\Program Files\Microsoft Business Solutions-Navision 4.0\Client\finsql.exe';
Is it true, that the Navisionwindows name is only the companyname:?:
My Navision shows the companyname and " - Microsoft business Solutions-Navision"
That is right, COMPANYNAME only is not the title tar text, but its the one that is running the Navision client. l think the existance of spaces in the text raises confusing in the appactivate() function. if you check out the appactivate API, it checks if the parameter is "contained" in the apps that are running. :-k
>install Navision::4.0 SP1
>q
$
oOo
Anybody :-k ?