NAV 2013 - Shell is not working

rchikkarchikka Member Posts: 23
edited 2014-10-28 in NAV Three Tier
Hi All,

We are using NAV 2013.

We are simulating data transfer using ftp from Head Office to Store..

The files willl be exported via XML and will get placed into FTP using Wshshell successsfully.. However while downloading the files from FTP Folder, the wshshell is not calling the batch file ?

Name DataType Subtype
wSHShell Automation 'Windows Script Host Object Model'.WshShell

CREATE(wSHShell,false,ISSERVICETIER);
wshshell.run(uploadfiles) ; // uploadfiles is a text constant which calls the batch job (.bat)
upto to here.. it works fine.

similarly wshshell.run(downloadfiles) // download files is a text constant which calls the batch job ( .bat)
here the calling is not happening..
however if we do run the batch file (.bat) file manually, then it works successfully.

not able to make it out whether am i missing something or is there any problem with wshshell call itself ?? if so how to fix it ?

Kindly suggest ?

Comments

  • krikikriki Member, Moderator Posts: 9,112
    [Topic moved from 'NAV/Navision Classic Client' forum to 'NAV Three Tier' forum]
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • ftorneroftornero Member Posts: 524
    You can use dotNet

    Create this 2 variables:

    WShell DotNet System.Diagnostics.Process.'System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'

    ProcInfo DotNet System.Diagnostics.ProcessStartInfo.'System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'

    and the next code:

    ProcInfo := ProcInfo.ProcessStartInfo;
    ProcInfo.FileName := 'here program to exe';
    ProcInfo.Arguments := 'here the parameters';
    ProcInfo.UseShellExecute := FALSE;
    ProcInfo.RedirectStandardOutput := TRUE;
    ProcInfo.WindowStyle := 1; // Hidden
    ProcInfo.CreateNoWindow := TRUE;

    WShell:= WShell.Start(ProcInfo);
    WShell.WaitForExit;
  • itsandsllcitsandsllc Member Posts: 13
    An alternative...

    Within the Microsoft.VisualBasic.Interaction namespace is the Shell method, MSDN here http://msdn.microsoft.com/en-us/library/f92d6y8s(v=vs.110).aspx

    Using this method you can create a process without using the additional code.

    Define two variables:
    vbShell of DotNet using Microsoft.VisualBasic.Interaction.'Microsoft.VisualBasic, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
    vbAppWinStyle of DotNet using Microsoft.VisualBasic.AppWinStyle.'Microsoft.VisualBasic, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'

    The C/AL code required is as follows;
    vbShell.Shell('c:\somedir\somefile.exe', vbAppWinStyle.Hide, FALSE, 0);
    

    Much simpler but less control.

    Enjoy 8)
Sign In or Register to comment.