Options

Operation System functions issues

PitPit Member Posts: 3
edited 2009-09-15 in NAV Three Tier
Hello everyone!
It is not a secret that some operation system functions are not supported in RTC.
Does anybody have an idea how can I get values of SYSTEMDRIVE, COMPUTERNAME, TEMP,TMP ... and/or other system variables?

In the classic client I can use the ENVIRON function, but this function is not supported in the RoleTailored client.

For example:
In the Classic client ENVIRON('TEMP') will return me the path to the temporary system folder.
In th RTC the similar path will be after using CREATETMPFILE func and getting the path of a created file.
Or If the temporary place is not critical for solution – the TEMPORARYPATH function can be used.

But it is only one alternative.

What about analogs to
ENVIRON('SYSTEMDRIVE')
ENVIRON('COMPUTERNAME')
ENVIRON('SYSTEMROOT')
ENVIRON('WINDIR')
...
?

Thx a lot in advance.

P.S. Windows Vista Business.
Petro Bufan
Software Development Engineer
MS Dynamics NAV for MCPs

Comments

  • Options
    papillonpapillon Member Posts: 8
    If you can rely on Windows Scripting Host being available, the following works:

    Declare an automation variable called WSH of type Windows Script Host Object Model.WshShell:
    WSH	Automation	'Windows Script Host Object Model'.WshShell	
    
    and then
    IF ISSERVICETIER THEN
      CREATE(WSH, TRUE, TRUE)
    ELSE
      CREATE(WSH, TRUE);
    
    MESSAGE(FORMAT(WSH.ExpandEnvironmentStrings('%TEMP%')));
    

    This prints the value of the environment variable %TEMP% of the session the RTC is running in. If you need it on the server side, just make the third parameter to CREATE a "false".

    There are probably better ways, but this works for me.
  • Options
    PitPit Member Posts: 3
    edited 2009-02-03
    Thx. It really works as I need.
    Petro Bufan
    Software Development Engineer
    MS Dynamics NAV for MCPs
  • Options
    dmc-dkdmc-dk Member Posts: 42
    You can use ISSERVICETIER directly in CREATE function to avoid that IF...THEN statement:
    CREATE(WSH,FALSE,ISSERVICETIER);
    
  • Options
    abhishekpareekabhishekpareek Member Posts: 150
    Hi All,

    With reference to above I have another query i.e.

    As we know that ENVIRON function is not supported in RTC hence how to get the value for windows user name in RTC. Earlier we use to get it by :

    ENVIRON('USERNAME')

    Thanks in Advance!

    Regards,
    Abhishek Pareek
  • Options
    fitolfitol Member Posts: 46
    Can't you just use USERID ?
  • Options
    abhishekpareekabhishekpareek Member Posts: 150
    Hey it is resolved. Actually I have to fetch the windows login instead of navision login.

    I used this command:

    WSH.ExpandEnvironmentStrings('%USERNAME%');

    Thanks,
    Abhishek
Sign In or Register to comment.