mbt masai
 
Welcome !
         

                                
After experiencing a lot of down time, We decided to move this site to CrystalTech.com. CrystalTech.com is powered by only the finest Windows servers providing the best performance, reliability, and value anywhere.

 Dynamic Activity Window

Change Page: < 123 > | Showing page 2 of 3, messages 21 to 40 of 60
Author Message
alienprotein

  • Total Posts : 50
  • Scores: 0
  • Reward points : 0
  • Joined: 2/23/2005
  • Location: USA
  • Status: offline
RE: Dynamic Activity Window Friday, August 04, 2006 6:13 AM (permalink)
0
DiGiTAL.SkReAM
 
Thank you very much for pointing me to this code. Very nice, to say the least. I plugged in the code below and it does exactly what I want it too do, however I have a consideration you may be able to assist with.
 
My intention for this script is to give something visual the our VPN users letting then know the VPN login script is doing something and then notify them once it is complete. Otherwise they complain that Lotus Notes is erroring out due to not finding their ID file, etc...Blah blah...
 
So this works great for kicking off the script as a local admin on the laptop, but when logging in as a non privileged user I get the following error.
 


Windows Script Host
Line: 180
Char: 1
Error: Invalid root in registry key "HKLM\SYSTEM\PROGRESSBAR\MSG".
Code: 80070005
Source: WshShell.RegWrite



I attempted to replace "HKLM" with "HKCU" but it too generates almost the exact same error. When "HKCU" is tested with Admin rights it works perfectly.
 
Any ideas how to get this to run on a non-privileged user account (As we will not\Never allow our users local admin rights?)
 


 'Option Explicit 
 Dim StrPath
 Dim WshShell
 Dim oBar
 
 Set oBar = New ProgressBar
 Set WshShell = WScript.CreateObject("WScript.Shell")
 oBar.StartBar "Please wait while network drives are mapped."
 WScript.Sleep (8000)
 
 [color=#ff0000]WshShell.Run("C:\temp\test.vbs")[/color]
 [color=#ff0000]ReturnCode = WshShell.Run("C:\temp\test.vbs", 1, True)[/color]
 oBar.SetLine "Drive mapping completed......"
 WScript.Sleep (6000)
 oBar.CloseBar
 
 '*************************************************************************************
 Class ProgressBar
 Dim oBarCat, sProgressBarHTAFile, sProgressBarRunFile, sProgressBarSleepFile
 Public Sub StartBar(sMessageToDisplay)
 Dim sInitialTemp
 ExecuteGlobal "Dim oShell, oFSO, oEnv"
 Set oShell = CreateObject("Wscript.Shell")
 Set oFSO = CreateObject("Scripting.FileSystemObject")
 Set oEnv = oShell.Environment("Process")
 sInitialTemp = fGetTempName
 sProgressBarHTAFile = Left(sInitialTemp,(Len(sInitialTemp)-4)) & ".hta"
 sProgressBarRunFile = Left(sProgressBarHTAFile, Len(sProgressBarHTAFile)-4) & ".run"
 sProgressBarSleepFile = Left(sProgressBarHTAFile, Len(sProgressBarHTAFile)-4) & "sleep.vbs"
 Set oBarCat = CreateObject("Scripting.Dictionary")
 oBarCat.Add oBarCat.Count, "<html>"
 oBarCat.Add oBarCat.Count, "<head>"
 oBarCat.Add oBarCat.Count, "<title id=" & Chr(34) & "title" & Chr(34) & ">W&K VPN Login</title>"
 oBarCat.Add oBarCat.Count, "<HTA:APPLICATION "
 oBarCat.Add oBarCat.Count, "    ID=" & Chr(34) & "StatusBar" & Chr(34) & ""
 oBarCat.Add oBarCat.Count, "    APPLICATIONNAME=" & Chr(34) & "StatusBar" & Chr(34) & ""
 oBarCat.Add oBarCat.Count, "    SCROLL=" & Chr(34) & "no" & Chr(34) & ""
 oBarCat.Add oBarCat.Count, "    SINGLEINSTANCE=" & Chr(34) & "yes" & Chr(34) & ""
 oBarCat.Add oBarCat.Count, "    caption=" & Chr(34) & "no" & Chr(34) & ""
 oBarCat.Add oBarCat.Count, "    BORDER=" & Chr(34) & "no" & Chr(34) & ""
 oBarCat.Add oBarCat.Count, "    BORDERSTYLE=" & Chr(34) & "normal" & Chr(34) & ""
 oBarCat.Add oBarCat.Count, "    MAXIMIZEBUTTON=" & Chr(34) & "no" & Chr(34) & ""
 oBarCat.Add oBarCat.Count, "    MINIMIZEBUTTON=" & Chr(34) & "yes" & Chr(34) & ""
 oBarCat.Add oBarCat.Count, "    SYSMENU=" & Chr(34) & "no" & Chr(34) & ""
 oBarCat.Add oBarCat.Count, "    CONTEXTMENU=" & Chr(34) & "NO" & Chr(34) & ""
 oBarCat.Add oBarCat.Count, "    WINDOWSTATE=" & Chr(34) & "normal" & Chr(34) & ""
 oBarCat.Add oBarCat.Count, "    ShowInTaskBar=" & Chr(34) & "no" & Chr(34) & ""
 oBarCat.Add oBarCat.Count, "    />"
 oBarCat.Add oBarCat.Count, "<SCRIPT Language=" & Chr(34) & "VBScript" & Chr(34) & ">"
 oBarCat.Add oBarCat.Count, "Set oShell = CreateObject(" & Chr(34) & "Wscript.Shell" & Chr(34) & ")"
 oBarCat.Add oBarCat.Count, "Set oFSO = CreateObject(" & Chr(34) & "Scripting.FileSystemObject" & Chr(34) & ")"
 oBarCat.Add oBarCat.Count, "Dim strTimer, strTimerCnt, sPID, iCID, sStatusMsg"
 oBarCat.Add oBarCat.Count, "sPID = " & Chr(34) & "" & Chr(34) & ""
 oBarCat.Add oBarCat.Count, "iCID = 10"
 oBarCat.Add oBarCat.Count, " Sub Window_Onload"
 oBarCat.Add oBarCat.Count, " window.resizeTo 320,250"
 oBarCat.Add oBarCat.Count, " Stats " & Chr(34) & "Init" & Chr(34) & ""
 oBarCat.Add oBarCat.Count, " document.title = document.title"
 oBarCat.Add oBarCat.Count, " oFSO.CreateTextFile(" & Chr(34) & sProgressBarRunFile & Chr(34) & ")"
 oBarCat.Add oBarCat.Count, " oFSO.CreateTextFile(" & Chr(34) & sProgressBarSleepFile & Chr(34) & ")"
 oBarCat.Add oBarCat.Count, " Set oVBS = oFSO.OpenTextFile(" & Chr(34) & sProgressBarSleepFile & Chr(34) & ",2)"
 oBarCat.Add oBarCat.Count, " oVBS.WriteLine " & Chr(34) & "WScript.Sleep(1000)" & Chr(34) & ""
 oBarCat.Add oBarCat.Count, " oVBS.Close"
 oBarCat.Add oBarCat.Count, "Dim oWMIService, cItems, oItem"
 oBarCat.Add oBarCat.Count, "Set oWMIService = GetObject(" & Chr(34) & "winmgmts:\\.\root\CIMV2" & Chr(34) & ")"
 oBarCat.Add oBarCat.Count, "Set cItems = oWMIService.ExecQuery(" & Chr(34) & "SELECT Name, ExecutablePath FROM Win32_Process where Name = 'mshta.exe'" & Chr(34) & ")"
 oBarCat.Add oBarCat.Count, "For Each oItem in cItems"
 oBarCat.Add oBarCat.Count, " sPID = oItem.Handle"
 oBarCat.Add oBarCat.Count, "Next"
 oBarCat.Add oBarCat.Count, " Do While oFSO.FileExists(" & Chr(34) & sProgressBarRunFile & Chr(34) & ")"
 oBarCat.Add oBarCat.Count, "  oShell.Run " & Chr(34) & sProgressBarSleepFile & Chr(34) & ",0,True"
 oBarCat.Add oBarCat.Count, "      oShell.AppActivate sPID"
 oBarCat.Add oBarCat.Count, " Loop "
 oBarCat.Add oBarCat.Count, " oFSO.DeleteFile " & Chr(34) & sProgressBarSleepFile & Chr(34) & ", True "
 oBarCat.Add oBarCat.Count, " Stats " & Chr(34) & "End" & Chr(34) & ""
 oBarCat.Add oBarCat.Count, " window.Close"
 oBarCat.Add oBarCat.Count, " End Sub"
 oBarCat.Add oBarCat.Count, " Sub Stats(strStatus)"
 oBarCat.Add oBarCat.Count, " If strStatus = " & Chr(34) & "Init" & Chr(34) & " Then"
 oBarCat.Add oBarCat.Count, "   strTimer = window.setInterval(" & Chr(34) & "Stats('Run')" & Chr(34) & ", 175)"
 oBarCat.Add oBarCat.Count, " Elseif strStatus = " & Chr(34) & "Run" & Chr(34) & " Then"
 oBarCat.Add oBarCat.Count, "Select Case iCID"
 oBarCat.Add oBarCat.Count, "    Case 10"
 oBarCat.Add oBarCat.Count, "       strTimerCnt =" & Chr(34) & "ooooo" & Chr(34) & ""
 oBarCat.Add oBarCat.Count, "       oShell.AppActivate sPID"
 oBarCat.Add oBarCat.Count, "   iCID = 0"
 oBarCat.Add oBarCat.Count, "    Case 0"
 oBarCat.Add oBarCat.Count, "      strTimerCnt =  " & Chr(34) & "oooon" & Chr(34) & ""
 oBarCat.Add oBarCat.Count, "       oShell.AppActivate sPID"
 oBarCat.Add oBarCat.Count, "   iCID = 1"
 oBarCat.Add oBarCat.Count, "    Case 1"
 oBarCat.Add oBarCat.Count, "      strTimerCnt =  " & Chr(34) & "ooono" & Chr(34) & ""
 oBarCat.Add oBarCat.Count, "       oShell.AppActivate sPID"
 oBarCat.Add oBarCat.Count, "   iCID = 2"
 oBarCat.Add oBarCat.Count, "    Case 2"
 oBarCat.Add oBarCat.Count, "      strTimerCnt =  " & Chr(34) & "oonoo" & Chr(34) & ""
 oBarCat.Add oBarCat.Count, "       oShell.AppActivate sPID"
 oBarCat.Add oBarCat.Count, "   iCID = 3"
 oBarCat.Add oBarCat.Count, "    Case 3"
 oBarCat.Add oBarCat.Count, "      strTimerCnt =  " & Chr(34) & "onooo" & Chr(34) & ""
 oBarCat.Add oBarCat.Count, "       oShell.AppActivate sPID"
 oBarCat.Add oBarCat.Count, "   iCID = 4"
 oBarCat.Add oBarCat.Count, "    Case 4"
 oBarCat.Add oBarCat.Count, "      strTimerCnt =  " & Chr(34) & "noooo" & Chr(34) & ""
 oBarCat.Add oBarCat.Count, "       oShell.AppActivate sPID"
 oBarCat.Add oBarCat.Count, "   iCID = 5"
 oBarCat.Add oBarCat.Count, "    Case 5"
 oBarCat.Add oBarCat.Count, "      strTimerCnt =  " & Chr(34) & "onooo" & Chr(34) & ""
 oBarCat.Add oBarCat.Count, "       oShell.AppActivate sPID"
 oBarCat.Add oBarCat.Count, "   iCID = 6"
 oBarCat.Add oBarCat.Count, "    Case 6"
 oBarCat.Add oBarCat.Count, "      strTimerCnt =  " & Chr(34) & "oonoo" & Chr(34) & ""
 oBarCat.Add oBarCat.Count, "       oShell.AppActivate sPID"
 oBarCat.Add oBarCat.Count, "   iCID = 7"
 oBarCat.Add oBarCat.Count, "    Case 7"
 oBarCat.Add oBarCat.Count, "      strTimerCnt =  " & Chr(34) & "ooono" & Chr(34) & ""
 oBarCat.Add oBarCat.Count, "       oShell.AppActivate sPID"
 oBarCat.Add oBarCat.Count, "   iCID = 8"
 oBarCat.Add oBarCat.Count, "    Case 8"
 oBarCat.Add oBarCat.Count, "      strTimerCnt =  " & Chr(34) & "oooon" & Chr(34) & ""
 oBarCat.Add oBarCat.Count, "       oShell.AppActivate sPID"
 oBarCat.Add oBarCat.Count, "   iCID = 1"
 oBarCat.Add oBarCat.Count, "   End Select "
 oBarCat.Add oBarCat.Count, "   document.getElementById(" & Chr(34) & "Stats" & Chr(34) & ").innerHTML = strTimerCnt"
 oBarCat.Add oBarCat.Count, "  On Error Resume Next"
 oBarCat.Add oBarCat.Count, "  oShell.RegRead(" & Chr(34) & "HKLM\SYSTEM\ProgressBar\MSG" & Chr(34) & ")"
 oBarCat.Add oBarCat.Count, "    iRegErr = Err.Number"
 oBarCat.Add oBarCat.Count, "    On Error Goto 0"
 oBarCat.Add oBarCat.Count, "    if iRegErr = 0 then"
 oBarCat.Add oBarCat.Count, "     sStatusMsg = oShell.RegRead(" & Chr(34) & "HKLM\SYSTEM\ProgressBar\MSG" & Chr(34) & ")" 
 oBarCat.Add oBarCat.Count, "    else"
 oBarCat.Add oBarCat.Count, "     sStatusMsg = " & Chr(34) & "" & Chr(34) & ""
 oBarCat.Add oBarCat.Count, "    End if"
 oBarCat.Add oBarCat.Count, "     If Trim(sStatusMsg) <> " & Chr(34) & "" & Chr(34) & " Then "
 oBarCat.Add oBarCat.Count, "      sStatusMsg = Replace(sStatusMsg, VbCrLf, " & Chr(34) & "<br>" & Chr(34) & ")"
 oBarCat.Add oBarCat.Count, "     Else"
 oBarCat.Add oBarCat.Count, "      sStatusMsg = " & Chr(34) & "" & Chr(34) & ""
 oBarCat.Add oBarCat.Count, "  End If "
 oBarCat.Add oBarCat.Count, "   document.getElementById(" & Chr(34) & "MyMsg" & Chr(34) & ").innerHTML = sStatusMsg"
 oBarCat.Add oBarCat.Count, " Elseif strStatus = " & Chr(34) & "End" & Chr(34) & " Then"
 oBarCat.Add oBarCat.Count, "   window.clearInterval(strTimer)"
 oBarCat.Add oBarCat.Count, "   document.getElementById(" & Chr(34) & "Stats" & Chr(34) & ").innerHTML = " & Chr(34) & "" & Chr(34) & ""
 oBarCat.Add oBarCat.Count, " End If"
 oBarCat.Add oBarCat.Count, " End Sub"
 oBarCat.Add oBarCat.Count, "</SCRIPT>"
 oBarCat.Add oBarCat.Count, "<style>"
 oBarCat.Add oBarCat.Count, "body,td,a {font-family:Arial;font-size:12px;text-decoration:none;color:black;}"
 oBarCat.Add oBarCat.Count, "body {filter:progid:DXImageTransform.Microsoft.Gradient(GradientType=0, StartColorStr='#9999FF', EndColorStr='#FFFFFF')}"
 oBarCat.Add oBarCat.Count, ".pix {width: 1px; height 1px;}"
 oBarCat.Add oBarCat.Count, "</style>"
 oBarCat.Add oBarCat.Count, "</head>"
 oBarCat.Add oBarCat.Count, "<body>"
 oBarCat.Add oBarCat.Count, "<center>"
 oBarCat.Add oBarCat.Count, "<table width=" & Chr(34) & "275" & Chr(34) & ">"
 oBarCat.Add oBarCat.Count, " <tr><td>"
 oBarCat.Add oBarCat.Count, "   <fieldset><legend align=" & Chr(34) & "center" & Chr(34) & "><b> VPN Login in Progress </b></legend>"
 oBarCat.Add oBarCat.Count, "     <br><center>"
 oBarCat.Add oBarCat.Count, "       <span id=Stats style=" & Chr(34) & "font-family: wingdings;font-weight: bold;font-size:20px;" & Chr(34) & "></span>"
 oBarCat.Add oBarCat.Count, "     </center><br><br>"
 oBarCat.Add oBarCat.Count, "   </fieldset>"
 oBarCat.Add oBarCat.Count, " </td></tr>"
 oBarCat.Add oBarCat.Count, "</table>"
 oBarCat.Add oBarCat.Count, "<span id=MyMsg style=" & Chr(34) & "font-family: Ariel;font-size:12px;" & Chr(34) & "></span>"
 oBarCat.Add oBarCat.Count, "</body>"
 oBarCat.Add oBarCat.Count, "</html>"
 subWriteFile sProgressBarHTAFile, Join(oBarCat.Items,VbCrLf)
 oShell.RegWrite "HKLM\SYSTEM\ProgressBar\MSG", sMessageToDisplay, "REG_SZ"
 oShell.Run sProgressBarHTAFile, 1, False 
 End Sub
 Public Sub CloseBar()
 fKillFile sProgressBarRunFile
 Dim sProgressBarHTAFileKiller
 subKillRegKey "HKLM\SYSTEM\ProgressBar","DELETE"
 sProgressBarHTAFileKiller = "c:\temp\htakiller.vbs"
 subWriteFile sProgressBarHTAFileKiller, "On Error Resume Next"
 subWriteFile sProgressBarHTAFileKiller, "wscript.sleep(10000)"
 subWriteFile sProgressBarHTAFileKiller, "Set oFSO = CreateObject(""Scripting.FileSystemObject"")"
 subWriteFile sProgressBarHTAFileKiller, "oFSO.DeleteFile " & Chr(34) & sProgressBarHTAFile & Chr(34) & ", True"
 subWriteFile sProgressBarHTAFileKiller, "oFSO.DeleteFile " & Chr(34) & sProgressBarHTAFileKiller & Chr(34) & ", True"
 oShell.Run sProgressBarHTAFileKiller, 0, False 
 End Sub
 Public Sub SetLine(sNewText)
 oShell.RegWrite "HKLM\SYSTEM\ProgressBar\MSG", sNewText, "REG_SZ"
 End Sub
 Private Function fGetTempName()
 Dim iFilenameCharacters, iHighestASCiiValue, iLowestASCiiValue
 Dim iCharASCiiValue, sTmpFileName, oTempNameDic
 Set oTempNameDic = CreateObject("Scripting.Dictionary")
 iFilenameCharacters = 8
 iHighestASCiiValue = 126
 iLowestASCiiValue = 46
 sTmpFileName = ""
 Randomize
 Do
   iCharASCiiValue = Int(((iHighestASCiiValue - iLowestASCiiValue + 1) * Rnd) + iLowestASCiiValue)   
    Select Case True
     Case iCharASCiiValue = 47
     Case iCharASCiiValue > 57 And iCharASCiiValue < 95
     Case iCharASCiiValue = 96
     Case iCharASCiiValue > 122 And iCharASCiiValue < 126
     Case Else
      oTempNameDic.Add oTempNameDic.Count,Chr(iCharASCiiValue)
    End Select
 Loop While oTempNameDic.Count < iFilenameCharacters
 fGetTempName = oEnv("TEMP") & "\" & Join(oTempNameDic.Items,"") & ".tmp"
 oTempNameDic.RemoveAll
 End Function
 Private Function fKillFile(sFileToKill)
 Dim iErr, sErr
 Select Case True
 Case InStr(sFileToKill, "*") <> 0
 If oFSO.FolderExists(oFSO.GetParentFolderName(sFileToKill)) Then 
 On Error Resume Next 
   oFSO.DeleteFile sFileToKill, True 
   iErr = Err.Number
   sErr = Err.Description
 On Error GoTo 0 
   If iErr = 53 Then iErr = 0
 End If 
 Case oFSO.FileExists(sFileToKill)
 
 On Error Resume Next 
 oFSO.DeleteFile sFileToKill, True 
 iErr = Err.Number
 sErr = Err.Description
 On Error GoTo 0
 End Select
 Select Case iErr
 Case 0
 fKillFile = 0
 Case Else
 fKillFile = sErr
 End Select 
 End Function
 Private Sub subWriteFile(sFileToWrite, sTextToWrite)
 Dim oFileToWrite
 subCreateFile sFileToWrite
 Set oFileToWrite = oFSO.OpenTextFile(sFileToWrite,8)
 oFileToWrite.WriteLine sTextToWrite
 oFileToWrite.Close
 End Sub
 Private Sub subCreateFile(sFileToCreate)
 subCreateFolder oFSO.GetParentFolderName(sFileToCreate)
 If Not oFSO.FileExists(sFileToCreate) Then oFSO.CreateTextFile(sFileToCreate)
 End Sub 
 Private Sub subCreateFolder(sFolderPathToCreate)
 If Trim(sFolderPathToCreate) <> "" Then 
 If oFSO.FolderExists(sFolderPathToCreate) Then
 Exit Sub
 Else
 subCreateFolder(oFSO.GetParentFolderName(sFolderPathToCreate))
 End If
 oFSO.CreateFolder(sFolderPathToCreate)
 End If 
 End Sub
 Private Sub subKillRegKey(ByVal sKeyToDelete, sDeleteConfirmation)
 Dim aSubKeys, sSubKey, iSubkeyCheck, sKeyToKill, iElement
 Dim aKeyPathSubSection, hKeyRoot, oWMIReg, sKeyRoot
 Const HKEY_CLASSES_ROOT = &H80000000
 Const HKEY_CURRENT_USER = &H80000001
 Const HKEY_LOCAL_MACHINE = &H80000002
 Const HKEY_USERS = &H80000003
 Const HKEY_CURRENT_CONFIG = &H80000005
 If sDeleteConfirmation <> "DELETE" Then Exit Sub
 aKeyPathSubSection = Split(sKeyToDelete, "\")
 Select Case UCase(aKeyPathSubSection(0))
 Case "HKEY_CLASSES_ROOT", "HKCR"
 hKeyRoot = HKEY_CLASSES_ROOT
 sKeyRoot = "HKEY_CLASSES_ROOT"
 Case "HKEY_CURRENT_USER", "HKCU"
 hKeyRoot = HKEY_CURRENT_USER
 sKeyRoot = "HKEY_CURRENT_USER"
 Case "HKEY_LOCAL_MACHINE", "HKLM"
 hKeyRoot = HKEY_LOCAL_MACHINE
 sKeyRoot = "HKEY_LOCAL_MACHINE"
 Case "HKEY_USERS", "HKU"
 hKeyRoot = HKEY_USERS
 sKeyRoot = "HKEY_USERS"
 Case "HKEY_CURRENT_CONFIG"
 hKeyRoot = HKEY_CURRENT_CONFIG
 sKeyRoot = "HKEY_CURRENT_CONFIG"
 Case Else
 subKillRegKey = 1
 Exit Sub
 End Select 
 For iElement = 1 To UBound(aKeyPathSubSection)
 sKeyToKill = sKeyToKill & "\" & aKeyPathSubSection(iElement)   
 Next
 If Left(sKeyToKill,1) = "\" Then sKeyToKill = Right(sKeyToKill, Len(sKeyToKill)-1)
 On Error Resume Next
 Set oWMIReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv")
 iSubkeyCheck = oWMIReg.EnumKey(hKeyRoot, sKeyToKill, aSubKeys)
 If iSubkeyCheck = 0 And IsArray(aSubKeys) Then
 For Each sSubKey In aSubKeys
 If Err.Number <> 0 Then
   Err.Clear
   Exit Sub
 End If
 subKillRegKey sKeyRoot & "\" & sKeyToKill & "\" & sSubKey, "DELETE"
 Next
 End If
 oWMIReg.DeleteKey hKeyRoot, sKeyToKill
 End Sub
 End Class
 

 
Also, I hae been unable to identify where to change the value that forces the status box on top of everything.Any advice would be useful...
 
Regards,
<message edited by alienprotein on Friday, August 04, 2006 10:06 AM>
#21
    DiGiTAL.SkReAM

    • Total Posts : 1259
    • Scores: 7
    • Reward points : 0
    • Joined: 9/7/2005
    • Location: Clearwater, FL, USA
    • Status: offline
    RE: Dynamic Activity Window Friday, August 04, 2006 10:19 AM (permalink)
    0
    Thanks for the tip!  I decided to do some testing, so...
    Created a new winxp virtual machine in vmware server.
    Created a new user called User.  Member of users group only.
    Opened Regedit and verified that the user was able to modify/add/subtract from HKCU, and that HKLM was refused.  User had read only access to HKLM.
    Ran your script that you posted, it bombed with the same error you reported.
    I changed the HKLM's to HKCU, and ran it again.
    It worked as advertised.

    Are you running some GPOs that I don't know about, or possibly have some default security settings that prevent this behavior?  because everything that i ahve seen and read on the subject suggests that a normal - NON privileged user has change access to HKCU.

    Here is the code that ran fine for me:
    You will notice that I commented out your commands in the very beginning, and that I changed HKLM to HKCU except for inside of the Subroutine 'subKillRegKey'.  I had to leave that one so that HKLM nicknames would be recognized.

     'Option Explicit 
     Dim StrPath
     Dim WshShell
     Dim oBar
     Set oBar = New ProgressBar
     Set WshShell = WScript.CreateObject("WScript.Shell")
     oBar.StartBar "Please wait while network drives are mapped."
     WScript.Sleep (8000)
     '[color=#ff0000]WshShell.Run("C:\temp\test.vbs")[/color]
     '[color=#ff0000]ReturnCode = WshShell.Run("C:\temp\test.vbs", 1, True)[/color]
     oBar.SetLine "Drive mapping completed......"
     WScript.Sleep (6000)
     oBar.CloseBar
     '*************************************************************************************
     Class ProgressBar
     Dim oBarCat, sProgressBarHTAFile, sProgressBarRunFile, sProgressBarSleepFile
     Public Sub StartBar(sMessageToDisplay)
     Dim sInitialTemp
     ExecuteGlobal "Dim oShell, oFSO, oEnv"
     Set oShell = CreateObject("Wscript.Shell")
     Set oFSO = CreateObject("Scripting.FileSystemObject")
     Set oEnv = oShell.Environment("Process")
     sInitialTemp = fGetTempName
     sProgressBarHTAFile = Left(sInitialTemp,(Len(sInitialTemp)-4)) & ".hta"
     sProgressBarRunFile = Left(sProgressBarHTAFile, Len(sProgressBarHTAFile)-4) & ".run"
     sProgressBarSleepFile = Left(sProgressBarHTAFile, Len(sProgressBarHTAFile)-4) & "sleep.vbs"
     Set oBarCat = CreateObject("Scripting.Dictionary")
     oBarCat.Add oBarCat.Count, "<html>"
     oBarCat.Add oBarCat.Count, "<head>"
     oBarCat.Add oBarCat.Count, "<title id=" & Chr(34) & "title" & Chr(34) & ">W&K VPN Login</title>"
     oBarCat.Add oBarCat.Count, "<HTA:APPLICATION "
     oBarCat.Add oBarCat.Count, "    ID=" & Chr(34) & "StatusBar" & Chr(34) & ""
     oBarCat.Add oBarCat.Count, "    APPLICATIONNAME=" & Chr(34) & "StatusBar" & Chr(34) & ""
     oBarCat.Add oBarCat.Count, "    SCROLL=" & Chr(34) & "no" & Chr(34) & ""
     oBarCat.Add oBarCat.Count, "    SINGLEINSTANCE=" & Chr(34) & "yes" & Chr(34) & ""
     oBarCat.Add oBarCat.Count, "    caption=" & Chr(34) & "no" & Chr(34) & ""
     oBarCat.Add oBarCat.Count, "    BORDER=" & Chr(34) & "no" & Chr(34) & ""
     oBarCat.Add oBarCat.Count, "    BORDERSTYLE=" & Chr(34) & "normal" & Chr(34) & ""
     oBarCat.Add oBarCat.Count, "    MAXIMIZEBUTTON=" & Chr(34) & "no" & Chr(34) & ""
     oBarCat.Add oBarCat.Count, "    MINIMIZEBUTTON=" & Chr(34) & "yes" & Chr(34) & ""
     oBarCat.Add oBarCat.Count, "    SYSMENU=" & Chr(34) & "no" & Chr(34) & ""
     oBarCat.Add oBarCat.Count, "    CONTEXTMENU=" & Chr(34) & "NO" & Chr(34) & ""
     oBarCat.Add oBarCat.Count, "    WINDOWSTATE=" & Chr(34) & "normal" & Chr(34) & ""
     oBarCat.Add oBarCat.Count, "    ShowInTaskBar=" & Chr(34) & "no" & Chr(34) & ""
     oBarCat.Add oBarCat.Count, "    />"
     oBarCat.Add oBarCat.Count, "<SCRIPT Language=" & Chr(34) & "VBScript" & Chr(34) & ">"
     oBarCat.Add oBarCat.Count, "Set oShell = CreateObject(" & Chr(34) & "Wscript.Shell" & Chr(34) & ")"
     oBarCat.Add oBarCat.Count, "Set oFSO = CreateObject(" & Chr(34) & "Scripting.FileSystemObject" & Chr(34) & ")"
     oBarCat.Add oBarCat.Count, "Dim strTimer, strTimerCnt, sPID, iCID, sStatusMsg"
     oBarCat.Add oBarCat.Count, "sPID = " & Chr(34) & "" & Chr(34) & ""
     oBarCat.Add oBarCat.Count, "iCID = 10"
     oBarCat.Add oBarCat.Count, " Sub Window_Onload"
     oBarCat.Add oBarCat.Count, " window.resizeTo 320,250"
     oBarCat.Add oBarCat.Count, " Stats " & Chr(34) & "Init" & Chr(34) & ""
     oBarCat.Add oBarCat.Count, " document.title = document.title"
     oBarCat.Add oBarCat.Count, " oFSO.CreateTextFile(" & Chr(34) & sProgressBarRunFile & Chr(34) & ")"
     oBarCat.Add oBarCat.Count, " oFSO.CreateTextFile(" & Chr(34) & sProgressBarSleepFile & Chr(34) & ")"
     oBarCat.Add oBarCat.Count, " Set oVBS = oFSO.OpenTextFile(" & Chr(34) & sProgressBarSleepFile & Chr(34) & ",2)"
     oBarCat.Add oBarCat.Count, " oVBS.WriteLine " & Chr(34) & "WScript.Sleep(1000)" & Chr(34) & ""
     oBarCat.Add oBarCat.Count, " oVBS.Close"
     oBarCat.Add oBarCat.Count, "Dim oWMIService, cItems, oItem"
     oBarCat.Add oBarCat.Count, "Set oWMIService = GetObject(" & Chr(34) & "winmgmts:\\.\root\CIMV2" & Chr(34) & ")"
     oBarCat.Add oBarCat.Count, "Set cItems = oWMIService.ExecQuery(" & Chr(34) & "SELECT Name, ExecutablePath FROM Win32_Process where Name = 'mshta.exe'" & Chr(34) & ")"
     oBarCat.Add oBarCat.Count, "For Each oItem in cItems"
     oBarCat.Add oBarCat.Count, " sPID = oItem.Handle"
     oBarCat.Add oBarCat.Count, "Next"
     oBarCat.Add oBarCat.Count, " Do While oFSO.FileExists(" & Chr(34) & sProgressBarRunFile & Chr(34) & ")"
     oBarCat.Add oBarCat.Count, "  oShell.Run " & Chr(34) & sProgressBarSleepFile & Chr(34) & ",0,True"
     oBarCat.Add oBarCat.Count, "      oShell.AppActivate sPID"
     oBarCat.Add oBarCat.Count, " Loop "
     oBarCat.Add oBarCat.Count, " oFSO.DeleteFile " & Chr(34) & sProgressBarSleepFile & Chr(34) & ", True "
     oBarCat.Add oBarCat.Count, " Stats " & Chr(34) & "End" & Chr(34) & ""
     oBarCat.Add oBarCat.Count, " window.Close"
     oBarCat.Add oBarCat.Count, " End Sub"
     oBarCat.Add oBarCat.Count, " Sub Stats(strStatus)"
     oBarCat.Add oBarCat.Count, " If strStatus = " & Chr(34) & "Init" & Chr(34) & " Then"
     oBarCat.Add oBarCat.Count, "   strTimer = window.setInterval(" & Chr(34) & "Stats('Run')" & Chr(34) & ", 175)"
     oBarCat.Add oBarCat.Count, " Elseif strStatus = " & Chr(34) & "Run" & Chr(34) & " Then"
     oBarCat.Add oBarCat.Count, "Select Case iCID"
     oBarCat.Add oBarCat.Count, "    Case 10"
     oBarCat.Add oBarCat.Count, "       strTimerCnt =" & Chr(34) & "ooooo" & Chr(34) & ""
     oBarCat.Add oBarCat.Count, "       oShell.AppActivate sPID"
     oBarCat.Add oBarCat.Count, "   iCID = 0"
     oBarCat.Add oBarCat.Count, "    Case 0"
     oBarCat.Add oBarCat.Count, "      strTimerCnt =  " & Chr(34) & "oooon" & Chr(34) & ""
     oBarCat.Add oBarCat.Count, "       oShell.AppActivate sPID"
     oBarCat.Add oBarCat.Count, "   iCID = 1"
     oBarCat.Add oBarCat.Count, "    Case 1"
     oBarCat.Add oBarCat.Count, "      strTimerCnt =  " & Chr(34) & "ooono" & Chr(34) & ""
     oBarCat.Add oBarCat.Count, "       oShell.AppActivate sPID"
     oBarCat.Add oBarCat.Count, "   iCID = 2"
     oBarCat.Add oBarCat.Count, "    Case 2"
     oBarCat.Add oBarCat.Count, "      strTimerCnt =  " & Chr(34) & "oonoo" & Chr(34) & ""
     oBarCat.Add oBarCat.Count, "       oShell.AppActivate sPID"
     oBarCat.Add oBarCat.Count, "   iCID = 3"
     oBarCat.Add oBarCat.Count, "    Case 3"
     oBarCat.Add oBarCat.Count, "      strTimerCnt =  " & Chr(34) & "onooo" & Chr(34) & ""
     oBarCat.Add oBarCat.Count, "       oShell.AppActivate sPID"
     oBarCat.Add oBarCat.Count, "   iCID = 4"
     oBarCat.Add oBarCat.Count, "    Case 4"
     oBarCat.Add oBarCat.Count, "      strTimerCnt =  " & Chr(34) & "noooo" & Chr(34) & ""
     oBarCat.Add oBarCat.Count, "       oShell.AppActivate sPID"
     oBarCat.Add oBarCat.Count, "   iCID = 5"
     oBarCat.Add oBarCat.Count, "    Case 5"
     oBarCat.Add oBarCat.Count, "      strTimerCnt =  " & Chr(34) & "onooo" & Chr(34) & ""
     oBarCat.Add oBarCat.Count, "       oShell.AppActivate sPID"
     oBarCat.Add oBarCat.Count, "   iCID = 6"
     oBarCat.Add oBarCat.Count, "    Case 6"
     oBarCat.Add oBarCat.Count, "      strTimerCnt =  " & Chr(34) & "oonoo" & Chr(34) & ""
     oBarCat.Add oBarCat.Count, "       oShell.AppActivate sPID"
     oBarCat.Add oBarCat.Count, "   iCID = 7"
     oBarCat.Add oBarCat.Count, "    Case 7"
     oBarCat.Add oBarCat.Count, "      strTimerCnt =  " & Chr(34) & "ooono" & Chr(34) & ""
     oBarCat.Add oBarCat.Count, "       oShell.AppActivate sPID"
     oBarCat.Add oBarCat.Count, "   iCID = 8"
     oBarCat.Add oBarCat.Count, "    Case 8"
     oBarCat.Add oBarCat.Count, "      strTimerCnt =  " & Chr(34) & "oooon" & Chr(34) & ""
     oBarCat.Add oBarCat.Count, "       oShell.AppActivate sPID"
     oBarCat.Add oBarCat.Count, "   iCID = 1"
     oBarCat.Add oBarCat.Count, "   End Select "
     oBarCat.Add oBarCat.Count, "   document.getElementById(" & Chr(34) & "Stats" & Chr(34) & ").innerHTML = strTimerCnt"
     oBarCat.Add oBarCat.Count, "  On Error Resume Next"
     oBarCat.Add oBarCat.Count, "  oShell.RegRead(" & Chr(34) & "HKCU\SYSTEM\ProgressBar\MSG" & Chr(34) & ")"
     oBarCat.Add oBarCat.Count, "    iRegErr = Err.Number"
     oBarCat.Add oBarCat.Count, "    On Error Goto 0"
     oBarCat.Add oBarCat.Count, "    if iRegErr = 0 then"
     oBarCat.Add oBarCat.Count, "     sStatusMsg = oShell.RegRead(" & Chr(34) & "HKCU\SYSTEM\ProgressBar\MSG" & Chr(34) & ")" 
     oBarCat.Add oBarCat.Count, "    else"
     oBarCat.Add oBarCat.Count, "     sStatusMsg = " & Chr(34) & "" & Chr(34) & ""
     oBarCat.Add oBarCat.Count, "    End if"
     oBarCat.Add oBarCat.Count, "     If Trim(sStatusMsg) <> " & Chr(34) & "" & Chr(34) & " Then "
     oBarCat.Add oBarCat.Count, "      sStatusMsg = Replace(sStatusMsg, VbCrLf, " & Chr(34) & "<br>" & Chr(34) & ")"
     oBarCat.Add oBarCat.Count, "     Else"
     oBarCat.Add oBarCat.Count, "      sStatusMsg = " & Chr(34) & "" & Chr(34) & ""
     oBarCat.Add oBarCat.Count, "  End If "
     oBarCat.Add oBarCat.Count, "   document.getElementById(" & Chr(34) & "MyMsg" & Chr(34) & ").innerHTML = sStatusMsg"
     oBarCat.Add oBarCat.Count, " Elseif strStatus = " & Chr(34) & "End" & Chr(34) & " Then"
     oBarCat.Add oBarCat.Count, "   window.clearInterval(strTimer)"
     oBarCat.Add oBarCat.Count, "   document.getElementById(" & Chr(34) & "Stats" & Chr(34) & ").innerHTML = " & Chr(34) & "" & Chr(34) & ""
     oBarCat.Add oBarCat.Count, " End If"
     oBarCat.Add oBarCat.Count, " End Sub"
     oBarCat.Add oBarCat.Count, "</SCRIPT>"
     oBarCat.Add oBarCat.Count, "<style>"
     oBarCat.Add oBarCat.Count, "body,td,a {font-family:Arial;font-size:12px;text-decoration:none;color:black;}"
     oBarCat.Add oBarCat.Count, "body {filter:progid:DXImageTransform.Microsoft.Gradient(GradientType=0, StartColorStr='#9999FF', EndColorStr='#FFFFFF')}"
     oBarCat.Add oBarCat.Count, ".pix {width: 1px; height 1px;}"
     oBarCat.Add oBarCat.Count, "</style>"
     oBarCat.Add oBarCat.Count, "</head>"
     oBarCat.Add oBarCat.Count, "<body>"
     oBarCat.Add oBarCat.Count, "<center>"
     oBarCat.Add oBarCat.Count, "<table width=" & Chr(34) & "275" & Chr(34) & ">"
     oBarCat.Add oBarCat.Count, " <tr><td>"
     oBarCat.Add oBarCat.Count, "   <fieldset><legend align=" & Chr(34) & "center" & Chr(34) & "><b> VPN Login in Progress </b></legend>"
     oBarCat.Add oBarCat.Count, "     <br><center>"
     oBarCat.Add oBarCat.Count, "       <span id=Stats style=" & Chr(34) & "font-family: wingdings;font-weight: bold;font-size:20px;" & Chr(34) & "></span>"
     oBarCat.Add oBarCat.Count, "     </center><br><br>"
     oBarCat.Add oBarCat.Count, "   </fieldset>"
     oBarCat.Add oBarCat.Count, " </td></tr>"
     oBarCat.Add oBarCat.Count, "</table>"
     oBarCat.Add oBarCat.Count, "<span id=MyMsg style=" & Chr(34) & "font-family: Ariel;font-size:12px;" & Chr(34) & "></span>"
     oBarCat.Add oBarCat.Count, "</body>"
     oBarCat.Add oBarCat.Count, "</html>"
     subWriteFile sProgressBarHTAFile, Join(oBarCat.Items,VbCrLf)
     oShell.RegWrite "HKCU\SYSTEM\ProgressBar\MSG", sMessageToDisplay, "REG_SZ"
     oShell.Run sProgressBarHTAFile, 1, False 
     End Sub
     Public Sub CloseBar()
     fKillFile sProgressBarRunFile
     Dim sProgressBarHTAFileKiller
     subKillRegKey "HKCU\SYSTEM\ProgressBar","DELETE"
     sProgressBarHTAFileKiller = "c:\temp\htakiller.vbs"
     subWriteFile sProgressBarHTAFileKiller, "On Error Resume Next"
     subWriteFile sProgressBarHTAFileKiller, "wscript.sleep(10000)"
     subWriteFile sProgressBarHTAFileKiller, "Set oFSO = CreateObject(""Scripting.FileSystemObject"")"
     subWriteFile sProgressBarHTAFileKiller, "oFSO.DeleteFile " & Chr(34) & sProgressBarHTAFile & Chr(34) & ", True"
     subWriteFile sProgressBarHTAFileKiller, "oFSO.DeleteFile " & Chr(34) & sProgressBarHTAFileKiller & Chr(34) & ", True"
     oShell.Run sProgressBarHTAFileKiller, 0, False 
     End Sub
     Public Sub SetLine(sNewText)
     oShell.RegWrite "HKCU\SYSTEM\ProgressBar\MSG", sNewText, "REG_SZ"
     End Sub
     Private Function fGetTempName()
     Dim iFilenameCharacters, iHighestASCiiValue, iLowestASCiiValue
     Dim iCharASCiiValue, sTmpFileName, oTempNameDic
     Set oTempNameDic = CreateObject("Scripting.Dictionary")
     iFilenameCharacters = 8
     iHighestASCiiValue = 126
     iLowestASCiiValue = 46
     sTmpFileName = ""
     Randomize
     Do
     iCharASCiiValue = Int(((iHighestASCiiValue - iLowestASCiiValue + 1) * Rnd) + iLowestASCiiValue)   
       Select Case True
        Case iCharASCiiValue = 47
        Case iCharASCiiValue > 57 And iCharASCiiValue < 95
        Case iCharASCiiValue = 96
        Case iCharASCiiValue > 122 And iCharASCiiValue < 126
        Case Else
         oTempNameDic.Add oTempNameDic.Count,Chr(iCharASCiiValue)
       End Select
     Loop While oTempNameDic.Count < iFilenameCharacters
     fGetTempName = oEnv("TEMP") & "\" & Join(oTempNameDic.Items,"") & ".tmp"
     oTempNameDic.RemoveAll
     End Function
     Private Function fKillFile(sFileToKill)
     Dim iErr, sErr
     Select Case True
     Case InStr(sFileToKill, "*") <> 0
     If oFSO.FolderExists(oFSO.GetParentFolderName(sFileToKill)) Then 
     On Error Resume Next 
     oFSO.DeleteFile sFileToKill, True 
     iErr = Err.Number
     sErr = Err.Description
     On Error GoTo 0 
     If iErr = 53 Then iErr = 0
     End If 
     Case oFSO.FileExists(sFileToKill)
     On Error Resume Next 
     oFSO.DeleteFile sFileToKill, True 
     iErr = Err.Number
     sErr = Err.Description
     On Error GoTo 0
     End Select
     Select Case iErr
     Case 0
     fKillFile = 0
     Case Else
     fKillFile = sErr
     End Select 
     End Function
     Private Sub subWriteFile(sFileToWrite, sTextToWrite)
     Dim oFileToWrite
     subCreateFile sFileToWrite
     Set oFileToWrite = oFSO.OpenTextFile(sFileToWrite,8)
     oFileToWrite.WriteLine sTextToWrite
     oFileToWrite.Close
     End Sub
     Private Sub subCreateFile(sFileToCreate)
     subCreateFolder oFSO.GetParentFolderName(sFileToCreate)
     If Not oFSO.FileExists(sFileToCreate) Then oFSO.CreateTextFile(sFileToCreate)
     End Sub 
     Private Sub subCreateFolder(sFolderPathToCreate)
     If Trim(sFolderPathToCreate) <> "" Then 
     If oFSO.FolderExists(sFolderPathToCreate) Then
     Exit Sub
     Else
     subCreateFolder(oFSO.GetParentFolderName(sFolderPathToCreate))
     End If
     oFSO.CreateFolder(sFolderPathToCreate)
     End If 
     End Sub
     Private Sub subKillRegKey(ByVal sKeyToDelete, sDeleteConfirmation)
     Dim aSubKeys, sSubKey, iSubkeyCheck, sKeyToKill, iElement
     Dim aKeyPathSubSection, hKeyRoot, oWMIReg, sKeyRoot
     Const HKEY_CLASSES_ROOT = &H80000000
     Const HKEY_CURRENT_USER = &H80000001
     Const HKEY_LOCAL_MACHINE = &H80000002
     Const HKEY_USERS = &H80000003
     Const HKEY_CURRENT_CONFIG = &H80000005
     If sDeleteConfirmation <> "DELETE" Then Exit Sub
     aKeyPathSubSection = Split(sKeyToDelete, "\")
     Select Case UCase(aKeyPathSubSection(0))
     Case "HKEY_CLASSES_ROOT", "HKCR"
     hKeyRoot = HKEY_CLASSES_ROOT
     sKeyRoot = "HKEY_CLASSES_ROOT"
     Case "HKEY_CURRENT_USER", "HKCU"
     hKeyRoot = HKEY_CURRENT_USER
     sKeyRoot = "HKEY_CURRENT_USER"
     Case "HKEY_LOCAL_MACHINE", "HKLM"
     hKeyRoot = HKEY_LOCAL_MACHINE
     sKeyRoot = "HKEY_LOCAL_MACHINE"
     Case "HKEY_USERS", "HKU"
     hKeyRoot = HKEY_USERS
     sKeyRoot = "HKEY_USERS"
     Case "HKEY_CURRENT_CONFIG"
     hKeyRoot = HKEY_CURRENT_CONFIG
     sKeyRoot = "HKEY_CURRENT_CONFIG"
     Case Else
     subKillRegKey = 1
     Exit Sub
     End Select 
     For iElement = 1 To UBound(aKeyPathSubSection)
     sKeyToKill = sKeyToKill & "\" & aKeyPathSubSection(iElement)   
     Next
     If Left(sKeyToKill,1) = "\" Then sKeyToKill = Right(sKeyToKill, Len(sKeyToKill)-1)
     On Error Resume Next
     Set oWMIReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv")
     iSubkeyCheck = oWMIReg.EnumKey(hKeyRoot, sKeyToKill, aSubKeys)
     If iSubkeyCheck = 0 And IsArray(aSubKeys) Then
     For Each sSubKey In aSubKeys
     If Err.Number <> 0 Then
     Err.Clear
     Exit Sub
     End If
     subKillRegKey sKeyRoot & "\" & sKeyToKill & "\" & sSubKey, "DELETE"
     Next
     End If
     oWMIReg.DeleteKey hKeyRoot, sKeyToKill
     End Sub
     End Class
     

     
    Here is the answer to your second question:
     oBarCat.Add oBarCat.Count, "Dim oWMIService, cItems, oItem"
     oBarCat.Add oBarCat.Count, "Set oWMIService = GetObject(" & Chr(34) & "winmgmts:\\.\root\CIMV2" & Chr(34) & ")"
     oBarCat.Add oBarCat.Count, "Set cItems = oWMIService.ExecQuery(" & Chr(34) & "SELECT Name, ExecutablePath FROM Win32_Process where Name = 'mshta.exe'" & Chr(34) & ")"
     oBarCat.Add oBarCat.Count, "For Each oItem in cItems"
     oBarCat.Add oBarCat.Count, " sPID = oItem.Handle"
     oBarCat.Add oBarCat.Count, "Next"
     oBarCat.Add oBarCat.Count, " Do While oFSO.FileExists(" & Chr(34) & sProgressBarRunFile & Chr(34) & ")"
     oBarCat.Add oBarCat.Count, "  oShell.Run " & Chr(34) & sProgressBarSleepFile & Chr(34) & ",0,True"
     oBarCat.Add oBarCat.Count, "      oShell.AppActivate sPID"
     oBarCat.Add oBarCat.Count, " Loop "
     

     
    It finds the PID of the mshta.exe that is running the progressbar hta file, and performs an appactivate on it.
    The sProgressbarSleepFile that is being run during every do...loop is my own way of doing a "sleep" function from an hta since you can't use 'wscript.sleep(2000)'.  Basically, it is a text file taht is created earlier in the script execution that contains the line:
    wscript.sleep(1000)
    This gets run giving me a nice sleep function.
    And then the appactivate forces focus to the hta progressbar.
    <message edited by DiGiTAL.SkReAM on Friday, August 04, 2006 10:29 AM>
    "Would you like to touch my monkey?" - Dieter (Mike Meyers)

    "It is better to die like a tiger, than to live like a pussy."
    -Master Wong, from Balls of Fury
    #22
      alienprotein

      • Total Posts : 50
      • Scores: 0
      • Reward points : 0
      • Joined: 2/23/2005
      • Location: USA
      • Status: offline
      RE: Dynamic Activity Window Monday, August 07, 2006 1:41 AM (permalink)
      0

      Are you running some GPOs that I don't know about, or possibly have some default security settings that prevent this behavior?  because everything that i ahve seen and read on the subject suggests that a normal - NON privileged user has change access to HKCU.

       
      You hit the nail right on the head Digital.Skream. Once I moved the test user account from the Test OU to the standard users OU, everything worked.
       
      Thanks again for this wonderful piece of code.
       

       
       

      #23
        stephen.wolfe

        • Total Posts : 117
        • Scores: 0
        • Reward points : 0
        • Joined: 8/9/2005
        • Location: Tampa, FL
        • Status: offline
        RE: Dynamic Activity Window Wednesday, August 30, 2006 5:11 AM (permalink)
        0
        I just found this code, looking for progressbar code I could shamelessly borrow ... <g>, anyway, I wanted to see what it did so I copied the code into a .vbs file, took the blank line above 'Option Explicit', ran it and got the following error:
         
        Script:     D:\$$Logon_Script\ProgressBar2.vbs
        Line:        3
        Char:      16
        Error:      Expected identifier
        Code:     800A03F2
        Source   Microsoft VBScript compilation error
         
        Here is the code I copied from the forum:
         
          
         Option Explicit
         Dim oBar
         Set oBar = New <span class="high">Progress</span>Bar
         oBar.StartBar "This is a test."
         WScript.Sleep (3000)
         oBar.SetLine "So is this."
         WScript.Sleep (3000)
         oBar.CloseBar
         
         Class <span class="high">Progress</span>Bar
         Dim oBarCat, sProgressBarHTAFile, sProgressBarRunFile, sProgressBarSleepFile
         Public Sub StartBar(sMessageToDisplay)
         Dim sInitialTemp
         ExecuteGlobal "Dim oShell, oFSO, oEnv"
         Set oShell = CreateObject("Wscript.Shell")
         Set oFSO = CreateObject("Scripting.FileSystemObject")
         Set oEnv = oShell.Environment("Process")
         sInitialTemp = fGetTempName
         sProgressBarHTAFile = Left(sInitialTemp,(Len(sInitialTemp)-4)) & ".hta"
         sProgressBarRunFile = Left(sProgressBarHTAFile, Len(sProgressBarHTAFile)-4) & ".run"
         sProgressBarSleepFile = Left(sProgressBarHTAFile, Len(sProgressBarHTAFile)-4) & "sleep.vbs"
         Set oBarCat = CreateObject("Scripting.Dictionary")
         oBarCat.Add oBarCat.Count, "<html>"
         oBarCat.Add oBarCat.Count, "<head>"
         oBarCat.Add oBarCat.Count, "<title id=" & Chr(34) & "title" & Chr(34) & ">Please Wait</title>"
         oBarCat.Add oBarCat.Count, "<HTA:APPLICATION "
         oBarCat.Add oBarCat.Count, "    ID=" & Chr(34) & "StatusBar" & Chr(34) & ""
         oBarCat.Add oBarCat.Count, "    APPLICATIONNAME=" & Chr(34) & "StatusBar" & Chr(34) & ""
         oBarCat.Add oBarCat.Count, "    SCROLL=" & Chr(34) & "no" & Chr(34) & ""
         oBarCat.Add oBarCat.Count, "    SINGLEINSTANCE=" & Chr(34) & "yes" & Chr(34) & ""
         oBarCat.Add oBarCat.Count, "    caption=" & Chr(34) & "no" & Chr(34) & ""
         oBarCat.Add oBarCat.Count, "    BORDER=" & Chr(34) & "no" & Chr(34) & ""
         oBarCat.Add oBarCat.Count, "    BORDERSTYLE=" & Chr(34) & "normal" & Chr(34) & ""
         oBarCat.Add oBarCat.Count, "    MAXIMIZEBUTTON=" & Chr(34) & "no" & Chr(34) & ""
         oBarCat.Add oBarCat.Count, "    MINIMIZEBUTTON=" & Chr(34) & "yes" & Chr(34) & ""
         oBarCat.Add oBarCat.Count, "    SYSMENU=" & Chr(34) & "no" & Chr(34) & ""
         oBarCat.Add oBarCat.Count, "    CONTEXTMENU=" & Chr(34) & "NO" & Chr(34) & ""
         oBarCat.Add oBarCat.Count, "    WINDOWSTATE=" & Chr(34) & "normal" & Chr(34) & ""
         oBarCat.Add oBarCat.Count, "    ShowInTaskBar=" & Chr(34) & "no" & Chr(34) & ""
         oBarCat.Add oBarCat.Count, "    />"
         oBarCat.Add oBarCat.Count, "<SCRIPT Language=" & Chr(34) & "VBScript" & Chr(34) & ">"
         oBarCat.Add oBarCat.Count, "Set oShell = CreateObject(" & Chr(34) & "Wscript.Shell" & Chr(34) & ")"
         oBarCat.Add oBarCat.Count, "Set oFSO = CreateObject(" & Chr(34) & "Scripting.FileSystemObject" & Chr(34) & ")"
         oBarCat.Add oBarCat.Count, "Dim strTimer, strTimerCnt, sPID, iCID, sStatusMsg"
         oBarCat.Add oBarCat.Count, "sPID = " & Chr(34) & "" & Chr(34) & ""
         oBarCat.Add oBarCat.Count, "iCID = 10"
         oBarCat.Add oBarCat.Count, " Sub Window_Onload"
         oBarCat.Add oBarCat.Count, " window.resizeTo 320,250"
         oBarCat.Add oBarCat.Count, " Stats " & Chr(34) & "Init" & Chr(34) & ""
         oBarCat.Add oBarCat.Count, " document.title = document.title"
         oBarCat.Add oBarCat.Count, " oFSO.CreateTextFile(" & Chr(34) & sProgressBarRunFile & Chr(34) & ")"
         oBarCat.Add oBarCat.Count, " oFSO.CreateTextFile(" & Chr(34) & sProgressBarSleepFile & Chr(34) & ")"
         oBarCat.Add oBarCat.Count, " Set oVBS = oFSO.OpenTextFile(" & Chr(34) & sProgressBarSleepFile & Chr(34) & ",2)"
         oBarCat.Add oBarCat.Count, " oVBS.WriteLine " & Chr(34) & "WScript.Sleep(1000)" & Chr(34) & ""
         oBarCat.Add oBarCat.Count, " oVBS.Close"
         oBarCat.Add oBarCat.Count, "Dim oWMIService, cItems, oItem"
         oBarCat.Add oBarCat.Count, "Set oWMIService = GetObject(" & Chr(34) & "winmgmts:\\.\root\CIMV2" & Chr(34) & ")"
         oBarCat.Add oBarCat.Count, "Set cItems = oWMIService.ExecQuery(" & Chr(34) & "SELECT Name, ExecutablePath FROM Win32_Process where Name = 'mshta.exe'" & Chr(34) & ")"
         oBarCat.Add oBarCat.Count, "For Each oItem in cItems"
         oBarCat.Add oBarCat.Count, " sPID = oItem.Handle"
         oBarCat.Add oBarCat.Count, "Next"
         oBarCat.Add oBarCat.Count, " Do While oFSO.FileExists(" & Chr(34) & sProgressBarRunFile & Chr(34) & ")"
         oBarCat.Add oBarCat.Count, "  oShell.Run " & Chr(34) & sProgressBarSleepFile & Chr(34) & ",0,True"
         oBarCat.Add oBarCat.Count, "      oShell.AppActivate sPID"
         oBarCat.Add oBarCat.Count, " Loop "
         oBarCat.Add oBarCat.Count, " oFSO.DeleteFile " & Chr(34) & sProgressBarSleepFile & Chr(34) & ", True "
         oBarCat.Add oBarCat.Count, " Stats " & Chr(34) & "End" & Chr(34) & ""
         oBarCat.Add oBarCat.Count, " window.Close"
         oBarCat.Add oBarCat.Count, " End Sub"
         oBarCat.Add oBarCat.Count, " Sub Stats(strStatus)"
         oBarCat.Add oBarCat.Count, " If strStatus = " & Chr(34) & "Init" & Chr(34) & " Then"
         oBarCat.Add oBarCat.Count, "   strTimer = window.setInterval(" & Chr(34) & "Stats('Run')" & Chr(34) & ", 175)"
         oBarCat.Add oBarCat.Count, " Elseif strStatus = " & Chr(34) & "Run" & Chr(34) & " Then"
         oBarCat.Add oBarCat.Count, "Select Case iCID"
         oBarCat.Add oBarCat.Count, "    Case 10"
         oBarCat.Add oBarCat.Count, "       strTimerCnt =" & Chr(34) & "ooooo" & Chr(34) & ""
         oBarCat.Add oBarCat.Count, "       oShell.AppActivate sPID"
         oBarCat.Add oBarCat.Count, "   iCID = 0"
         oBarCat.Add oBarCat.Count, "    Case 0"
         oBarCat.Add oBarCat.Count, "      strTimerCnt =  " & Chr(34) & "oooon" & Chr(34) & ""
         oBarCat.Add oBarCat.Count, "       oShell.AppActivate sPID"
         oBarCat.Add oBarCat.Count, "   iCID = 1"
         oBarCat.Add oBarCat.Count, "    Case 1"
         oBarCat.Add oBarCat.Count, "      strTimerCnt =  " & Chr(34) & "ooono" & Chr(34) & ""
         oBarCat.Add oBarCat.Count, "       oShell.AppActivate sPID"
         oBarCat.Add oBarCat.Count, "   iCID = 2"
         oBarCat.Add oBarCat.Count, "    Case 2"
         oBarCat.Add oBarCat.Count, "      strTimerCnt =  " & Chr(34) & "oonoo" & Chr(34) & ""
         oBarCat.Add oBarCat.Count, "       oShell.AppActivate sPID"
         oBarCat.Add oBarCat.Count, "   iCID = 3"
         oBarCat.Add oBarCat.Count, "    Case 3"
         oBarCat.Add oBarCat.Count, "      strTimerCnt =  " & Chr(34) & "onooo" & Chr(34) & ""
         oBarCat.Add oBarCat.Count, "       oShell.AppActivate sPID"
         oBarCat.Add oBarCat.Count, "   iCID = 4"
         oBarCat.Add oBarCat.Count, "    Case 4"
         oBarCat.Add oBarCat.Count, "      strTimerCnt =  " & Chr(34) & "noooo" & Chr(34) & ""
         oBarCat.Add oBarCat.Count, "       oShell.AppActivate sPID"
         oBarCat.Add oBarCat.Count, "   iCID = 5"
         oBarCat.Add oBarCat.Count, "    Case 5"
         oBarCat.Add oBarCat.Count, "      strTimerCnt =  " & Chr(34) & "onooo" & Chr(34) & ""
         oBarCat.Add oBarCat.Count, "       oShell.AppActivate sPID"
         oBarCat.Add oBarCat.Count, "   iCID = 6"
         oBarCat.Add oBarCat.Count, "    Case 6"
         oBarCat.Add oBarCat.Count, "      strTimerCnt =  " & Chr(34) & "oonoo" & Chr(34) & ""
         oBarCat.Add oBarCat.Count, "       oShell.AppActivate sPID"
         oBarCat.Add oBarCat.Count, "   iCID = 7"
         oBarCat.Add oBarCat.Count, "    Case 7"
         oBarCat.Add oBarCat.Count, "      strTimerCnt =  " & Chr(34) & "ooono" & Chr(34) & ""
         oBarCat.Add oBarCat.Count, "       oShell.AppActivate sPID"
         oBarCat.Add oBarCat.Count, "   iCID = 8"
         oBarCat.Add oBarCat.Count, "    Case 8"
         oBarCat.Add oBarCat.Count, "      strTimerCnt =  " & Chr(34) & "oooon" & Chr(34) & ""
         oBarCat.Add oBarCat.Count, "       oShell.AppActivate sPID"
         oBarCat.Add oBarCat.Count, "   iCID = 1"
         oBarCat.Add oBarCat.Count, "   End Select "
         oBarCat.Add oBarCat.Count, "   document.getElementById(" & Chr(34) & "Stats" & Chr(34) & ").innerHTML = strTimerCnt"
         oBarCat.Add oBarCat.Count, "  On Error Resume Next"
         oBarCat.Add oBarCat.Count, "  oShell.RegRead(" & Chr(34) & "HKLM\SYSTEM\<span class="high">Progress</span>Bar\MSG" & Chr(34) & ")"
         oBarCat.Add oBarCat.Count, "    iRegErr = Err.Number"
         oBarCat.Add oBarCat.Count, "    On Error Goto 0"
         oBarCat.Add oBarCat.Count, "    if iRegErr = 0 then"
         oBarCat.Add oBarCat.Count, "     sStatusMsg = oShell.RegRead(" & Chr(34) & "HKLM\SYSTEM\<span class="high">Progress</span>Bar\MSG" & Chr(34) & ")" 
         oBarCat.Add oBarCat.Count, "    else"
         oBarCat.Add oBarCat.Count, "     sStatusMsg = " & Chr(34) & "" & Chr(34) & ""
         oBarCat.Add oBarCat.Count, "    End if"
         oBarCat.Add oBarCat.Count, "     If Trim(sStatusMsg) <> " & Chr(34) & "" & Chr(34) & " Then "
         oBarCat.Add oBarCat.Count, "      sStatusMsg = Replace(sStatusMsg, VbCrLf, " & Chr(34) & "<br>" & Chr(34) & ")"
         oBarCat.Add oBarCat.Count, "     Else"
         oBarCat.Add oBarCat.Count, "      sStatusMsg = " & Chr(34) & "" & Chr(34) & ""
         oBarCat.Add oBarCat.Count, "  End If "
         oBarCat.Add oBarCat.Count, "   document.getElementById(" & Chr(34) & "MyMsg" & Chr(34) & ").innerHTML = sStatusMsg"
         oBarCat.Add oBarCat.Count, " Elseif strStatus = " & Chr(34) & "End" & Chr(34) & " Then"
         oBarCat.Add oBarCat.Count, "   window.clearInterval(strTimer)"
         oBarCat.Add oBarCat.Count, "   document.getElementById(" & Chr(34) & "Stats" & Chr(34) & ").innerHTML = " & Chr(34) & "" & Chr(34) & ""
         oBarCat.Add oBarCat.Count, " End If"
         oBarCat.Add oBarCat.Count, " End Sub"
         oBarCat.Add oBarCat.Count, "</SCRIPT>"
         oBarCat.Add oBarCat.Count, "<style>"
         oBarCat.Add oBarCat.Count, "body,td,a {font-family:Arial;font-size:12px;text-decoration:none;color:black;}"
         oBarCat.Add oBarCat.Count, "body {filter:progid:DXImageTransform.Microsoft.Gradient(GradientType=0, StartColorStr='#9999FF', EndColorStr='#FFFFFF')}"
         oBarCat.Add oBarCat.Count, ".pix {width: 1px; height 1px;}"
         oBarCat.Add oBarCat.Count, "</style>"
         oBarCat.Add oBarCat.Count, "</head>"
         oBarCat.Add oBarCat.Count, "<body>"
         oBarCat.Add oBarCat.Count, "<center>"
         oBarCat.Add oBarCat.Count, "<table width=" & Chr(34) & "275" & Chr(34) & ">"
         oBarCat.Add oBarCat.Count, " <tr><td>"
         oBarCat.Add oBarCat.Count, "   <fieldset><legend align=" & Chr(34) & "center" & Chr(34) & "><b> Please Be Patient </b></legend>"
         oBarCat.Add oBarCat.Count, "     <br><center>"
         oBarCat.Add oBarCat.Count, "       <span id=Stats style=" & Chr(34) & "font-family: wingdings;font-weight: bold;font-size:20px;" & Chr(34) & "></span>"
         oBarCat.Add oBarCat.Count, "     </center><br><br>"
         oBarCat.Add oBarCat.Count, "   </fieldset>"
         oBarCat.Add oBarCat.Count, " </td></tr>"
         oBarCat.Add oBarCat.Count, "</table>"
         oBarCat.Add oBarCat.Count, "<span id=MyMsg style=" & Chr(34) & "font-family: Ariel;font-size:12px;" & Chr(34) & "></span>"
         oBarCat.Add oBarCat.Count, "</body>"
         oBarCat.Add oBarCat.Count, "</html>"
         subWriteFile sProgressBarHTAFile, Join(oBarCat.Items,VbCrLf)
         oShell.RegWrite "HKLM\SYSTEM\<span class="high">Progress</span>Bar\MSG", sMessageToDisplay, "REG_SZ"
         oShell.Run sProgressBarHTAFile, 1, False 
         End Sub
         Public Sub CloseBar()
         fKillFile sProgressBarRunFile
         Dim sProgressBarHTAFileKiller
         subKillRegKey "HKLM\SYSTEM\<span class="high">Progress</span>Bar","DELETE"
         sProgressBarHTAFileKiller = "c:\temp\htakiller.vbs"
         subWriteFile sProgressBarHTAFileKiller, "On Error Resume Next"
         subWriteFile sProgressBarHTAFileKiller, "wscript.sleep(10000)"
         subWriteFile sProgressBarHTAFileKiller, "Set oFSO = CreateObject(""Scripting.FileSystemObject"")"
         subWriteFile sProgressBarHTAFileKiller, "oFSO.DeleteFile " & Chr(34) & sProgressBarHTAFile & Chr(34) & ", True"
         subWriteFile sProgressBarHTAFileKiller, "oFSO.DeleteFile " & Chr(34) & sProgressBarHTAFileKiller & Chr(34) & ", True"
         oShell.Run sProgressBarHTAFileKiller, 0, False 
         End Sub
         Public Sub SetLine(sNewText)
         oShell.RegWrite "HKLM\SYSTEM\<span class="high">Progress</span>Bar\MSG", sNewText, "REG_SZ"
         End Sub
         Private Function fGetTempName()
         Dim iFilenameCharacters, iHighestASCiiValue, iLowestASCiiValue
         Dim iCharASCiiValue, sTmpFileName, oTempNameDic
         Set oTempNameDic = CreateObject("Scripting.Dictionary")
         iFilenameCharacters = 8
         iHighestASCiiValue = 126
         iLowestASCiiValue = 46
         sTmpFileName = ""
            Randomize
          Do
              iCharASCiiValue = Int(((iHighestASCiiValue - iLowestASCiiValue + 1) * Rnd) + iLowestASCiiValue)   
               Select Case True
                Case iCharASCiiValue = 47
                Case iCharASCiiValue > 57 And iCharASCiiValue < 95
                Case iCharASCiiValue = 96
                Case iCharASCiiValue > 122 And iCharASCiiValue < 126
                Case Else
                 oTempNameDic.Add oTempNameDic.Count,Chr(iCharASCiiValue)
               End Select
          Loop While oTempNameDic.Count < iFilenameCharacters
         fGetTempName = oEnv("TEMP") & "\" & Join(oTempNameDic.Items,"") & ".tmp"
         oTempNameDic.RemoveAll
         End Function
         Private Function fKillFile(sFileToKill)
         Dim iErr, sErr
          Select Case True
           Case InStr(sFileToKill, "*") <> 0
            If oFSO.FolderExists(oFSO.GetParentFolderName(sFileToKill)) Then 
             On Error Resume Next 
              oFSO.DeleteFile sFileToKill, True 
              iErr = Err.Number
              sErr = Err.Description
             On Error GoTo 0 
              If iErr = 53 Then iErr = 0
            End If 
           Case oFSO.FileExists(sFileToKill)
            On Error Resume Next 
             oFSO.DeleteFile sFileToKill, True 
             iErr = Err.Number
             sErr = Err.Description
            On Error GoTo 0
          End Select
          Select Case iErr
           Case 0
            fKillFile = 0
           Case Else
            fKillFile = sErr
          End Select 
         End Function
         Private Sub subWriteFile(sFileToWrite, sTextToWrite)
         Dim oFileToWrite
         subCreateFile sFileToWrite
         Set oFileToWrite = oFSO.OpenTextFile(sFileToWrite,8)
         oFileToWrite.WriteLine sTextToWrite
         oFileToWrite.Close
         End Sub
         Private Sub subCreateFile(sFileToCreate)
         subCreateFolder oFSO.GetParentFolderName(sFileToCreate)
          If Not oFSO.FileExists(sFileToCreate) Then oFSO.CreateTextFile(sFileToCreate)
         End Sub 
         Private Sub subCreateFolder(sFolderPathToCreate)
          If Trim(sFolderPathToCreate) <> "" Then 
            If oFSO.FolderExists(sFolderPathToCreate) Then
             Exit Sub
            Else
             subCreateFolder(oFSO.GetParentFolderName(sFolderPathToCreate))
            End If
           oFSO.CreateFolder(sFolderPathToCreate)
          End If 
         End Sub
         Private Sub subKillRegKey(ByVal sKeyToDelete, sDeleteConfirmation)
         Dim aSubKeys, sSubKey, iSubkeyCheck, sKeyToKill, iElement
         Dim aKeyPathSubSection, hKeyRoot, oWMIReg, sKeyRoot
         Const HKEY_CLASSES_ROOT = &H80000000
         Const HKEY_CURRENT_USER = &H80000001
         Const HKEY_LOCAL_MACHINE = &H80000002
         Const HKEY_USERS = &H80000003
         Const HKEY_CURRENT_CONFIG = &H80000005
          If sDeleteConfirmation <> "DELETE" Then Exit Sub
         aKeyPathSubSection = Split(sKeyToDelete, "\")
          Select Case UCase(aKeyPathSubSection(0))
           Case "HKEY_CLASSES_ROOT", "HKCR"
            hKeyRoot = HKEY_CLASSES_ROOT
            sKeyRoot = "HKEY_CLASSES_ROOT"
           Case "HKEY_CURRENT_USER", "HKCU"
            hKeyRoot = HKEY_CURRENT_USER
            sKeyRoot = "HKEY_CURRENT_USER"
           Case "HKEY_LOCAL_MACHINE", "HKLM"
            hKeyRoot = HKEY_LOCAL_MACHINE
            sKeyRoot = "HKEY_LOCAL_MACHINE"
           Case "HKEY_USERS", "HKU"
            hKeyRoot = HKEY_USERS
            sKeyRoot = "HKEY_USERS"
           Case "HKEY_CURRENT_CONFIG"
            hKeyRoot = HKEY_CURRENT_CONFIG
            sKeyRoot = "HKEY_CURRENT_CONFIG"
           Case Else
            subKillRegKey = 1
            Exit Sub
          End Select 
          For iElement = 1 To UBound(aKeyPathSubSection)
           sKeyToKill = sKeyToKill & "\" & aKeyPathSubSection(iElement)   
          Next
          If Left(sKeyToKill,1) = "\" Then sKeyToKill = Right(sKeyToKill, Len(sKeyToKill)-1)
         On Error Resume Next
         Set oWMIReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv")
         iSubkeyCheck = oWMIReg.EnumKey(hKeyRoot, sKeyToKill, aSubKeys)
          If iSubkeyCheck = 0 And IsArray(aSubKeys) Then
           For Each sSubKey In aSubKeys
             If Err.Number <> 0 Then
              Err.Clear
              Exit Sub
             End If
            subKillRegKey sKeyRoot & "\" & sKeyToKill & "\" & sSubKey, "DELETE"
           Next
          End If
         oWMIReg.DeleteKey hKeyRoot, sKeyToKill
         End Sub
         End Class
          
         

         
        I'm probably more of a newbie than some of the other posters, but I don't understand why that eroor happened?
         
        Steve
        #24
          stephen.wolfe

          • Total Posts : 117
          • Scores: 0
          • Reward points : 0
          • Joined: 8/9/2005
          • Location: Tampa, FL
          • Status: offline
          RE: Dynamic Activity Window Wednesday, August 30, 2006 7:29 AM (permalink)
          0
          Never Mind, I fixed it the problem.  Gee, the weather must be making me crazy, anyway, for some strange reason some HTML tags got mixed up in the code.  I was like staring right at them but didn't have enough sense to see that was the problem.
           
          Once I got my ass in gear and removed the tags the demo worked perfect. 
           
          Digital Screamer, great piece of code, I think this will be very useful for the roll out we are fixing to do.
           
          Thanks!!!!
           
           
          Steve
          #25
            DiGiTAL.SkReAM

            • Total Posts : 1259
            • Scores: 7
            • Reward points : 0
            • Joined: 9/7/2005
            • Location: Clearwater, FL, USA
            • Status: offline
            RE: Dynamic Activity Window Thursday, August 31, 2006 9:31 PM (permalink)
            0
            New info:  I was just testing and found that IE 7 beta breaks this class.  There is something different with the way that it displays the fonts, I think, that is causing problems with the 'scrolling'.
            I'm still trying to pin down a fix.
            "Would you like to touch my monkey?" - Dieter (Mike Meyers)

            "It is better to die like a tiger, than to live like a pussy."
            -Master Wong, from Balls of Fury
            #26
              TNO

              • Total Posts : 2091
              • Scores: 34
              • Reward points : 0
              • Joined: 12/18/2004
              • Location: Earth
              • Status: offline
              RE: Dynamic Activity Window Sunday, November 26, 2006 9:57 AM (permalink)
              0
              I've tinkered with your problem a little more and still not 100% sure of the reason....Have you tried reinstalling WScript? That may rebind the engine to the browser properly.
              To iterate is human, to recurse divine. -- L. Peter Deutsch
              #27
                Snipah

                • Total Posts : 1339
                • Scores: 8
                • Reward points : 0
                • Joined: 11/1/2004
                • Location: Scotland
                • Status: offline
                RE: Dynamic Activity Window Monday, November 27, 2006 1:05 AM (permalink)
                0
                I have it working with IE7.....and it works like a charm....
                 

                For more information, please see the "Read me First" topic.

                http://www.visualbasicscript.com
                #28
                  DiGiTAL.SkReAM

                  • Total Posts : 1259
                  • Scores: 7
                  • Reward points : 0
                  • Joined: 9/7/2005
                  • Location: Clearwater, FL, USA
                  • Status: offline
                  RE: Dynamic Activity Window Monday, November 27, 2006 1:58 AM (permalink)
                  0
                  Did you do anything to get it to work, or did it just work outta the box for you?
                   
                  "Would you like to touch my monkey?" - Dieter (Mike Meyers)

                  "It is better to die like a tiger, than to live like a pussy."
                  -Master Wong, from Balls of Fury
                  #29
                    TNO

                    • Total Posts : 2091
                    • Scores: 34
                    • Reward points : 0
                    • Joined: 12/18/2004
                    • Location: Earth
                    • Status: offline
                    RE: Dynamic Activity Window Monday, November 27, 2006 2:56 AM (permalink)
                    0
                    Alot of people on the web are having troubles with IE7, nothing specific towards the scripting engine though. From what I can gather, re-installing one or the other or both fixed a majority of the cases. No one else has had a similar issue with rendering anomalies. So in short...I still have no idea what the problem is, lol
                    To iterate is human, to recurse divine. -- L. Peter Deutsch
                    #30
                      Snipah

                      • Total Posts : 1339
                      • Scores: 8
                      • Reward points : 0
                      • Joined: 11/1/2004
                      • Location: Scotland
                      • Status: offline
                      RE: Dynamic Activity Window Monday, November 27, 2006 4:10 AM (permalink)
                      0
                      I took the code from this (http://www.visualbasicscript.com/m_32390/mpage_2/key_/tm.htm#) post.... (Post #: 24)
                       
                      and voila....only modifications are to remove the <span.... in between the code......
                      For more information, please see the "Read me First" topic.

                      http://www.visualbasicscript.com
                      #31
                        TNO

                        • Total Posts : 2091
                        • Scores: 34
                        • Reward points : 0
                        • Joined: 12/18/2004
                        • Location: Earth
                        • Status: offline
                        RE: Dynamic Activity Window Monday, November 27, 2006 10:11 AM (permalink)
                        0
                        This calls for a group hug
                        To iterate is human, to recurse divine. -- L. Peter Deutsch
                        #32
                          DiGiTAL.SkReAM

                          • Total Posts : 1259
                          • Scores: 7
                          • Reward points : 0
                          • Joined: 9/7/2005
                          • Location: Clearwater, FL, USA
                          • Status: offline
                          RE: Dynamic Activity Window Tuesday, November 28, 2006 2:36 AM (permalink)
                          0
                          Yer killing me.  I still have the same problem with it.  I run it, and it just sits there until I wave the mouse cursor over the window - at which point it updates, but only for as long as the mouse cursor is moving.  Once the mouse stops moving, the window stops updating.  Maybe I'm missing a patch or something...
                          "Would you like to touch my monkey?" - Dieter (Mike Meyers)

                          "It is better to die like a tiger, than to live like a pussy."
                          -Master Wong, from Balls of Fury
                          #33
                            Snipah

                            • Total Posts : 1339
                            • Scores: 8
                            • Reward points : 0
                            • Joined: 11/1/2004
                            • Location: Scotland
                            • Status: offline
                            RE: Dynamic Activity Window Tuesday, November 28, 2006 6:13 AM (permalink)
                            0
                            I suggest you test it on a Virtual Machine environment..clean slate....easy to rebuild....
                             
                            and ofcourse, the group hug  
                            For more information, please see the "Read me First" topic.

                            http://www.visualbasicscript.com
                            #34
                              TNO

                              • Total Posts : 2091
                              • Scores: 34
                              • Reward points : 0
                              • Joined: 12/18/2004
                              • Location: Earth
                              • Status: offline
                              RE: Dynamic Activity Window Saturday, December 02, 2006 7:54 AM (permalink)
                              0
                              This looks like a reproducible bug...look what I found on MSDN:


                              I'm originally an MCSE and Web designer, creating enterprise HTA solutions for my company. I've found lots of bugs and workarounds when using HTAs as an application which may be inherited from the Internet Explorer DOM. One of them is threading where I use setTimeout functions. My question is: why does the GUI (window) freeze on time-consuming operations? Is mshta.exe actually a J++ compiled application?I'm not sure. No, an HTA isn't actually a J++ compiled application. Please send some details about the freezing problem to scripter@microsoft.com with subject "HTA FREEZE" and we'll see what we can do.



                              ...



                              The "freeze" issue is the same thing I mentioned in my previous question. No output shows up until the sub finishes.
                              Can't really give you an answer right now. If you want to zip up the HTA and email it to scripter@microsoft.com we'll try to take a look at it.


                              My god....no wonder its so hard to find good hta applications out there...The microsoft scripting guys no next to nothing when it comes to anything related to web development teechniques....just take a glance at the answers they give to these questions people ask:

                              http://www.microsoft.com/technet/scriptcenter/webcasts/sweek3/day4qanda.mspx
                              To iterate is human, to recurse divine. -- L. Peter Deutsch
                              #35
                                TNO

                                • Total Posts : 2091
                                • Scores: 34
                                • Reward points : 0
                                • Joined: 12/18/2004
                                • Location: Earth
                                • Status: offline
                                RE: Dynamic Activity Window Saturday, December 02, 2006 7:59 AM (permalink)
                                0
                                Heres another thought....have you tried changing all your Subs to Functions? I have IE7 Beta 2 still, so anything I test isn't going to be accurate....
                                To iterate is human, to recurse divine. -- L. Peter Deutsch
                                #36
                                  DiGiTAL.SkReAM

                                  • Total Posts : 1259
                                  • Scores: 7
                                  • Reward points : 0
                                  • Joined: 9/7/2005
                                  • Location: Clearwater, FL, USA
                                  • Status: offline
                                  RE: Dynamic Activity Window Saturday, December 09, 2006 7:23 PM (permalink)
                                  0
                                  Ok, I solved the problem.
                                  I am pasting the correct, current version of the code below, sicne I - for some reason - am unable to edit my original post in this thread.
                                  The solution was to move the cycling into a second window.setInterval. 
                                  So, instead of creating a single timer to update the hta's display and then running a do...loop to perform the 'waiting' function, I just stuffed the do...loop into a second timer function.
                                  Also, I cleaned up a lot of the code.  After seeing others' nice and neat hta code, I was starting to feel ebarrassed.
                                  So, now I have tested this on WinXP with IE6 & IE7 and it works juuuuuust fine.


                                  Oh, and thanks go to anoop_pv7 for motivating me to get off my lazy a$$ and fix this shizit by posting his own timer bar!

                                   Option Explicit 
                                   Dim oBar
                                   Set oBar = New ProgressBar
                                   oBar.StartBar "This is a test."
                                   WScript.Sleep (3000)
                                   oBar.SetLine "So is this."
                                   WScript.Sleep (3000)
                                   oBar.CloseBar
                                   Class ProgressBar
                                   Dim oBarCat, sProgressBarHTAFile, sProgressBarRunFile, sProgressBarSleepFile
                                   Public Sub StartBar(sMessageToDisplay)
                                    Dim sInitialTemp
                                    ExecuteGlobal "Dim oShell, oFSO, oEnv"
                                    Set oShell = CreateObject("Wscript.Shell")
                                    Set oFSO = CreateObject("Scripting.FileSystemObject")
                                    Set oEnv = oShell.Environment("Process")
                                    sInitialTemp = fGetTempName
                                    sProgressBarHTAFile = Left(sInitialTemp,(Len(sInitialTemp)-4)) & ".hta"
                                    sProgressBarRunFile = Left(sProgressBarHTAFile, Len(sProgressBarHTAFile)-4) & ".run"
                                    sProgressBarSleepFile = Left(sProgressBarHTAFile, Len(sProgressBarHTAFile)-4) & "sleep.vbs"
                                    Set oBarCat = CreateObject("Scripting.Dictionary")
                                    oBarCat.Add oBarCat.Count, "<html>"
                                    oBarCat.Add oBarCat.Count, "<html>"
                                    oBarCat.Add oBarCat.Count, "<head>"
                                    oBarCat.Add oBarCat.Count, "<title id=" & Chr(34) & "title" & Chr(34) & ">Please Wait</title>"
                                    oBarCat.Add oBarCat.Count, "<HTA:APPLICATION "
                                    oBarCat.Add oBarCat.Count, "    ID=" & Chr(34) & "StatusBar" & Chr(34) & ""
                                    oBarCat.Add oBarCat.Count, "    APPLICATIONNAME=" & Chr(34) & "StatusBar" & Chr(34) & ""
                                    oBarCat.Add oBarCat.Count, "    SCROLL=" & Chr(34) & "NO" & Chr(34) & ""
                                    oBarCat.Add oBarCat.Count, "    SINGLEINSTANCE=" & Chr(34) & "YES" & Chr(34) & ""
                                    oBarCat.Add oBarCat.Count, "    CAPTION=" & Chr(34) & "NO" & Chr(34) & ""
                                    oBarCat.Add oBarCat.Count, "    BORDER=" & Chr(34) & "NO" & Chr(34) & ""
                                    oBarCat.Add oBarCat.Count, "    BORDERSTYLE=" & Chr(34) & "NORMAL" & Chr(34) & ""
                                    oBarCat.Add oBarCat.Count, "    SYSMENU=" & Chr(34) & "NO" & Chr(34) & ""
                                    oBarCat.Add oBarCat.Count, "    CONTEXTMENU=" & Chr(34) & "NO" & Chr(34) & ""
                                    oBarCat.Add oBarCat.Count, "    SHOWINTASKBAR=" & Chr(34) & "NO" & Chr(34) & ""
                                    oBarCat.Add oBarCat.Count, "    />"
                                    oBarCat.Add oBarCat.Count, "<SCRIPT Language=" & Chr(34) & "VBScript" & Chr(34) & ">"
                                    oBarCat.Add oBarCat.Count, "Dim oShell, iTimer1, iTimer2, sStatusBarAsciiText, sPID, iCID, sStatusMsg"
                                    oBarCat.Add oBarCat.Count, "Set oShell = CreateObject(" & Chr(34) & "Wscript.Shell" & Chr(34) & ")"
                                    oBarCat.Add oBarCat.Count, "sPID = " & Chr(34) & "" & Chr(34) & ":iCID = 10"
                                    oBarCat.Add oBarCat.Count, "Sub Window_Onload"
                                    oBarCat.Add oBarCat.Count, "  window.resizeTo 320,250"
                                    oBarCat.Add oBarCat.Count, "  CreateObject(" & Chr(34) & "Scripting.FileSystemObject" & Chr(34) & ").CreateTextFile(" & Chr(34) & sProgressBarRunFile & Chr(34) & ")"
                                    oBarCat.Add oBarCat.Count, " CreateObject(" & Chr(34) & "Scripting.FileSystemObject" & Chr(34) & ").CreateTextFile(" & Chr(34) & sProgressBarSleepFile & Chr(34) & ")"
                                    oBarCat.Add oBarCat.Count, "  CreateObject(" & Chr(34) & "Scripting.FileSystemObject" & Chr(34) & ").OpenTextFile(" & Chr(34) & sProgressBarSleepFile & Chr(34) & ",2).WriteLine " & Chr(34) & "WScript.Sleep(1000)" & Chr(34) & ""
                                    oBarCat.Add oBarCat.Count, " iTimer1 = window.setInterval(" & Chr(34) & "Do_Refresh" & Chr(34) & ",175)"
                                    oBarCat.Add oBarCat.Count, "  iTimer2 = window.setInterval(" & Chr(34) & "Do_Nothing" & Chr(34) & ",500)"
                                    oBarCat.Add oBarCat.Count, "End Sub"
                                    oBarCat.Add oBarCat.Count, "Sub Do_Nothing"
                                    oBarCat.Add oBarCat.Count, "  If CreateObject(" & Chr(34) & "Scripting.FileSystemObject" & Chr(34) & ").FileExists(" & Chr(34) & sProgressBarRunFile & Chr(34) & ") Then"  
                                    oBarCat.Add oBarCat.Count, "  Dim oWMIService, cItems, oItem"
                                    oBarCat.Add oBarCat.Count, "  Set oWMIService = GetObject(" & Chr(34) & "winmgmts:\\.\root\CIMV2" & Chr(34) & ")"
                                    oBarCat.Add oBarCat.Count, "  Set cItems = oWMIService.ExecQuery(" & Chr(34) & "SELECT Name, ExecutablePath FROM Win32_Process where Name = 'mshta.exe'" & Chr(34) & ")"
                                    oBarCat.Add oBarCat.Count, "   For Each oItem in cItems"
                                    oBarCat.Add oBarCat.Count, "    oShell.AppActivate oItem.Handle"
                                    oBarCat.Add oBarCat.Count, "   Next"
                                    oBarCat.Add oBarCat.Count, " Else"
                                    oBarCat.Add oBarCat.Count, "   CreateObject(" & Chr(34) & "Scripting.FileSystemObject" & Chr(34) & ").DeleteFile " & Chr(34) & sProgressBarSleepFile & Chr(34) & ", True "
                                    oBarCat.Add oBarCat.Count, "   window.clearInterval(iTimer1)"
                                    oBarCat.Add oBarCat.Count, "   window.clearInterval(iTimer2)"
                                    oBarCat.Add oBarCat.Count, "   self.Close"
                                    oBarCat.Add oBarCat.Count, " End If"
                                    oBarCat.Add oBarCat.Count, "End Sub"
                                    oBarCat.Add oBarCat.Count, "Sub Do_Refresh"
                                    oBarCat.Add oBarCat.Count, "  Select Case iCID"
                                    oBarCat.Add oBarCat.Count, "   Case 10"
                                    oBarCat.Add oBarCat.Count, "        sStatusBarAsciiText =" & Chr(34) & "ooooo" & Chr(34) & ":iCID = 0"
                                    oBarCat.Add oBarCat.Count, "      Case 0"
                                    oBarCat.Add oBarCat.Count, "        sStatusBarAsciiText =  " & Chr(34) & "oooon" & Chr(34) & ":iCID = 1"
                                    oBarCat.Add oBarCat.Count, "      Case 1"
                                    oBarCat.Add oBarCat.Count, "         sStatusBarAsciiText =  " & Chr(34) & "ooono" & Chr(34) & ":iCID = 2"
                                    oBarCat.Add oBarCat.Count, "      Case 2"
                                    oBarCat.Add oBarCat.Count, "         sStatusBarAsciiText =  " & Chr(34) & "oonoo" & Chr(34) & ":iCID = 3"
                                    oBarCat.Add oBarCat.Count, "      Case 3"
                                    oBarCat.Add oBarCat.Count, "        sStatusBarAsciiText =  " & Chr(34) & "onooo" & Chr(34) & ":iCID = 4"
                                    oBarCat.Add oBarCat.Count, "      Case 4"
                                    oBarCat.Add oBarCat.Count, "         sStatusBarAsciiText =  " & Chr(34) & "noooo" & Chr(34) & ":iCID = 5"
                                    oBarCat.Add oBarCat.Count, "     Case 5"
                                    oBarCat.Add oBarCat.Count, "         sStatusBarAsciiText =  " & Chr(34) & "onooo" & Chr(34) & ":iCID = 6"
                                    oBarCat.Add oBarCat.Count, "      Case 6"
                                    oBarCat.Add oBarCat.Count, "         sStatusBarAsciiText =  " & Chr(34) & "oonoo" & Chr(34) & ":iCID = 7"
                                    oBarCat.Add oBarCat.Count, "     Case 7"
                                    oBarCat.Add oBarCat.Count, "         sStatusBarAsciiText =  " & Chr(34) & "ooono" & Chr(34) & ":iCID = 8"
                                    oBarCat.Add oBarCat.Count, "     Case 8"
                                    oBarCat.Add oBarCat.Count, "         sStatusBarAsciiText =  " & Chr(34) & "oooon" & Chr(34) & ":iCID = 1"
                                    oBarCat.Add oBarCat.Count, "  End Select "
                                    oBarCat.Add oBarCat.Count, " Stats.innerHTML = sStatusBarAsciiText"
                                    oBarCat.Add oBarCat.Count, " On Error Resume Next"
                                    oBarCat.Add oBarCat.Count, "  oShell.RegRead(" & Chr(34) & "HKLM\SYSTEM\ProgressBar\MSG" & Chr(34) & ")"
                                    oBarCat.Add oBarCat.Count, "     iRegErr = Err.Number"
                                    oBarCat.Add oBarCat.Count, "    On Error Goto 0"
                                    oBarCat.Add oBarCat.Count, "     If iRegErr = 0 then"
                                    oBarCat.Add oBarCat.Count, "      sStatusMsg = Replace(oShell.RegRead(" & Chr(34) & "HKLM\SYSTEM\ProgressBar\MSG" & Chr(34) & "), VbCrLf," & Chr(34) & "<br>" & Chr(34) & ") "
                                    oBarCat.Add oBarCat.Count, "     Else"
                                    oBarCat.Add oBarCat.Count, "      sStatusMsg = " & Chr(34) & "" & Chr(34) & ""
                                    oBarCat.Add oBarCat.Count, "     End if"
                                    oBarCat.Add oBarCat.Count, "   MyMsg.innerHTML = sStatusMsg"
                                    oBarCat.Add oBarCat.Count, " End Sub"
                                    oBarCat.Add oBarCat.Count, "</SCRIPT>"
                                    oBarCat.Add oBarCat.Count, "<style>"
                                    oBarCat.Add oBarCat.Count, "body,td,a {font-family:Arial;font-size:12px;text-decoration:none;color:black;}"
                                    oBarCat.Add oBarCat.Count, "body {filter:progid:DXImageTransform.Microsoft.Gradient(GradientType=0, StartColorStr='#9999FF', EndColorStr='#FFFFFF')}"
                                    oBarCat.Add oBarCat.Count, ".pix {width: 1px; height 1px;}"
                                    oBarCat.Add oBarCat.Count, "</style>"
                                    oBarCat.Add oBarCat.Count, "</head>"
                                    oBarCat.Add oBarCat.Count, "<body>"
                                    oBarCat.Add oBarCat.Count, "<center>"
                                    oBarCat.Add oBarCat.Count, "<table width=" & Chr(34) & "275" & Chr(34) & ">"
                                    oBarCat.Add oBarCat.Count, " <tr><td>"
                                    oBarCat.Add oBarCat.Count, "   <fieldset><legend align=" & Chr(34) & "center" & Chr(34) & "><b> Please Be Patient </b></legend>"
                                    oBarCat.Add oBarCat.Count, "     <br><center>"
                                    oBarCat.Add oBarCat.Count, "       <span id= " & Chr(34) & "Stats" & Chr(34) & " style=" & Chr(34) & "font-family: wingdings;font-weight: bold;font-size:20px;" & Chr(34) & "></span>"
                                    oBarCat.Add oBarCat.Count, "     </center><br><br>"
                                    oBarCat.Add oBarCat.Count, "   </fieldset>"
                                    oBarCat.Add oBarCat.Count, " </td></tr>"
                                    oBarCat.Add oBarCat.Count, "</table>"
                                    oBarCat.Add oBarCat.Count, "<span id= " & Chr(34) & "MyMsg" & Chr(34) & " style=" & Chr(34) & "font-family: Ariel;font-size:12px;" & Chr(34) & "></span>"
                                    oBarCat.Add oBarCat.Count, "</body>"
                                    oBarCat.Add oBarCat.Count, "</html>"
                                    subWriteFile sProgressBarHTAFile, Join(oBarCat.Items,VbCrLf)
                                    oShell.RegWrite "HKLM\SYSTEM\ProgressBar\MSG", sMessageToDisplay, "REG_SZ"
                                    oShell.Run sProgressBarHTAFile, 1, False 
                                   End Sub
                                   Public Sub CloseBar()
                                    fKillFile sProgressBarRunFile
                                    Dim sProgressBarHTAFileKiller
                                    subKillRegKey "HKLM\SYSTEM\ProgressBar","DELETE"
                                    sProgressBarHTAFileKiller = "c:\temp\htakiller.vbs"
                                    subWriteFile sProgressBarHTAFileKiller, "On Error Resume Next"
                                    subWriteFile sProgressBarHTAFileKiller, "wscript.sleep(10000)"
                                    subWriteFile sProgressBarHTAFileKiller, "Set oFSO = CreateObject(""Scripting.FileSystemObject"")"
                                    subWriteFile sProgressBarHTAFileKiller, "oFSO.DeleteFile " & Chr(34) & sProgressBarHTAFile & Chr(34) & ", True"
                                    subWriteFile sProgressBarHTAFileKiller, "oFSO.DeleteFile " & Chr(34) & sProgressBarHTAFileKiller & Chr(34) & ", True"
                                    oShell.Run sProgressBarHTAFileKiller, 0, False 
                                   End Sub
                                   Public Sub SetLine(sNewText)
                                    oShell.RegWrite "HKLM\SYSTEM\ProgressBar\MSG", sNewText, "REG_SZ"
                                   End Sub
                                   Private Function fGetTempName()
                                    Dim iFilenameCharacters, iHighestASCiiValue, iLowestASCiiValue
                                    Dim iCharASCiiValue, sTmpFileName, oTempNameDic
                                    Set oTempNameDic = CreateObject("Scripting.Dictionary")
                                    iFilenameCharacters = 8
                                    iHighestASCiiValue = 126
                                    iLowestASCiiValue = 46
                                    sTmpFileName = ""
                                    Randomize
                                     Do
                                      iCharASCiiValue = Int(((iHighestASCiiValue - iLowestASCiiValue + 1) * Rnd) + iLowestASCiiValue)   
                                       Select Case True
                                        Case iCharASCiiValue = 47
                                        Case iCharASCiiValue > 57 And iCharASCiiValue < 95
                                        Case iCharASCiiValue = 96
                                        Case iCharASCiiValue > 122 And iCharASCiiValue < 126
                                        Case Else
                                         oTempNameDic.Add oTempNameDic.Count,Chr(iCharASCiiValue)
                                       End Select
                                     Loop While oTempNameDic.Count < iFilenameCharacters
                                    fGetTempName = oEnv("TEMP") & "\" & Join(oTempNameDic.Items,"") & ".tmp"
                                    oTempNameDic.RemoveAll
                                   End Function
                                   Private Function fKillFile(sFileToKill)
                                    Dim iErr, sErr
                                     Select Case True
                                      Case InStr(sFileToKill, "*") <> 0
                                        If oFSO.FolderExists(oFSO.GetParentFolderName(sFileToKill)) Then 
                                         On Error Resume Next 
                                          oFSO.DeleteFile sFileToKill, True 
                                          iErr = Err.Number
                                          sErr = Err.Description
                                         On Error GoTo 0 
                                          If iErr = 53 Then iErr = 0
                                        End If 
                                      Case oFSO.FileExists(sFileToKill)
                                       On Error Resume Next 
                                        oFSO.DeleteFile sFileToKill, True 
                                        iErr = Err.Number
                                        sErr = Err.Description
                                       On Error GoTo 0
                                     End Select
                                     Select Case iErr
                                      Case 0
                                       fKillFile = 0
                                      Case Else
                                       fKillFile = sErr
                                     End Select 
                                   End Function
                                   Private Sub subWriteFile(sFileToWrite, sTextToWrite)
                                    Dim oFileToWrite
                                    subCreateFile sFileToWrite
                                    Set oFileToWrite = oFSO.OpenTextFile(sFileToWrite,8)
                                    oFileToWrite.WriteLine sTextToWrite
                                    oFileToWrite.Close
                                   End Sub
                                   Private Sub subCreateFile(sFileToCreate)
                                    subCreateFolder oFSO.GetParentFolderName(sFileToCreate)
                                     If Not oFSO.FileExists(sFileToCreate) Then oFSO.CreateTextFile(sFileToCreate)
                                   End Sub 
                                   Private Sub subCreateFolder(sFolderPathToCreate)
                                     If Trim(sFolderPathToCreate) <> "" Then 
                                       If oFSO.FolderExists(sFolderPathToCreate) Then
                                        Exit Sub
                                       Else
                                        subCreateFolder(oFSO.GetParentFolderName(sFolderPathToCreate))
                                       End If
                                      oFSO.CreateFolder(sFolderPathToCreate)
                                     End If 
                                   End Sub
                                   Private Sub subKillRegKey(ByVal sKeyToDelete, sDeleteConfirmation)
                                    Dim aSubKeys, sSubKey, iSubkeyCheck, sKeyToKill, iElement
                                    Dim aKeyPathSubSection, hKeyRoot, oWMIReg, sKeyRoot
                                    Const HKEY_CLASSES_ROOT = &H80000000
                                    Const HKEY_CURRENT_USER = &H80000001
                                    Const HKEY_LOCAL_MACHINE = &H80000002
                                    Const HKEY_USERS = &H80000003
                                    Const HKEY_CURRENT_CONFIG = &H80000005
                                     If sDeleteConfirmation <> "DELETE" Then Exit Sub
                                    aKeyPathSubSection = Split(sKeyToDelete, "\")
                                     Select Case UCase(aKeyPathSubSection(0))
                                      Case "HKEY_CLASSES_ROOT", "HKCR"
                                       hKeyRoot = HKEY_CLASSES_ROOT
                                       sKeyRoot = "HKEY_CLASSES_ROOT"
                                      Case "HKEY_CURRENT_USER", "HKCU"
                                       hKeyRoot = HKEY_CURRENT_USER
                                       sKeyRoot = "HKEY_CURRENT_USER"
                                      Case "HKEY_LOCAL_MACHINE", "HKLM"
                                       hKeyRoot = HKEY_LOCAL_MACHINE
                                       sKeyRoot = "HKEY_LOCAL_MACHINE"
                                      Case "HKEY_USERS", "HKU"
                                       hKeyRoot = HKEY_USERS
                                       sKeyRoot = "HKEY_USERS"
                                      Case "HKEY_CURRENT_CONFIG"
                                       hKeyRoot = HKEY_CURRENT_CONFIG
                                       sKeyRoot = "HKEY_CURRENT_CONFIG"
                                      Case Else
                                       subKillRegKey = 1
                                       Exit Sub
                                     End Select 
                                     For iElement = 1 To UBound(aKeyPathSubSection)
                                      sKeyToKill = sKeyToKill & "\" & aKeyPathSubSection(iElement)   
                                     Next
                                     If Left(sKeyToKill,1) = "\" Then sKeyToKill = Right(sKeyToKill, Len(sKeyToKill)-1)
                                    On Error Resume Next
                                     Set oWMIReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv")
                                     iSubkeyCheck = oWMIReg.EnumKey(hKeyRoot, sKeyToKill, aSubKeys)
                                      If iSubkeyCheck = 0 And IsArray(aSubKeys) Then
                                        For Each sSubKey In aSubKeys
                                          If Err.Number <> 0 Then
                                           Err.Clear
                                           Exit Sub
                                          End If
                                         subKillRegKey sKeyRoot & "\" & sKeyToKill & "\" & sSubKey, "DELETE"
                                        Next
                                      End If
                                     oWMIReg.DeleteKey hKeyRoot, sKeyToKill
                                   End Sub
                                   End Class
                                   

                                   
                                  EDIT: Would it be possible for a forum admin to copy the above code and paste it into the original post in this thread?  Or prefereably make it so that I can edit the original?
                                  <message edited by DiGiTAL.SkReAM on Sunday, December 10, 2006 5:33 AM>
                                  "Would you like to touch my monkey?" - Dieter (Mike Meyers)

                                  "It is better to die like a tiger, than to live like a pussy."
                                  -Master Wong, from Balls of Fury
                                  #37
                                    TNO

                                    • Total Posts : 2091
                                    • Scores: 34
                                    • Reward points : 0
                                    • Joined: 12/18/2004
                                    • Location: Earth
                                    • Status: offline
                                    RE: Dynamic Activity Window Saturday, December 09, 2006 10:14 PM (permalink)
                                    0
                                    Looks good, working here too
                                    To iterate is human, to recurse divine. -- L. Peter Deutsch
                                    #38
                                      ehvbs

                                      • Total Posts : 3312
                                      • Scores: 110
                                      • Reward points : 0
                                      • Joined: 6/22/2005
                                      • Location: Germany
                                      • Status: offline
                                      RE: Dynamic Activity Window Monday, December 11, 2006 10:10 AM (permalink)
                                      0
                                      Hi DiGiTAL.SkReAM,

                                      your nice/interesting code is working here (W2K, IE 6.0) too! I look forward to
                                      study it in detail.

                                      One hasty (?) remark: Default action for .vbs on my computer is "edit it with UltraEdit";
                                      that makes killing rather difficult! How do you think about using "cscript " as a prefix
                                      for automagically running scripts?

                                      ehvbs


                                      #39
                                        DiGiTAL.SkReAM

                                        • Total Posts : 1259
                                        • Scores: 7
                                        • Reward points : 0
                                        • Joined: 9/7/2005
                                        • Location: Clearwater, FL, USA
                                        • Status: offline
                                        RE: Dynamic Activity Window Tuesday, December 12, 2006 2:39 AM (permalink)
                                        0
                                        Hmmm... I hadn't really even considered that some people might have modified their setups so that running a .vbs file doesn't actually RUN it, but rather opens it with another app.
                                        This should fix that issue.  Also, I took this opportunity to remove the extra "oBarCat.Add oBarCat.Count, "<html>"" that I had in there.
                                         
                                         Option Explicit 
                                         Dim oBar
                                         Set oBar = New ProgressBar
                                         oBar.StartBar "This is a test."
                                         WScript.Sleep (3000)
                                         oBar.SetLine "So is this."
                                         WScript.Sleep (3000)
                                         oBar.CloseBar
                                         Class ProgressBar
                                         Dim oBarCat, sProgressBarHTAFile, sProgressBarRunFile, sProgressBarSleepFile
                                         Public Sub StartBar(sMessageToDisplay)
                                         Dim sInitialTemp
                                         ExecuteGlobal "Dim oShell, oFSO, oEnv"
                                         Set oShell = CreateObject("Wscript.Shell")
                                         Set oFSO = CreateObject("Scripting.FileSystemObject")
                                         Set oEnv = oShell.Environment("Process")
                                         sInitialTemp = fGetTempName
                                         sProgressBarHTAFile = Left(sInitialTemp,(Len(sInitialTemp)-4)) & ".hta"
                                         sProgressBarRunFile = Left(sProgressBarHTAFile, Len(sProgressBarHTAFile)-4) & ".run"
                                         sProgressBarSleepFile = Left(sProgressBarHTAFile, Len(sProgressBarHTAFile)-4) & "sleep.vbs"
                                         Set oBarCat = CreateObject("Scripting.Dictionary")
                                         oBarCat.Add oBarCat.Count, "<html>"
                                         oBarCat.Add oBarCat.Count, "<head>"
                                         oBarCat.Add oBarCat.Count, "<title id=" & Chr(34) & "title" & Chr(34) & ">Please Wait</title>"
                                         oBarCat.Add oBarCat.Count, "<HTA:APPLICATION "
                                         oBarCat.Add oBarCat.Count, "    ID=" & Chr(34) & "StatusBar" & Chr(34) & ""
                                         oBarCat.Add oBarCat.Count, "    APPLICATIONNAME=" & Chr(34) & "StatusBar" & Chr(34) & ""
                                         oBarCat.Add oBarCat.Count, "    SCROLL=" & Chr(34) & "NO" & Chr(34) & ""
                                         oBarCat.Add oBarCat.Count, "    SINGLEINSTANCE=" & Chr(34) & "YES" & Chr(34) & ""
                                         oBarCat.Add oBarCat.Count, "    CAPTION=" & Chr(34) & "NO" & Chr(34) & ""
                                         oBarCat.Add oBarCat.Count, "    BORDER=" & Chr(34) & "NO" & Chr(34) & ""
                                         oBarCat.Add oBarCat.Count, "    BORDERSTYLE=" & Chr(34) & "NORMAL" & Chr(34) & ""
                                         oBarCat.Add oBarCat.Count, "    SYSMENU=" & Chr(34) & "NO" & Chr(34) & ""
                                         oBarCat.Add oBarCat.Count, "    CONTEXTMENU=" & Chr(34) & "NO" & Chr(34) & ""
                                         oBarCat.Add oBarCat.Count, "    SHOWINTASKBAR=" & Chr(34) & "NO" & Chr(34) & ""
                                         oBarCat.Add oBarCat.Count, "    />"
                                         oBarCat.Add oBarCat.Count, "<SCRIPT Language=" & Chr(34) & "VBScript" & Chr(34) & ">"
                                         oBarCat.Add oBarCat.Count, "Dim oShell, iTimer1, iTimer2, sStatusBarAsciiText, sPID, iCID, sStatusMsg"
                                         oBarCat.Add oBarCat.Count, "Set oShell = CreateObject(" & Chr(34) & "Wscript.Shell" & Chr(34) & ")"
                                         oBarCat.Add oBarCat.Count, "sPID = " & Chr(34) & "" & Chr(34) & ":iCID = 10"
                                         oBarCat.Add oBarCat.Count, "Sub Window_Onload"
                                         oBarCat.Add oBarCat.Count, "  window.resizeTo 320,250"
                                         oBarCat.Add oBarCat.Count, "  CreateObject(" & Chr(34) & "Scripting.FileSystemObject" & Chr(34) & ").CreateTextFile(" & Chr(34) & sProgressBarRunFile & Chr(34) & ")"
                                         oBarCat.Add oBarCat.Count, " CreateObject(" & Chr(34) & "Scripting.FileSystemObject" & Chr(34) & ").CreateTextFile(" & Chr(34) & sProgressBarSleepFile & Chr(34) & ")"
                                         oBarCat.Add oBarCat.Count, "  CreateObject(" & Chr(34) & "Scripting.FileSystemObject" & Chr(34) & ").OpenTextFile(" & Chr(34) & sProgressBarSleepFile & Chr(34) & ",2).WriteLine " & Chr(34) & "WScript.Sleep(1000)" & Chr(34) & ""
                                         oBarCat.Add oBarCat.Count, " iTimer1 = window.setInterval(" & Chr(34) & "Do_Refresh" & Chr(34) & ",175)"
                                         oBarCat.Add oBarCat.Count, "  iTimer2 = window.setInterval(" & Chr(34) & "Do_Nothing" & Chr(34) & ",500)"
                                         oBarCat.Add oBarCat.Count, "End Sub"
                                         oBarCat.Add oBarCat.Count, "Sub Do_Nothing"
                                         oBarCat.Add oBarCat.Count, "  If CreateObject(" & Chr(34) & "Scripting.FileSystemObject" & Chr(34) & ").FileExists(" & Chr(34) & sProgressBarRunFile & Chr(34) & ") Then"  
                                         oBarCat.Add oBarCat.Count, "  Dim oWMIService, cItems, oItem"
                                         oBarCat.Add oBarCat.Count, "  Set oWMIService = GetObject(" & Chr(34) & "winmgmts:\\.\root\CIMV2" & Chr(34) & ")"
                                         oBarCat.Add oBarCat.Count, "  Set cItems = oWMIService.ExecQuery(" & Chr(34) & "SELECT Name, ExecutablePath FROM Win32_Process where Name = 'mshta.exe'" & Chr(34) & ")"
                                         oBarCat.Add oBarCat.Count, "   For Each oItem in cItems"
                                         oBarCat.Add oBarCat.Count, "    oShell.AppActivate oItem.Handle"
                                         oBarCat.Add oBarCat.Count, "   Next"
                                         oBarCat.Add oBarCat.Count, " Else"
                                         oBarCat.Add oBarCat.Count, "   CreateObject(" & Chr(34) & "Scripting.FileSystemObject" & Chr(34) & ").DeleteFile " & Chr(34) & sProgressBarSleepFile & Chr(34) & ", True "
                                         oBarCat.Add oBarCat.Count, "   window.clearInterval(iTimer1)"
                                         oBarCat.Add oBarCat.Count, "   window.clearInterval(iTimer2)"
                                         oBarCat.Add oBarCat.Count, "   self.Close"
                                         oBarCat.Add oBarCat.Count, " End If"
                                         oBarCat.Add oBarCat.Count, "End Sub"
                                         oBarCat.Add oBarCat.Count, "Sub Do_Refresh"
                                         oBarCat.Add oBarCat.Count, "  Select Case iCID"
                                         oBarCat.Add oBarCat.Count, "   Case 10"
                                         oBarCat.Add oBarCat.Count, "        sStatusBarAsciiText =" & Chr(34) & "ooooo" & Chr(34) & ":iCID = 0"
                                         oBarCat.Add oBarCat.Count, "      Case 0"
                                         oBarCat.Add oBarCat.Count, "        sStatusBarAsciiText =  " & Chr(34) & "oooon" & Chr(34) & ":iCID = 1"
                                         oBarCat.Add oBarCat.Count, "      Case 1"
                                         oBarCat.Add oBarCat.Count, "         sStatusBarAsciiText =  " & Chr(34) & "ooono" & Chr(34) & ":iCID = 2"
                                         oBarCat.Add oBarCat.Count, "      Case 2"
                                         oBarCat.Add oBarCat.Count, "         sStatusBarAsciiText =  " & Chr(34) & "oonoo" & Chr(34) & ":iCID = 3"
                                         oBarCat.Add oBarCat.Count, "      Case 3"
                                         oBarCat.Add oBarCat.Count, "        sStatusBarAsciiText =  " & Chr(34) & "onooo" & Chr(34) & ":iCID = 4"
                                         oBarCat.Add oBarCat.Count, "      Case 4"
                                         oBarCat.Add oBarCat.Count, "         sStatusBarAsciiText =  " & Chr(34) & "noooo" & Chr(34) & ":iCID = 5"
                                         oBarCat.Add oBarCat.Count, "     Case 5"
                                         oBarCat.Add oBarCat.Count, "         sStatusBarAsciiText =  " & Chr(34) & "onooo" & Chr(34) & ":iCID = 6"
                                         oBarCat.Add oBarCat.Count, "      Case 6"
                                         oBarCat.Add oBarCat.Count, "         sStatusBarAsciiText =  " & Chr(34) & "oonoo" & Chr(34) & ":iCID = 7"
                                         oBarCat.Add oBarCat.Count, "     Case 7"
                                         oBarCat.Add oBarCat.Count, "         sStatusBarAsciiText =  " & Chr(34) & "ooono" & Chr(34) & ":iCID = 8"
                                         oBarCat.Add oBarCat.Count, "     Case 8"
                                         oBarCat.Add oBarCat.Count, "         sStatusBarAsciiText =  " & Chr(34) & "oooon" & Chr(34) & ":iCID = 1"
                                         oBarCat.Add oBarCat.Count, "  End Select "
                                         oBarCat.Add oBarCat.Count, " Stats.innerHTML = sStatusBarAsciiText"
                                         oBarCat.Add oBarCat.Count, " On Error Resume Next"
                                         oBarCat.Add oBarCat.Count, "  oShell.RegRead(" & Chr(34) & "HKLM\SYSTEM\ProgressBar\MSG" & Chr(34) & ")"
                                         oBarCat.Add oBarCat.Count, "     iRegErr = Err.Number"
                                         oBarCat.Add oBarCat.Count, "    On Error Goto 0"
                                         oBarCat.Add oBarCat.Count, "     If iRegErr = 0 then"
                                         oBarCat.Add oBarCat.Count, "      sStatusMsg = Replace(oShell.RegRead(" & Chr(34) & "HKLM\SYSTEM\ProgressBar\MSG" & Chr(34) & "), VbCrLf," & Chr(34) & "<br>" & Chr(34) & ") "
                                         oBarCat.Add oBarCat.Count, "     Else"
                                         oBarCat.Add oBarCat.Count, "      sStatusMsg = " & Chr(34) & "" & Chr(34) & ""
                                         oBarCat.Add oBarCat.Count, "     End if"
                                         oBarCat.Add oBarCat.Count, "   MyMsg.innerHTML = sStatusMsg"
                                         oBarCat.Add oBarCat.Count, " End Sub"
                                         oBarCat.Add oBarCat.Count, "</SCRIPT>"
                                         oBarCat.Add oBarCat.Count, "<style>"
                                         oBarCat.Add oBarCat.Count, "body,td,a {font-family:Arial;font-size:12px;text-decoration:none;color:black;}"
                                         oBarCat.Add oBarCat.Count, "body {filter:progid:DXImageTransform.Microsoft.Gradient(GradientType=0, StartColorStr='#9999FF', EndColorStr='#FFFFFF')}"
                                         oBarCat.Add oBarCat.Count, ".pix {width: 1px; height 1px;}"
                                         oBarCat.Add oBarCat.Count, "</style>"
                                         oBarCat.Add oBarCat.Count, "</head>"
                                         oBarCat.Add oBarCat.Count, "<body>"
                                         oBarCat.Add oBarCat.Count, "<center>"
                                         oBarCat.Add oBarCat.Count, "<table width=" & Chr(34) & "275" & Chr(34) & ">"
                                         oBarCat.Add oBarCat.Count, " <tr><td>"
                                         oBarCat.Add oBarCat.Count, "   <fieldset><legend align=" & Chr(34) & "center" & Chr(34) & "><b> Please Be Patient </b></legend>"
                                         oBarCat.Add oBarCat.Count, "     <br><center>"
                                         oBarCat.Add oBarCat.Count, "       <span id= " & Chr(34) & "Stats" & Chr(34) & " style=" & Chr(34) & "font-family: wingdings;font-weight: bold;font-size:20px;" & Chr(34) & "></span>"
                                         oBarCat.Add oBarCat.Count, "     </center><br><br>"
                                         oBarCat.Add oBarCat.Count, "   </fieldset>"
                                         oBarCat.Add oBarCat.Count, " </td></tr>"
                                         oBarCat.Add oBarCat.Count, "</table>"
                                         oBarCat.Add oBarCat.Count, "<span id= " & Chr(34) & "MyMsg" & Chr(34) & " style=" & Chr(34) & "font-family: Ariel;font-size:12px;" & Chr(34) & "></span>"
                                         oBarCat.Add oBarCat.Count, "</body>"
                                         oBarCat.Add oBarCat.Count, "</html>"
                                         subWriteFile sProgressBarHTAFile, Join(oBarCat.Items,VbCrLf)
                                         oShell.RegWrite "HKLM\SYSTEM\ProgressBar\MSG", sMessageToDisplay, "REG_SZ"
                                         oShell.Run sProgressBarHTAFile, 1, False 
                                         End Sub
                                         Public Sub CloseBar()
                                         fKillFile sProgressBarRunFile
                                         Dim sProgressBarHTAFileKiller
                                         subKillRegKey "HKLM\SYSTEM\ProgressBar","DELETE"
                                         sProgressBarHTAFileKiller = "c:\temp\htakiller.vbs"
                                         subWriteFile sProgressBarHTAFileKiller, "On Error Resume Next"
                                         subWriteFile sProgressBarHTAFileKiller, "wscript.sleep(10000)"
                                         subWriteFile sProgressBarHTAFileKiller, "Set oFSO = CreateObject(""Scripting.FileSystemObject"")"
                                         subWriteFile sProgressBarHTAFileKiller, "oFSO.DeleteFile " & Chr(34) & sProgressBarHTAFile & Chr(34) & ", True"
                                         subWriteFile sProgressBarHTAFileKiller, "oFSO.DeleteFile " & Chr(34) & sProgressBarHTAFileKiller & Chr(34) & ", True"
                                         oShell.Run "%comspec% /c cscript.exe " & sProgressBarHTAFileKiller, 0, False 
                                         End Sub
                                         Public Sub SetLine(sNewText)
                                         oShell.RegWrite "HKLM\SYSTEM\ProgressBar\MSG", sNewText, "REG_SZ"
                                         End Sub
                                         Private Function fGetTempName()
                                         Dim iFilenameCharacters, iHighestASCiiValue, iLowestASCiiValue
                                         Dim iCharASCiiValue, sTmpFileName, oTempNameDic
                                         Set oTempNameDic = CreateObject("Scripting.Dictionary")
                                         iFilenameCharacters = 8
                                         iHighestASCiiValue = 126
                                         iLowestASCiiValue = 46
                                         sTmpFileName = ""
                                         Randomize
                                          Do
                                           iCharASCiiValue = Int(((iHighestASCiiValue - iLowestASCiiValue + 1) * Rnd) + iLowestASCiiValue)   
                                            Select Case True
                                             Case iCharASCiiValue = 47
                                             Case iCharASCiiValue > 57 And iCharASCiiValue < 95
                                             Case iCharASCiiValue = 96
                                             Case iCharASCiiValue > 122 And iCharASCiiValue < 126
                                             Case Else
                                              oTempNameDic.Add oTempNameDic.Count,Chr(iCharASCiiValue)
                                            End Select
                                          Loop While oTempNameDic.Count < iFilenameCharacters
                                         fGetTempName = oEnv("TEMP") & "\" & Join(oTempNameDic.Items,"") & ".tmp"
                                         oTempNameDic.RemoveAll
                                         End Function
                                         Private Function fKillFile(sFileToKill)
                                         Dim iErr, sErr
                                          Select Case True
                                           Case InStr(sFileToKill, "*") <> 0
                                             If oFSO.FolderExists(oFSO.GetParentFolderName(sFileToKill)) Then 
                                              On Error Resume Next 
                                               oFSO.DeleteFile sFileToKill, True 
                                               iErr = Err.Number
                                               sErr = Err.Description
                                              On Error GoTo 0 
                                               If iErr = 53 Then iErr = 0
                                             End If 
                                           Case oFSO.FileExists(sFileToKill)
                                            On Error Resume Next 
                                             oFSO.DeleteFile sFileToKill, True 
                                             iErr = Err.Number
                                             sErr = Err.Description
                                            On Error GoTo 0
                                          End Select
                                          Select Case iErr
                                           Case 0
                                            fKillFile = 0
                                           Case Else
                                            fKillFile = sErr
                                          End Select 
                                         End Function
                                         Private Sub subWriteFile(sFileToWrite, sTextToWrite)
                                         Dim oFileToWrite
                                         subCreateFile sFileToWrite
                                         Set oFileToWrite = oFSO.OpenTextFile(sFileToWrite,8)
                                         oFileToWrite.WriteLine sTextToWrite
                                         oFileToWrite.Close
                                         End Sub
                                         Private Sub subCreateFile(sFileToCreate)
                                         subCreateFolder oFSO.GetParentFolderName(sFileToCreate)
                                          If Not oFSO.FileExists(sFileToCreate) Then oFSO.CreateTextFile(sFileToCreate)
                                         End Sub 
                                         Private Sub subCreateFolder(sFolderPathToCreate)
                                          If Trim(sFolderPathToCreate) <> "" Then 
                                            If oFSO.FolderExists(sFolderPathToCreate) Then
                                             Exit Sub
                                            Else
                                             subCreateFolder(oFSO.GetParentFolderName(sFolderPathToCreate))
                                            End If
                                           oFSO.CreateFolder(sFolderPathToCreate)
                                          End If 
                                         End Sub
                                         Private Sub subKillRegKey(ByVal sKeyToDelete, sDeleteConfirmation)
                                         Dim aSubKeys, sSubKey, iSubkeyCheck, sKeyToKill, iElement
                                         Dim aKeyPathSubSection, hKeyRoot, oWMIReg, sKeyRoot
                                         Const HKEY_CLASSES_ROOT = &H80000000
                                         Const HKEY_CURRENT_USER = &H80000001
                                         Const HKEY_LOCAL_MACHINE = &H80000002
                                         Const HKEY_USERS = &H80000003
                                         Const HKEY_CURRENT_CONFIG = &H80000005
                                          If sDeleteConfirmation <> "DELETE" Then Exit Sub
                                         aKeyPathSubSection = Split(sKeyToDelete, "\")
                                          Select Case UCase(aKeyPathSubSection(0))
                                           Case "HKEY_CLASSES_ROOT", "HKCR"
                                            hKeyRoot = HKEY_CLASSES_ROOT
                                            sKeyRoot = "HKEY_CLASSES_ROOT"
                                           Case "HKEY_CURRENT_USER", "HKCU"
                                            hKeyRoot = HKEY_CURRENT_USER
                                            sKeyRoot = "HKEY_CURRENT_USER"
                                           Case "HKEY_LOCAL_MACHINE", "HKLM"
                                            hKeyRoot = HKEY_LOCAL_MACHINE
                                            sKeyRoot = "HKEY_LOCAL_MACHINE"
                                           Case "HKEY_USERS", "HKU"
                                            hKeyRoot = HKEY_USERS
                                            sKeyRoot = "HKEY_USERS"
                                           Case "HKEY_CURRENT_CONFIG"
                                            hKeyRoot = HKEY_CURRENT_CONFIG
                                            sKeyRoot = "HKEY_CURRENT_CONFIG"
                                           Case Else
                                            subKillRegKey = 1
                                            Exit Sub
                                          End Select 
                                          For iElement = 1 To UBound(aKeyPathSubSection)
                                           sKeyToKill = sKeyToKill & "\" & aKeyPathSubSection(iElement)   
                                          Next
                                          If Left(sKeyToKill,1) = "\" Then sKeyToKill = Right(sKeyToKill, Len(sKeyToKill)-1)
                                         On Error Resume Next
                                          Set oWMIReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv")
                                          iSubkeyCheck = oWMIReg.EnumKey(hKeyRoot, sKeyToKill, aSubKeys)
                                           If iSubkeyCheck = 0 And IsArray(aSubKeys) Then
                                             For Each sSubKey In aSubKeys
                                               If Err.Number <> 0 Then
                                                Err.Clear
                                                Exit Sub
                                               End If
                                              subKillRegKey sKeyRoot & "\" & sKeyToKill & "\" & sSubKey, "DELETE"
                                             Next
                                           End If
                                          oWMIReg.DeleteKey hKeyRoot, sKeyToKill
                                         End Sub
                                         End Class
                                         

                                         
                                        "Would you like to touch my monkey?" - Dieter (Mike Meyers)

                                        "It is better to die like a tiger, than to live like a pussy."
                                        -Master Wong, from Balls of Fury
                                        #40

                                          Online Bookmarks Sharing: Share/Bookmark
                                          Change Page: < 123 > | Showing page 2 of 3, messages 21 to 40 of 60

                                          Jump to:

                                          Current active users

                                          There are 0 members and 1 guests.

                                          Icon Legend and Permission

                                          • New Messages
                                          • No New Messages
                                          • Hot Topic w/ New Messages
                                          • Hot Topic w/o New Messages
                                          • Locked w/ New Messages
                                          • Locked w/o New Messages
                                          • Read Message
                                          • Post New Thread
                                          • Reply to message
                                          • Post New Poll
                                          • Submit Vote
                                          • Post reward post
                                          • Delete my own posts
                                          • Delete my own threads
                                          • Rate post

                                          2000-2012 ASPPlayground.NET Forum Version 3.8
                                          mbt shoes www.wileywilson.com