<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Dynamics NAV Integration &#187; environment variables</title>
	<atom:link href="http://www.dynamicsnavintegration.dk/tag/environment-variables/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.dynamicsnavintegration.dk</link>
	<description>A site about Dynamics NAV Integration and development</description>
	<lastBuildDate>Wed, 16 Dec 2009 22:08:23 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Determining your session environment in Dynamics NAV &#8211; Citrix vs. local</title>
		<link>http://www.dynamicsnavintegration.dk/determining-your-session-environment-citrix-vs-local/</link>
		<comments>http://www.dynamicsnavintegration.dk/determining-your-session-environment-citrix-vs-local/#comments</comments>
		<pubDate>Sat, 28 Nov 2009 00:12:23 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Citrix]]></category>
		<category><![CDATA[environment variables]]></category>
		<category><![CDATA[session]]></category>

		<guid isPermaLink="false">http://www.dynamicsnavintegration.dk/?p=28</guid>
		<description><![CDATA[Today I ran into a scenario where I wanted some specific code to be run when the client was started on a Citrix server and some other code to be run when the client was started on a desktop.
To determine where the client is started, we can use an automation of the subtybe Windows Scipting [...]]]></description>
			<content:encoded><![CDATA[<p>Today I ran into a scenario where I wanted some specific code to be run when the client was started on a Citrix server and some other code to be run when the client was started on a desktop.</p>
<p>To determine where the client is started, we can use an automation of the subtybe Windows Scipting Host Object Model to access the Windows Environment variables.<br />
Those of you that were around ind the good old DOS  days surely know a great deal about the environment variables. We are interested in the environment variable called SESSIONNAME, which on Citrix has a value something like &#8220;ICA&#8230;&#8230;..&#8221; and locally has the value &#8220;CONSOLE&#8221;.</p>
<p>So by requesting the content of SESSIONNAME we can determine if the client is being executed on the Citrix server.</p>
<p><strong>Here&#8217;s how:</strong></p>
<p>1. Create an automation variable, with the subtype: &#8216;Windows Script Host Object Model&#8217;.WshShell</p>
<p><img class="size-full wp-image-31  alignleft" title="Automations in Dynamics NAV" src="http://www.dynamicsnavintegration.dk/wp-content/uploads/Automations-in-Dynamics-NAV1.JPG" alt="Automations in Dynamics NAV" width="551" height="299" /><img class="size-full wp-image-30 aligncenter" title="WSHShell" src="http://www.dynamicsnavintegration.dk/wp-content/uploads/WSHShell.JPG" alt="WSHShell" width="369" height="317" /></p>
<p>And the code:</p>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 492px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">IF ISCLEAR(WSHShell) THEN</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 492px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">CREATE(WSHShell);</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 492px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">WSHShell.ExpandEnvironmentStrings(BSTR Src)</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 492px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">CLEAR(WSHShell);</div>
<p style="text-align: center;"><img class="size-full wp-image-33 aligncenter" title="code" src="http://www.dynamicsnavintegration.dk/wp-content/uploads/code.JPG" alt="code" width="672" height="190" /></p>
<p>Notice that we have to name the environment variable by using the prefix and suffix percent character (%).</p>
<p>Of course this is useful for many other things to, if you want to know something about the current client session.</p>
<p>You can get a full list of environment variables by opening a command prompt and typing</p>
<blockquote><p>&#8220;set&#8221;</p></blockquote>
<p>A lot of useful information exists in the environment variables. For example the name of the Program Files folder etc.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dynamicsnavintegration.dk/determining-your-session-environment-citrix-vs-local/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

