Hi
How can I find out from a navision code unit on what computer (computer name, eg. xyws27) and/or its IP Address the code is currently running?
Thanks
Thomas
1) I cant find the field in my 3.7 installation, it seems to be a 4.x thing?
2) On a test installation of 4.2 I see the field, but in host_name there is the name of the server, not of the client. ](*,)
1. create an singleinstance CU with variables to save the ip in an globel variable. Run this CU from CU 1 Company open (or your created cu). The reason for singleinst. CU is, an DOS Promp comes and users doesn't like it, ever see this promt
needed variables
Name DataType Subtype Length
WSHShell Automation 'Windows Script Host Object Model'.WshShell
WSHExec Automation 'Windows Script Host Object Model'.IWshExec
WSHTxt Automation 'Windows Script Host Object Model'.TextStream
FullCompName Text 80
FullCompIP Text 80
IF ISCLEAR(WSHShell) THEN
CREATE(WSHShell);
WSHExec := WSHShell.Exec('nslookup ' + ENVIRON('computername'));
WSHTxt := WSHExec.StdOut;
WSHTxt.SkipLine;
WSHTxt.SkipLine;
WSHTxt.SkipLine;
FullCompName := COPYSTR(WSHTxt.ReadLine,1,80);
FullCompIP := COPYSTR(WSHTxt.ReadLine,1,80);
MESSAGE();
CLEAR(WSHShell);
MESSAGE(FullCompName);
MESSAGE(FullCompIP);
Dear Concern
I want to know that where I have to write the following code in Navision codeunit,and following code only shows us the that client computer name not of others:
Dear Concern
I want to know that where I have to write following code:
message(environ('computername'));
It means that in which codeunit I have to write above code.Suppose I m using Native DB (Local) and write code code in CU 1 in Function CompanyOpen, when I open any company then it shows me a message(means, Computer Name).And If I m using Navision SQL server then where I have to write code and how this code will be executed?
Comments
You should filter on "My Session"=TRUE.
Eric Wauters
MVP - Microsoft Dynamics NAV
My blog
Thanks for your post.
I have to problems:
1) I cant find the field in my 3.7 installation, it seems to be a 4.x thing?
2) On a test installation of 4.2 I see the field, but in host_name there is the name of the server, not of the client. ](*,)
You're using 3.70 native?
Eric Wauters
MVP - Microsoft Dynamics NAV
My blog
as an automation control
And it is automatically installed when Windows is installed ...
Eric Wauters
MVP - Microsoft Dynamics NAV
My blog
Takes back the Computername where navision runs
message(environ('computername'));
Takes back the connected Client Computername from where is connect to an terminalserver (like citrix or MS Terminalserver)
message(environ('Clientname'));
Let us know, If you need the IP.
Regards
Thanx for your valuable help on this.
I've tested both (WSH and environ), works like a charm =D>
Thomas
OK, how about the IP?
Eric Wauters
MVP - Microsoft Dynamics NAV
My blog
Regards
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
I want to know that where I have to write the following code in Navision codeunit,and following code only shows us the that client computer name not of others:
message(environ('computername'));
Navision Technical Consultant
You want to know where you can write this codesnipes?
I want to know that where I have to write following code:
message(environ('computername'));
It means that in which codeunit I have to write above code.Suppose I m using Native DB (Local) and write code code in CU 1 in Function CompanyOpen, when I open any company then it shows me a message(means, Computer Name).And If I m using Navision SQL server then where I have to write code and how this code will be executed?
Navision Technical Consultant