Dynamic Activity Window

Change Page: 123 > | Showing page 1 of 3, messages 1 to 20 of 60
Author Message
DiGiTAL.SkReAM

  • Total Posts : 1220
  • Scores: 7
  • Reward points : 0
  • Joined: 9/7/2005
  • Location: Clearwater, FL, USA
  • Status: offline
Dynamic Activity Window - Saturday, March 18, 2006 5:21 PM ( #1 )
Code updated: July 4, 2006
Comments updated: July 18, 2006
This is my HTA-based progress bar.  There are many like it, but this one is mine.  My HTA-based progress bar is my best fri... oh sorry, Full Metal Jacket flashback.  heh heh
In any case, I've updated it with a bunch of private subs to make the main codebase a little cleaner.  Minor tweaks for performance and stability to overcome the issues when running very long scripts the progressbar bombs out.  Also, the class is completely self-contained now, so there no additional functions that need to be utilized.
Enjoy!
**NOTE: The HTA version uses WMI to get a list of the running processes, so will be unstable/unusable on Win9x & WinNT4.0 even with the WMI addon installed.  Users needing a progressbar to run on those OS's should use the IE-based bar located at http://www.visualbasicscript.com/m_31631/tm.htm.
===============

I shamelessly stole the beginnings of this code from http://www.visualbasicscript.com/fb.aspx?m=31585.
I then beat it with a hammer, beat myself with a soup spoon and came up with this little gem
It's a class that pops up an HTA window to show the user that something is going on, and allows
you to change the text in the window to match what you are doing.
The code below contains the class itself, and about 8 lines of code to demonstrate it's use.
All you have to do is paste it into a .vbs file and run the .vbs.
You should see something like the screenshot I am posting.
To modify the colors, change the text on lines 151,152:
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')}"

 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, sInitialTempBuild 
 Public Sub StartBar(sMessageToDisplay)
 Dim sInitialTemp, i
 ExecuteGlobal "Dim oShell, oFSO, oEnv"
 Set oShell = CreateObject("Wscript.Shell")
 Set oFSO = CreateObject("Scripting.FileSystemObject")
 Set oEnv = oShell.Environment("Process")
 For i = 1 To 16
 sInitialTempBuild = sInitialTempBuild & Chr(fRand(97,122))
 Next
 sInitialTemp = oFSO.GetDriveName(oEnv("TEMP")) & "\" & sInitialTempBuild & "\" & oFSO.GetFileName(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, CommandLine FROM Win32_Process where Name = 'mshta.exe'" & Chr(34) & ")" 
 oBarCat.Add oBarCat.Count, "   For Each oItem in cItems" 
 oBarCat.Add oBarCat.Count, "    If oItem.CommandLine = document.Location.pathname Then" 
 oBarCat.Add oBarCat.Count, "     oShell.AppActivate oItem.Handle" 
 oBarCat.Add oBarCat.Count, "    End If" 
 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 = oFSO.GetDriveName(oEnv("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.DeleteFolder " & Chr(34) & oFSO.GetDriveName(oEnv("TEMP")) & "\" & sInitialTempBuild & 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 Function fRand(iLowerLimit,iUpperLimit)
 ExecuteGlobal "Dim bRandomized"
 If bRandomized <> True Then Randomize
 bRandomized = True    
 fRand = Int((iUpperLimit - iLowerLimit + 1)*Rnd() + iLowerLimit) 
 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
 



[image]local://8013/537B5E8D889D454C94E517898922BB01.jpg[/image]
<message edited by dm_4ever on Wednesday, March 05, 2008 3:21 AM>
Attachments are not available: Download requirements not met - - -
"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
rOOs

  • Total Posts : 67
  • Scores: 0
  • Reward points : 0
  • Joined: 2/28/2006
  • Location: Switzerland
  • Status: offline
RE: Dynamic Activity Window - Sunday, March 19, 2006 6:17 PM ( #2 )
I see you shamelessly stole the code and modified it promptly :-P
 
Question: (i just copied the code and run it)
Is it necessary to write the files?
isn't it possible to just dynamically change the content of the hta?
 
with the internetexplorer object it would go. You just use sth. like: objIE.document.body.innerhtml = "<html><body>test</body></html>"
 
but the rest is GREAT....
rOOs

  • Total Posts : 67
  • Scores: 0
  • Reward points : 0
  • Joined: 2/28/2006
  • Location: Switzerland
  • Status: offline
RE: Dynamic Activity Window - Sunday, March 19, 2006 7:58 PM ( #3 )
btw: delete this line of code:
 
    subBarCat " document.title = document.title"
 
it doesn't do anything ;-)  its a bit code that i used to change the Title of the Window dynamically and you deleted the dynamical thing of it (the strVer Value) ...
 
;-)
 
DiGiTAL.SkReAM

  • Total Posts : 1220
  • Scores: 7
  • Reward points : 0
  • Joined: 9/7/2005
  • Location: Clearwater, FL, USA
  • Status: offline
RE: Dynamic Activity Window - Sunday, March 19, 2006 11:42 PM ( #4 )
I know that an IE object being opened from a vbs is able to be updated, but I am not so sure about an hta.
From what I gathered on the net, writing a file and having the hta pick out the data was the only way to get the job done.
 
As I am admittedly weak when it comes to html or hta design, etc. I will let others make any modifications to the code they see fit, rather than trying to 'perfect' the html. heh heh
 
And thanks for the original code, btw!
"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
usavic

  • Total Posts : 10
  • Scores: 0
  • Reward points : 0
  • Joined: 3/17/2006
  • Status: offline
RE: Dynamic Activity Window - Wednesday, April 05, 2006 3:59 AM ( #5 )
Hey there. I am trying to implement this class in my printer installing code, and for some reason it is coflicting with the WshShell
'**************Load Prnadmin.dll*****************
Set WshShell = Wscript.CreateObject("Wscript.Shell")
WshShell.Run "regsvr32 Prnadmin.dll /s",1,TRUE
'*****************************************************
 
Is there anything else in the implementaion I should know about??
 
By the way, good job, it looks slick
ebgreen

  • Total Posts : 6660
  • Scores: 61
  • Reward points : 0
  • Joined: 7/12/2005
  • Status: online
RE: Dynamic Activity Window - Wednesday, April 05, 2006 4:01 AM ( #6 )
What is the conflict? Do you get an error? What is the error? Could you post all the code that you are running and point out the problem line(s)?
"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm
DiGiTAL.SkReAM

  • Total Posts : 1220
  • Scores: 7
  • Reward points : 0
  • Joined: 9/7/2005
  • Location: Clearwater, FL, USA
  • Status: offline
RE: Dynamic Activity Window - Wednesday, April 05, 2006 4:14 AM ( #7 )

ORIGINAL: usavic

Hey there. I am trying to implement this class in my printer installing code, and for some reason it is coflicting with the WshShell
'**************Load Prnadmin.dll*****************
Set WshShell = Wscript.CreateObject("Wscript.Shell")
WshShell.Run "regsvr32 Prnadmin.dll /s",1,TRUE
'*****************************************************

 
What kind of conflict are you getting?  I don't use anything named WshShell in my code, so unless you changed something, it shouldn't be conflicting with anything.
From what code you posted, it looks like yer just registering a .dll file, but I don't see where that would affect anything else in the script.
The best thing that you could do, would be to take ebgrren's advice, and post the entire code that you are trying to run, along with an explanation of the errors you are receiving.
 
"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
usavic

  • Total Posts : 10
  • Scores: 0
  • Reward points : 0
  • Joined: 3/17/2006
  • Status: offline
RE: Dynamic Activity Window - Wednesday, April 05, 2006 4:52 AM ( #8 )
Here is my whole code. The conflicts appears depending on which I put first. If I put the Option explicit first it won't execute the wShell and viceversa. No matter what, it allways ends up in a endless loop. Here's the code.


 
 '*****************Code to work work in progress************************
 Option Explicit 
 Dim oBar
 Set oBar = New ProgressBar
 oBar.StartBar "Your printer will now be installed"
 WScript.Sleep(3000)
 oBar.SetLine "Your printer is being installed"
 WScript.Sleep(3000)
 
 '*****************End of code to show work in progress******************
 '**************Load Prnadmin.dll*****************
 Set WshShell = Wscript.CreateObject("Wscript.Shell")
 WshShell.Run "regsvr32 Prnadmin.dll /s",1,TRUE
 '*****************************************************
 
 '*********************This is the installation of the printers, but it never gets here***************
 
 '*************Copy Files to users computer*******
 set filesys=CreateObject("Scripting.FileSystemObject")
   filesys.CopyFolder "Canon Irunner 5000i", "C:\Program Files\"
 '*******************************************************
 '*************Copy Files to users computer*******
 set filesys=CreateObject("Scripting.FileSystemObject")
   filesys.CopyFolder "Canon Irunner 5020i", "C:\Program Files\"
 '*******************************************************
 '*********************Put all ports into a string*******************
 Set objDictionary = CreateObject("Scripting.Dictionary")
 strComputer = "."
 Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
 Set colPrinters =  objWMIService.ExecQuery _
    ("Select * from Win32_Printer")
 For Each objPrinter in colPrinters 
    objDictionary.Add objPrinter.PortName, objPrinter.PortName
 Next
 
 Set colPorts = objWMIService.ExecQuery _
    ("Select * from Win32_TCPIPPrinterPort")
 For Each objPort in colPorts
    If objDictionary.Exists(objPort.Name) Then
        strPorts = strPorts & _
            objDictionary.Item(objPort.Name) & VbCrLf
    Else
        strPorts = strPorts & objPort.Name & vbCrLf
    End If
 Next
 '*******************************************************
 
 
 '*************************************Add second printer******************
 '**************************Create and add a port****************************
 set oPort = CreateObject("Port.Port.1")
 set oMaster = CreateObject("PrintMaster.PrintMaster.1")
 'Indicate where to add the port. Double quotes ("" ) stand for the local computer, which is the default.??????
 oPort.ServerName = ""
 'The name of the port cannot be omitted.
 oPort.PortName = "IP_10.30.4.57"
 'The type of the port can be 1 (TCP RAW), 2 (TCP LPR), or 3 (standard local).
 oPort.PortType = 1
 'Mandatory for TCP ports. This is the address of the device to which the port connects.
 oPort.HostAddress = "10.30.4.57"
 'For TCP RAW ports. Default is 9100.
 oPort.PortNumber = 9100
 'Enable or disable SNMP.
 oPort.SNMP = true
 'If SNMP is enabled, 1 is the default for index.
 oPort.SNMPDeviceIndex = 1
 'If SNMP is enabled, "public" is the default community name.
 oPort.CommunityName = "public"
 
 '******************Check for existing ports and adding**********************
 If InStr(strPorts, oPort.PortName) Then
 Else
 'Add the port.
 oMaster.PortAdd oPort
 End if
 '********************End of CHeck*******************************
 '*********************************Add the drivers printer**********************************
 'The following code creates the required PrintMaster and Printer objects.
 set oMaster = CreateObject("PrintMaster.PrintMaster.1")
 set oPrinter = CreateObject("Printer.Printer.1")
 'The following code assigns a name to the printer. The string is required and cannot be empty. 
 oPrinter.PrinterName = "Canon iR5000-6000 PS3"
 'The following code specifies the printer driver to use. The string is required and cannot be empty. 
 oPrinter.DriverName  = "Canon iR5000-6000 PS3"
 'The following code specifies the printer port to use. The string is required and cannot be empty. 
 oPrinter.PortName    = "IP_10.30.4.57"
 'The following code specifies the location of the printer driver. This setting is optional, because by default
 'the drivers are picked up from the driver cache directory.
 oPrinter.DriverPath  = "C:\Program Files\Canon Irunner 5000i"
 'The following code specifies the location of the INF file. This setting is optional, because by default the INF
 'file is picked up from the %windir%\inf\ntprint.inf directory.
 oPrinter.InfFile = "C:\Program Files\Canon Irunner 5000i\W2KPS3U.inf"
 'The following code adds the printer.
 oMaster.PrinterAdd oPrinter
 '***********************************ADD THE 3RD PRINTER***************************************
 '***********Create a port***************************
 set oPort = CreateObject("Port.Port.1")
 set oMaster = CreateObject("PrintMaster.PrintMaster.1")
 
 'Indicate where to add the port. Double quotes ("" ) stand for the local computer, which is the default.??????
 oPort.ServerName = ""
 'The name of the port cannot be omitted.
 oPort.PortName = "IP_10.30.5.22"
 'The type of the port can be 1 (TCP RAW), 2 (TCP LPR), or 3 (standard local).
 oPort.PortType = 1
 'Mandatory for TCP ports. This is the address of the device to which the port connects.
 oPort.HostAddress = "10.30.5.22"
 'For TCP RAW ports. Default is 9100.
 oPort.PortNumber = 9100
 'Enable or disable SNMP.
 oPort.SNMP = true
 'If SNMP is enabled, 1 is the default for index.
 oPort.SNMPDeviceIndex = 1
 'If SNMP is enabled, "public" is the default community name.
 oPort.CommunityName = "public"
 
 '******************Check for existing ports**********************
 If InStr(strPorts, oPort.PortName) Then
 Else
 'add the port.
 oMaster.PortAdd oPort
 End if
 '********************End of CHeck*******************************
 
 'The following code creates the required PrintMaster and Printer objects.
 set oMaster = CreateObject("PrintMaster.PrintMaster.1")
 set oPrinter = CreateObject("Printer.Printer.1")
 'The following code assigns a name to the printer. The string is required and cannot be empty. 
 oPrinter.PrinterName = "Canon iR5020/iR6020 PS3"
 'The following code specifies the printer driver to use. The string is required and cannot be empty. 
 oPrinter.DriverName  = "Canon iR5020/iR6020 PS3"
 'The following code specifies the printer port to use. The string is required and cannot be empty. 
 oPrinter.PortName    = "IP_10.30.5.22"
 'The following code specifies the location of the printer driver. This setting is optional, because by default
 'the drivers are picked up from the driver cache directory.
 oPrinter.DriverPath  = "C:\Program Files\Canon Irunner 5020i"
 'The following code specifies the location of the INF file. This setting is optional, because by default the INF
 'file is picked up from the %windir%\inf\ntprint.inf directory.
 oPrinter.InfFile     = "C:\Program Files\Canon Irunner 5020i\W2KPS3U.inf"
 'The following code adds the printer.
 oMaster.PrinterAdd oPrinter
 oBar.CloseBar
 
 
 If Err <> 0 then
 msgbox "There was an error creating the printer."
 Else
 MsgBox "Your printer is now installed"
 end if
 '************************End of installation of printers***************************
 '********************************Class*****************
 
 Class ProgressBar
 
 
 Dim sProgressBarHTAFile, sProgressBarRunFile, sProgressBarSleepFile
 Dim sProgressBarMsgFile, oShell, oFSO, iBarElementCount, sProgressBarHTAFileKiller
 Dim sTempRoot, sProgressBarMsgTempFile, sInitialTemp, aHTATextCat, oFileToWrite
 Private Sub Class_Initialize()
    Set oShell = CreateObject("Wscript.Shell")
    Set oFSO = CreateObject("Scripting.FileSystemObject")
    sTempRoot = oShell.ExpandEnvironmentStrings("%TEMP%") & "\"
    ReDim aHTATextCat(0)
 End Sub
 
 Public Sub StartBar(sMessageToDisplay)
    sInitialTemp = oFSO.GetTempName
    sProgressBarHTAFile = sTempRoot & oFSO.GetBaseName(sInitialTemp) & ".hta"
    sProgressBarRunFile = sTempRoot & oFSO.GetBaseName(sInitialTemp) & ".run"
    sProgressBarSleepFile = sTempRoot & oFSO.GetBaseName(sInitialTemp) & "sleep.vbs"
    sProgressBarMsgFile = sTempRoot & oFSO.GetBaseName(sInitialTemp) & ".msg"
    subBarCat "<html>"
    subBarCat "<head>"
    subBarCat "<title id=" & Chr(34) & "title" & Chr(34) & ">Please Wait</title>"
    subBarCat "<HTA:APPLICATION "
    subBarCat "    ID=" & Chr(34) & "StatusBar" & Chr(34) & ""
    subBarCat "    APPLICATIONNAME=" & Chr(34) & "StatusBar" & Chr(34) & ""
    subBarCat "    SCROLL=" & Chr(34) & "no" & Chr(34) & ""
    subBarCat "    SINGLEINSTANCE=" & Chr(34) & "yes" & Chr(34) & ""
    subBarCat "    caption=" & Chr(34) & "no" & Chr(34) & ""
    subBarCat "    BORDER=" & Chr(34) & "no" & Chr(34) & ""
    subBarCat "    BORDERSTYLE=" & Chr(34) & "normal" & Chr(34) & ""
    subBarCat "    MAXIMIZEBUTTON=" & Chr(34) & "no" & Chr(34) & ""
    subBarCat "    MINIMIZEBUTTON=" & Chr(34) & "yes" & Chr(34) & ""
    subBarCat "    SYSMENU=" & Chr(34) & "no" & Chr(34) & ""
    subBarCat "    CONTEXTMENU=" & Chr(34) & "NO" & Chr(34) & ""
    subBarCat "    WINDOWSTATE=" & Chr(34) & "normal" & Chr(34) & ""
    subBarCat "    ShowInTaskBar=" & Chr(34) & "no" & Chr(34) & ""
    subBarCat "    />"
    subBarCat "<SCRIPT Language=" & Chr(34) & "VBScript" & Chr(34) & ">"
    subBarCat "Set objShell = CreateObject(" & Chr(34) & "Wscript.Shell" & Chr(34) & ")"
    subBarCat "Set oFSO = CreateObject(" & Chr(34) & "Scripting.FileSystemObject" & Chr(34) & ")"
    subBarCat "Dim strTimer, strTimerCnt, sPID, iCID, sStatusMsg, sStatusMsgFile, oStatusMsgFile"
    subBarCat "sPID = " & Chr(34) & "" & Chr(34) & ""
    subBarCat "iCID = 10"
    subBarCat "sStatusMsgFile = " & Chr(34) & sProgressBarMsgFile & Chr(34) & ""
    subBarCat " Sub Window_Onload"
    subBarCat " window.resizeTo 320,250"
    subBarCat " Stats " & Chr(34) & "Init" & Chr(34) & ""
    subBarCat " document.title = document.title"
    subBarCat " oFSO.CreateTextFile(" & Chr(34) & sProgressBarRunFile & Chr(34) & ")"
    subBarCat " oFSO.CreateTextFile(" & Chr(34) & sProgressBarSleepFile & Chr(34) & ")"
    subBarCat " Set oVBS = oFSO.OpenTextFile(" & Chr(34) & sProgressBarSleepFile & Chr(34) & ",2)"
    subBarCat " oVBS.WriteLine " & Chr(34) & "WScript.Sleep(1000)" & Chr(34) & ""
    subBarCat " oVBS.Close"
    subBarCat "Dim oWMIService, cItems, oItem"
    subBarCat "Set oWMIService = GetObject(" & Chr(34) & "winmgmts:\\.\root\CIMV2" & Chr(34) & ")"
    subBarCat "Set cItems = oWMIService.ExecQuery(" & Chr(34) & "SELECT Name, ExecutablePath FROM Win32_Process where Name = 'mshta.exe'" & Chr(34) & ")"
    subBarCat "For Each oItem in cItems"
    subBarCat "   sPID = oItem.Handle"
    subBarCat "Next"
    subBarCat " Do While oFSO.FileExists(" & Chr(34) & sProgressBarRunFile & Chr(34) & ")"
    subBarCat "    objShell.Run " & Chr(34) & sProgressBarSleepFile & Chr(34) & ",0,True"
    subBarCat "      objShell.AppActivate sPID"
    subBarCat " Loop "
    subBarCat " oFSO.DeleteFile " & Chr(34) & sProgressBarSleepFile & Chr(34) & ", True "
    subBarCat " Stats " & Chr(34) & "End" & Chr(34) & ""
    subBarCat " window.Close"
    subBarCat " End Sub"
    subBarCat " Sub Stats(strStatus)"
    subBarCat " If strStatus = " & Chr(34) & "Init" & Chr(34) & " Then"
    subBarCat "   strTimer = window.setInterval(" & Chr(34) & "Stats('Run')" & Chr(34) & ", 175)"
    subBarCat " Elseif strStatus = " & Chr(34) & "Run" & Chr(34) & " Then"
    subBarCat "Select Case iCID"
    subBarCat "      Case 10"
    subBarCat "         strTimerCnt =" & Chr(34) & "ooooo" & Chr(34) & ""
    subBarCat "         objShell.AppActivate sPID"
    subBarCat "         iCID = 0"
    subBarCat "      Case 0"
    subBarCat "        strTimerCnt =  " & Chr(34) & "oooon" & Chr(34) & ""
    subBarCat "         objShell.AppActivate sPID"
    subBarCat "         iCID = 1"
    subBarCat "      Case 1"
    subBarCat "        strTimerCnt =  " & Chr(34) & "ooono" & Chr(34) & ""
    subBarCat "         objShell.AppActivate sPID"
    subBarCat "         iCID = 2"
    subBarCat "      Case 2"
    subBarCat "        strTimerCnt =  " & Chr(34) & "oonoo" & Chr(34) & ""
    subBarCat "         objShell.AppActivate sPID"
    subBarCat "         iCID = 3"
    subBarCat "      Case 3"
    subBarCat "        strTimerCnt =  " & Chr(34) & "onooo" & Chr(34) & ""
    subBarCat "         objShell.AppActivate sPID"
    subBarCat "         iCID = 4"
    subBarCat "      Case 4"
    subBarCat "        strTimerCnt =  " & Chr(34) & "noooo" & Chr(34) & ""
    subBarCat "         objShell.AppActivate sPID"
    subBarCat "         iCID = 5"
    subBarCat "      Case 5"
    subBarCat "        strTimerCnt =  " & Chr(34) & "onooo" & Chr(34) & ""
    subBarCat "         objShell.AppActivate sPID"
    subBarCat "         iCID = 6"
    subBarCat "      Case 6"
    subBarCat "        strTimerCnt =  " & Chr(34) & "oonoo" & Chr(34) & ""
    subBarCat "         objShell.AppActivate sPID"
    subBarCat "         iCID = 7"
    subBarCat "      Case 7"
    subBarCat "        strTimerCnt =  " & Chr(34) & "ooono" & Chr(34) & ""
    subBarCat "         objShell.AppActivate sPID"
    subBarCat "         iCID = 8"
    subBarCat "      Case 8"
    subBarCat "        strTimerCnt =  " & Chr(34) & "oooon" & Chr(34) & ""
    subBarCat "         objShell.AppActivate sPID"
    subBarCat "         iCID = 1"
    subBarCat "   End Select "
    subBarCat "   document.getElementById(" & Chr(34) & "Stats" & Chr(34) & ").innerHTML = strTimerCnt"
    subBarCat "   If oFSO.FileExists(sStatusMsgFile) and oFSO.GetFile(sStatusMsgFile).Size <> 0 Then"
    subBarCat "      Set oStatusMsgFile = oFSO.OpenTextFile(sStatusMsgFile, 1)"
    subBarCat "      sStatusMsg = oStatusMsgFile.ReadAll"
    subBarCat "      oStatusMsgFile.Close"
    subBarCat "         If Trim(sStatusMsg) <> " & Chr(34) & "" & Chr(34) & " Then "
    subBarCat "            sStatusMsg = Replace(sStatusMsg, VbCrLf, " & Chr(34) & "<br>" & Chr(34) & ")"
    subBarCat "         Else"
    subBarCat "            sStatusMsg = " & Chr(34) & "" & Chr(34) & ""
    subBarCat "      End If "
    subBarCat "   Else"
    subBarCat "      sStatusMsg = " & Chr(34) & "" & Chr(34) & ""
    subBarCat "   End If "
    subBarCat "   document.getElementById(" & Chr(34) & "MyMsg" & Chr(34) & ").innerHTML = sStatusMsg"
    subBarCat " Elseif strStatus = " & Chr(34) & "End" & Chr(34) & " Then"
    subBarCat "   window.clearInterval(strTimer)"
    subBarCat "   document.getElementById(" & Chr(34) & "Stats" & Chr(34) & ").innerHTML = " & Chr(34) & "" & Chr(34) & ""
    subBarCat "   oFSO.DeleteFile " & chr(34) & sProgressBarMsgFile & Chr(34) & ", True"
    subBarCat " End If"
    subBarCat " End Sub"
    subBarCat "</SCRIPT>"
    subBarCat "<style>"
     'Change the settings in the two lines below to alter the colors of the window
    subBarCat "body,td,a {font-family:Arial;font-size:12px;text-decoration:none;color:black;}"
    subBarCat "body {filter:progid:DXImageTransform.Microsoft.Gradient(GradientType=0, StartColorStr='#9999FF', EndColorStr='#FFFFFF')}"
    subBarCat ".pix {width: 1px; height 1px;}"
    subBarCat "</style>"
    subBarCat "</head>"
    subBarCat "<body>"
    subBarCat "<center>"
    subBarCat "<table width=" & Chr(34) & "275" & Chr(34) & ">"
    subBarCat " <tr><td>"
    subBarCat "   <fieldset><legend align=" & Chr(34) & "center" & Chr(34) & "><b> Please Be Patient </b></legend>"
    subBarCat "     <br><center>"
    subBarCat "       <span id=Stats style=" & Chr(34) & "font-family: wingdings;font-weight: bold;font-size:20px;" & Chr(34) & "></span>"
    subBarCat "     </center><br><br>"
    subBarCat "   </fieldset>"
    subBarCat " </td></tr>"
    subBarCat "</table>"
    subBarCat "<span id=MyMsg style=" & Chr(34) & "font-family: Ariel;font-size:12px;" & Chr(34) & "></span>"
    subBarCat "</body>"
    subBarCat "</html>"
    subWriteFile sProgressBarHTAFile, Join(aHTATextCat,VbCrLf)
    subWriteFile sProgressBarMsgFile, sMessageToDisplay
    oShell.Run sProgressBarHTAFile, 1, False 
 End Sub
 
 Private Sub subBarCat(sStringToAdd)
    ReDim Preserve aHTATextCat(iBarElementCount)
    aHTATextCat(iBarElementCount) = sStringToAdd
    iBarElementCount = iBarElementCount + 1
 End Sub
 
 Public Sub CloseBar()
    subKillFile sProgressBarRunFile
    sProgressBarHTAFileKiller = sTempRoot & "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)
    sProgressBarMsgTempFile = sTempRoot & oFSO.GetTempName & ".tmp"
    subWriteFile sProgressBarMsgTempFile, sNewText      
    subKillFile sProgressBarMsgFile
    oFSO.MoveFile sProgressBarMsgTempFile, sProgressBarMsgFile
 End Sub 
 
 Private Sub subKillFile(sFileToKill)
       If oFSO.FileExists(sFileToKill) Then oFSO.DeleteFile sFileToKill, True 
 End Sub
 Private Sub subWriteFile(sFileToWrite, sTextToWrite)
       If not oFSO.FileExists(sFileToWrite) Then oFSO.CreateTextFile sFileToWrite
    Set oFileToWrite = oFSO.OpenTextFile(sFileToWrite,8)
    oFileToWrite.WriteLine sTextToWrite
    oFileToWrite.Close
 End Sub
 Private Sub Class_Terminate()
 End Sub 
 End Class 
 

<message edited by Snipah on Thursday, April 06, 2006 3:03 AM>
ebgreen

  • Total Posts : 6660
  • Scores: 61
  • Reward points : 0
  • Joined: 7/12/2005
  • Status: online
RE: Dynamic Activity Window - Wednesday, April 05, 2006 4:58 AM ( #9 )
Put:

Dim WshShell

just after the Option Explicit line


"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm
usavic

  • Total Posts : 10
  • Scores: 0
  • Reward points : 0
  • Joined: 3/17/2006
  • Status: offline
RE: Dynamic Activity Window - Wednesday, April 05, 2006 5:30 AM ( #10 )
So I am assuming, I am going to have to declare all the variables since I am using this class??
usavic

  • Total Posts : 10
  • Scores: 0
  • Reward points : 0
  • Joined: 3/17/2006
  • Status: offline
RE: Dynamic Activity Window - Wednesday, April 05, 2006 5:34 AM ( #11 )
By the way, is there any way to terminate the script??
 
 
ebgreen

  • Total Posts : 6660
  • Scores: 61
  • Reward points : 0
  • Joined: 7/12/2005
  • Status: online
RE: Dynamic Activity Window - Wednesday, April 05, 2006 5:42 AM ( #12 )
Anytime you use Option Explicit you must Dim all variables. That is its purpose.

WScript.Quit will terminate execution.
"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm
usavic

  • Total Posts : 10
  • Scores: 0
  • Reward points : 0
  • Joined: 3/17/2006
  • Status: offline
RE: Dynamic Activity Window - Wednesday, April 05, 2006 5:57 AM ( #13 )
So after declaring the variables, my script runs fine and the activity window shows, but it stays there as if in an infinite loop. Any suggestions??
usavic

  • Total Posts : 10
  • Scores: 0
  • Reward points : 0
  • Joined: 3/17/2006
  • Status: offline
RE: Dynamic Activity Window - Wednesday, April 05, 2006 6:06 AM ( #14 )
So my antyspyware kept detecting it and creating a delay that would throw it into the loop. Now it's working perfectly. Thanx so much for the help, I really appreciate it, and it's been very useful
NssB

  • Total Posts : 31
  • Scores: 0
  • Reward points : 0
  • Joined: 6/26/2006
  • Status: offline
RE: Dynamic Activity Window - Tuesday, July 11, 2006 6:09 PM ( #15 )
Strange....
 
Copy/Pasted exactly what you have into VBS file....ran it and got.......
 
Line: 162
Code: 2
Error: The system cannot find the file specified
Number: 80070002
 
This line points to: " oBarCat.Add oBarCat.Count, "</table>""
 
 
Any ideas?
Its all about the code!
DiGiTAL.SkReAM

  • Total Posts : 1220
  • Scores: 7
  • Reward points : 0
  • Joined: 9/7/2005
  • Location: Clearwater, FL, USA
  • Status: offline
RE: Dynamic Activity Window - Tuesday, July 11, 2006 10:44 PM ( #16 )

ORIGINAL: NssB

Strange....

Copy/Pasted exactly what you have into VBS file....ran it and got.......

Line: 162
Code: 2
Error: The system cannot find the file specified
Number: 80070002

This line points to: " oBarCat.Add oBarCat.Count, "</table>""


Any ideas?

 
Very strange.  I copy/pasted the code from my post into a new .vbs, and it worked fine.  And my line 162 is a bit different from yours.
"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
NssB

  • Total Posts : 31
  • Scores: 0
  • Reward points : 0
  • Joined: 6/26/2006
  • Status: offline
RE: Dynamic Activity Window - Thursday, July 13, 2006 4:42 AM ( #17 )

Very strange.  I copy/pasted the code from my post into a new .vbs, and it worked fine.  And my line 162 is a bit different from yours.


ok, starting to get very weird now. Tried it on XP machine at home, working 100%

I use a Win2K machine at work. Could this be an issue?

Regards
NssB
ebgreen

  • Total Posts : 6660
  • Scores: 61
  • Reward points : 0
  • Joined: 7/12/2005
  • Status: online
RE: Dynamic Activity Window - Thursday, July 13, 2006 6:36 AM ( #18 )
What is the version of WSH on each machine?
"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm
Fredledingue

  • Total Posts : 507
  • Scores: 0
  • Reward points : 0
  • Joined: 5/9/2005
  • Location:
  • Status: offline
RE: Dynamic Activity Window - Sunday, July 16, 2006 10:55 AM ( #19 )
Running on w98 but with WSH 5.6, I get an error. (at least with the HTA version of this progress bar)
Probably because of the WMI object that doesn't exists on w98 
Fred
DiGiTAL.SkReAM

  • Total Posts : 1220
  • Scores: 7
  • Reward points : 0
  • Joined: 9/7/2005
  • Location: Clearwater, FL, USA
  • Status: offline
RE: Dynamic Activity Window - Tuesday, July 18, 2006 3:45 AM ( #20 )
I updated the comments to reflect the WMI issue.  Good catch!  I don't utilize Win98 anywhere anymore, so am unable to do any testing.
 
It probably won't work with Windows for Workgroups 3.11 either. heh heh
"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
Change Page: 123 > | Showing page 1 of 3, messages 1 to 20 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-2009 ASPPlayground.NET Forum Version 3.6