Problem To get the IP of the system through coding

kgsinhakgsinha Member Posts: 67
edited 2007-08-10 in NAV Tips & Tricks
Can we get the IP of the system through Coding...
Plase anybody help.... ](*,) ](*,) ](*,)

Comments

  • ara3nara3n Member Posts: 9,255
    Here is an example
    if isclear(WindowShell) then
      create(WindowShell);
     WindowShell.CurrentDirectory(ENVIRON('windir') + '\system32\');
         txtCommand := 'ipconfig';
         WSHExec := WindowShell.Exec(txtCommand);
         WSHTextStream := WSHExec.StdOut;
         //read till 15th line for error
         I := 0;
         WHILE (NOT WSHTextStream.AtEndOfStream) AND (I < 8) DO BEGIN
          txtMsg := WSHTextStream.ReadLine();
          I +=  1;
         END; 
    message(copystr(txtMsg,45));
    

    WindowShell is of type 'Windows Script Host Object Model'.WshShell
    WSHExec is of type 'Windows Script Host Object Model'.WshExec
    WSHTextStream is of type 'Windows Script Host Object Model'.TextStream
    I is integer
    txtMsg is text 1000;
    txtCommand is text
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • kgsinhakgsinha Member Posts: 67
    Thanks for ur reply.. but can u pls help me more.

    Can u make me understand the whole process , which u hace written in code. will it work in navision.
  • kgsinhakgsinha Member Posts: 67
    I checked ur code..... Its working...
    thanx once again
  • krikikriki Member, Moderator Posts: 9,094
    [Topic moved from Navision forum to Navision Tips & Tricks forum]
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • ara3nara3n Member Posts: 9,255
    kgsinha wrote:
    I checked ur code..... Its working...
    thanx once again

    you are welcome.

    if you want to learn how it work, turn on the debugger and see how it works.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
Sign In or Register to comment.