Dave,
    The ToolKit assigns all these things as long as you selected them for 
installation. Here is what you add and where I use it inside the Uninstall 
program.

        Bruce

'Global:
Dim SO_GetEnvVar: Set SO_GetEnvVar = Nothing
'Inside Tool Kit check:
 ElseIf objName = "com.GWMicro.GWToolkit.Env" Then
  If objState Then
   Set SO_GetEnvVar = SharedObjects(objName, 0)
  Else
   Set SO_GetEnvVar = Nothing
  End If

'My useage inside the Uninstall program:
 'Note: below is for only 32 bit machines.
 If progPath = "" and s > 0 Then progPath = SO_GetEnvVar( "%windir%\system32\")

 s = InStr( 1, progName, "iwexec.exe", VbTextCompare) 
 If progPath = "" and s>1 and s<10 Then progName = Mid( progName, s)
 'Note: below is for only 32 bit machines.
 If progPath = "" and s > 0 Then progPath = SO_GetEnvVar( "%windir%\")

 Silence
 Dim Response, m
 m = " Program Name Is:" & VbCrLf & progName & VbCrLf & " Path To It Is:" & 
VbCrLf & progPath & VbCrLf
 If progName = "" Then
  MsgBox " No program to uninstall! ", vbExclamation+vbApplicationModal, "No 
UnInstall Program"
  Queue "SetFocus", TV_ObjControl
  Exit Sub
 End If

  Sent: Monday, June 25, 2012 2:43 AM
  Subject: Creating temporary files?


  Listers,
  Does anyone here happen to have a simple snip-it code, for the following 
scenario? Or any good suggestions?

  I have an app, that creates a temporary file for a certain task. The creation 
of the file has worked fine so far. But since this is only a temporary file, I 
had hoped to find a way of storing it in the Temporary folder on the computer. 
That is, the folder that is defined in the environment variable as either "tmp" 
or "temp", in Windows itself. 

  I did a bit of research on the net, and found a way to retrieve the contents 
of the Temp variable. Here is that code:

   Dim Shell: Set Shell = CreateObject( "WScript.Shell")
   Dim Environment: Set Environment = Shell.Environment( "System")
      Dim Tmp: Tmp = Environment( "Temp")

  The code works fine, and returns the contents of the variable. Problem is, 
that it returns things like:
      %systemroot%\Temp
  . Now trying a command like:
      Dim FSO: Set FSO = CreateObject( "Scripting.FileSystemObject" )
      Dim F: Set F = FSO.OpenTexstFile( Tmp &"\MyFile.tmp", 2, True)
  , I get an error thrown at me, telling that the path is invalid. My guess is, 
that the OpenTextFile does not like the %SystemRoot% part of the created 
filename.

  Reason why I tried to get hold of the Temp variable of the OS, is that I then 
could have the file stored in the temporary folder, no matter which machine the 
app was running on. Is there some kind of property or method, that will handle 
the expansion of the %systemroot% into a valid path? We migh even think of 
situations where the part between the two percent-signs could be anythhing 
else, depending on the computer configuration. 

  Hope all of this makes any sense. Any good workaround here?

  Thanks,

Reply via email to