Photo Gallery Member List Search Calendars FAQ Ticket List Log Out



Dynamic Activity Window

 
Logged in as: Guest
arrSession:exec spGetSession 2,16,32390
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> Post a VBScript >> Dynamic Activity Window
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1] 2 3   next >   >>
Login
Message << Older Topic   Newer Topic >>
 Dynamic Activity Window - 3/18/2006 4:21:06 PM  1 votes
  DiGiTAL.SkReAM


Posts: 1200
Score: 7
Joined: 9/6/2005
From: Florida, USA
Status: offline
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')}"


      



Thumbnail Image


Attachment (1)

< Message edited by dm_4ever -- 3/5/2008 2:21:05 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
 
 
Revisions: 5 | Post #: 1
 
 RE: Dynamic Activity Window - 3/19/2006 5:17:16 PM   
  rOOs


Posts: 68
Score: 0
Joined: 2/28/2006
From: Switzerland
Status: offline
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....

(in reply to DiGiTAL.SkReAM)
 
 
Post #: 2
 
 RE: Dynamic Activity Window - 3/19/2006 6:58:08 PM   
  rOOs


Posts: 68
Score: 0
Joined: 2/28/2006
From: Switzerland
Status: offline
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) ...

;-)

(in reply to rOOs)
 
 
Post #: 3
 
 RE: Dynamic Activity Window - 3/19/2006 10:42:15 PM   
  DiGiTAL.SkReAM


Posts: 1200
Score: 7
Joined: 9/6/2005
From: Florida, USA
Status: offline
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

(in reply to rOOs)
 
 
Post #: 4
 
 RE: Dynamic Activity Window - 4/5/2006 2:59:04 AM   
  usavic

 

Posts: 10
Score: 0
Joined: 3/17/2006
Status: offline
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

(in reply to DiGiTAL.SkReAM)
 
 
Post #: 5
 
 RE: Dynamic Activity Window - 4/5/2006 3:01:15 AM   
  ebgreen


Posts: 5646
Score: 32
Joined: 7/12/2005
Status: offline
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

(in reply to usavic)
 
 
Post #: 6
 
 RE: Dynamic Activity Window - 4/5/2006 3:14:17 AM   
  DiGiTAL.SkReAM


Posts: 1200
Score: 7
Joined: 9/6/2005
From: Florida, USA
Status: offline
quote:

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

(in reply to usavic)
 
 
Post #: 7
 
 RE: Dynamic Activity Window - 4/5/2006 3:52:43 AM   
  usavic

 

Posts: 10
Score: 0
Joined: 3/17/2006
Status: offline
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.



      

< Message edited by Snipah -- 4/6/2006 2:03:33 AM >

(in reply to DiGiTAL.SkReAM)
 
 
Revisions: 1 | Post #: 8
 
 RE: Dynamic Activity Window - 4/5/2006 3:58:34 AM   
  ebgreen


Posts: 5646
Score: 32
Joined: 7/12/2005
Status: offline
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

(in reply to usavic)
 
 
Post #: 9
 
 RE: Dynamic Activity Window - 4/5/2006 4:30:38 AM   
  usavic

 

Posts: 10
Score: 0
Joined: 3/17/2006
Status: offline
So I am assuming, I am going to have to declare all the variables since I am using this class??

(in reply to ebgreen)
 
 
Post #: 10
 
 RE: Dynamic Activity Window - 4/5/2006 4:34:41 AM   
  usavic

 

Posts: 10
Score: 0
Joined: 3/17/2006
Status: offline
By the way, is there any way to terminate the script??


(in reply to usavic)
 
 
Post #: 11
 
 RE: Dynamic Activity Window - 4/5/2006 4:42:17 AM   
  ebgreen


Posts: 5646
Score: 32
Joined: 7/12/2005
Status: offline
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

(in reply to usavic)
 
 
Post #: 12
 
 RE: Dynamic Activity Window - 4/5/2006 4:57:39 AM   
  usavic

 

Posts: 10
Score: 0
Joined: 3/17/2006
Status: offline
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??

(in reply to ebgreen)
 
 
Post #: 13
 
 RE: Dynamic Activity Window - 4/5/2006 5:06:44 AM   
  usavic

 

Posts: 10
Score: 0
Joined: 3/17/2006
Status: offline
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

(in reply to usavic)
 
 
Post #: 14
 
 RE: Dynamic Activity Window - 7/11/2006 5:09:34 PM   
  NssB

 

Posts: 32
Score: 0
Joined: 6/25/2006
Status: offline
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!

(in reply to DiGiTAL.SkReAM)
 
 
Post #: 15
 
 RE: Dynamic Activity Window - 7/11/2006 9:44:31 PM   
  DiGiTAL.SkReAM


Posts: 1200
Score: 7
Joined: 9/6/2005
From: Florida, USA
Status: offline
quote:

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

(in reply to NssB)
 
 
Post #: 16
 
 RE: Dynamic Activity Window - 7/13/2006 3:42:31 AM   
  NssB

 

Posts: 32
Score: 0
Joined: 6/25/2006
Status: offline
quote:

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

(in reply to DiGiTAL.SkReAM)
 
 
Post #: 17
 
 RE: Dynamic Activity Window - 7/13/2006 5:36:16 AM   
  ebgreen


Posts: 5646
Score: 32
Joined: 7/12/2005
Status: offline
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

(in reply to NssB)
 
 
Post #: 18
 
 RE: Dynamic Activity Window - 7/16/2006 9:55:24 AM   
  Fredledingue


Posts: 477
Score: 0
Joined: 5/9/2005
From:
Status: offline
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

(in reply to ebgreen)
 
 
Post #: 19
 
 RE: Dynamic Activity Window - 7/18/2006 2:45:22 AM   
  DiGiTAL.SkReAM


Posts: 1200
Score: 7
Joined: 9/6/2005
From: Florida, USA
Status: offline
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

(in reply to Fredledingue)
 
 
Post #: 20
 
 
Page:   [1] 2 3   next >   >>
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> Post a VBScript >> Dynamic Activity Window Page: [1] 2 3   next >   >>
Jump to:





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
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts