title: Get working directory in VBScript under BlueZone
body: <p>I'm currently developing a number of VBScript scripts for use with the BlueZone terminal emulator.  Many of these files need access to external data files that are stored in the same location as the scripts themselves.  On my own computer, I've hard-coded the full path name into the script and they work fine, but I'm now trying to re-distribute these scripts around the office through a private Git repository and have run into a problem.</p>
  
  <p>Obviously, with the files being stored on different computers, including shared drives, the hard-coded directory name does not work anymore, so I need a way to read the name of the directory that the script is stored in.  All the advice I have been able to find has said that the command WScript.ScriptFullName will give me that.  Unfortunately, as these scripts are being run through BlueZone, I don't actually have access to that object, but the situation is a little confusing.</p>
  
  <p>For example, the following code line seem to work as expected:</p>
  
  <pre><code>Dim myObject : Set myObject = CreateObject("WScript.Network")
  </code></pre>
  
  <p>So does this:</p>
  
  <pre><code>Dim myObject : Set myObject = CreateObject("WScript.Shell")
  </code></pre>
  
  <p>But this one doesn't:</p>
  
  <pre><code>MsgBox WScript.Name
  </code></pre>
  
  <p>Instead I get the follwoing error message:</p>
  
  <p><a href="http://i.stack.imgur.com/VijHW.png" rel="nofollow">BlueZone Error Message</a></p>
  
  <p>I get a slightly different error message with the following line:</p>
  
  <pre><code>Dim myObject : Set myObject = CreateObject("WScript")
  </code></pre>
  
  <p>So it seems that I have access to the sub-objects of WScript, but not the object itself, which doesn't make much sense.  The BlueZone environment seems to use its own automation object as a replacement for the WScript object, but there's nothing in the <a href="http://www3.rocketsoftware.com/bluezone/help/v62/en/bzsh/default.htm" rel="nofollow">documentation</a> about getting access to the script directory configured under BlueZone itself.</p>
  
  <p>Another attempt was the following code:</p>
  
  <pre><code>Dim myObject : Set myObject = CreateObject("Scripting.FileSystemObject")
  Dim WD : WD = myObject.GetAbsolutePathName (".")
  </code></pre>
  
  <p>But this only gives the directory of BlueZone itself, not the scripts directory.  Other than hard-coding each individual copy of each individual script (which means not being able to use a central repository), I don't see any other way around this problem.</p>
  
  <p>Any ideas?</p>