Getting Environment Variables from both server and client

rocatis
Member Posts: 163
In NAV 2009 you had the option of creating automations on either the server side or the client side.
Thus,
CREATE(WSHShell,FALSE,TRUE);
MESSAGE('%1',WSHShell.ExpandEnvironmentStrings('%temp%'));
would give me the temp variable for the client, while
CREATE(WSHShell,FALSE,FALSE);
MESSAGE('%1',WSHShell.ExpandEnvironmentStrings('%temp%'));
would give me the temp variable for the server.
(WSHShell points to the automation 'Windows Script Host Object Model'.WshShell).
In NAV 2013 the last CREATE parameter must be TRUE which leads me to the question:
How do I reestablish the functionality I had before? How do I get the environment variable as seen from the server side?
Thus,
CREATE(WSHShell,FALSE,TRUE);
MESSAGE('%1',WSHShell.ExpandEnvironmentStrings('%temp%'));
would give me the temp variable for the client, while
CREATE(WSHShell,FALSE,FALSE);
MESSAGE('%1',WSHShell.ExpandEnvironmentStrings('%temp%'));
would give me the temp variable for the server.
(WSHShell points to the automation 'Windows Script Host Object Model'.WshShell).
In NAV 2013 the last CREATE parameter must be TRUE which leads me to the question:
How do I reestablish the functionality I had before? How do I get the environment variable as seen from the server side?
Brian Rocatis
Senior NAV Developer
Elbek & Vejrup
Senior NAV Developer
Elbek & Vejrup
0
Comments
-
You can use DotNet interop instead, runs both client and server side.
Name DataType Subtype
environment DotNet System.Environment.'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
MESSAGE('%1',environment.GetEnvironmentVariable('temp'));0 -
stomdahl wrote:MESSAGE('%1',environment.GetEnvironmentVariable('temp'));
environment.InsertEnvironmentVariables('%temp%\User\file%username%') returning 'C:\Users\BROCAT~1\AppData\Local\Temp\User\fileBRocatis3101'. I can't seem to find anything like that in DotNet (which doesn't exactly lack options).
Guess I'll have to write a parser myself. Thanks for putting me on the right path.Brian Rocatis
Senior NAV Developer
Elbek & Vejrup0 -
Have a look at this: http://www.dotnetperls.com/environment
See under: ExpandEnvironmentVariables
It does exactly what you want.0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions