Options

SHELL function in RTC

BeagleBeagle Member Posts: 8
edited 2012-12-13 in NAV Three Tier
we have write a winform appliction which we want start from the RTC. In the classic Client we could start this application with the SHELL function and its works. In the RTC we get the Message that the SHELL function isn't supported. Is there any possibility to start a win application from the RTC?

Thanks,

Dominik

Comments

  • Options
    TroelshTroelsh Member, Microsoft Employee Posts: 79
    Shell is an obsolete function in RTC. Instead you have to create a COM object and instantiate it using the CREATE function.

    Troels Bent Hansen
    Senior Program Manager
    Microsoft Dynamics NAV


    ****** This posting is provided "AS IS" with no warranties, and confers no rights ******
  • Options
    BeagleBeagle Member Posts: 8
    We use the following code:


    _commandLine := 'C:\Test.exe';
    _runModally := FALSE;
    dummyInt := 1;

    CREATE(wSHShell);
    wSHShell.Run(_commandLine,dummyInt,_runModally);
    CLEAR(wSHShell);

    In the classic client it still works with this code . In the RTC nothing happens. We can see in the taskmanager that the process is started but the application is not display.
  • Options
    BeagleBeagle Member Posts: 8
    Ok I found the solution. the above code works if I set the right parameter in the create function
    _commandLine := '\\*.*.*RTC\programm.exe ' + "No.";
    _runModally := FALSE;
    dummyInt := 1;
    
    CREATE(wSHShell,false,true);
    wSHShell.Run(_commandLine,dummyInt,_runModally);
    CLEAR(wSHShell);
    
  • Options
    ara3nara3n Member Posts: 9,255
    I would change it slightly to


    CREATE(wSHShell,false,ISSERVICETIER);
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • Options
    mihail_kolevmihail_kolev Member Posts: 379
    it's good to say that
    Name DataType Subtype
    wSHShell Automation 'Windows Script Host Object Model'.WshShell

    other is clear =D>
    -Mihail- [MCTS]
  • Options
    mihail_kolevmihail_kolev Member Posts: 379
    ok, but another but i got another problem... when I try to run app from network

    i.e.:
    _commandLine:= '\\server\folder\sample.exe';

    an error msg appears:

    "The call to member Run failed: No network provider accepted the given network path (Exception from HRESULT 0x800704B3)."

    I have administrator acc. and full access.

    Got any ideas why so..? Any settings that i may missed? :-k

    Edit: I finaly found it :D :
    when using network pathes the command line should be initialize like that '"\\server\folder\sample.exe"'; (the double quotes)
    -Mihail- [MCTS]
  • Options
    animaconsultinganimaconsulting Member Posts: 10
    Fantastic ! Thanks to you all for posting this - I've spent hours trying to solve this!
    Chris
    Chris
    ánima Consulting
    http://animaconsulting.co.uk
  • Options
    compwizardcompwizard Member Posts: 17
    This looks like just what I'm after! Could you let me know the C/AL Local declarations you used for _commandLine etc?
  • Options
    mihail_kolevmihail_kolev Member Posts: 379
    compwizard wrote:
    This looks like just what I'm after! Could you let me know the C/AL Local declarations you used for _commandLine etc?

    _commandLine -Text[1024]
    _dummyInt - Integer
    runModally - Boolean
    -Mihail- [MCTS]
  • Options
    gunshygunshy Member Posts: 43
    Hi,

    I have the same problem, but my external apps/exe requires a parameter.
    How can I pass a parameter?

    Thanks
  • Options
    yukonyukon Member Posts: 361
    Hi gunshy,

    Please try with below code.
    Name	DataType	Subtype	Length
    DNETSysDiagProcess	DotNet	System.Diagnostics.Process.'System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'	
    
    //DNETSysDiagProcess.Start(string fileName, string arguments);
    DNETSysDiagProcess := DNETSysDiagProcess.Start('cmd.exe','/?');
    

    Best Regards,
    Yukon
    Make Simple & Easy
Sign In or Register to comment.