Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Progress / Activity Bar as a Class

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

 

 
  
  Printable Version
All Forums >> [Scripting] >> Post a VBScript >> Progress / Activity Bar as a Class
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Progress / Activity Bar as a Class - 2/28/2006 5:02:56 AM   
  DiGiTAL.SkReAM


Posts: 1157
Score: 7
Joined: 9/6/2005
From: Florida, USA
Status: offline
I have posted two progress bars. 

The HTA-based bar - cleaner, looks better, more stable during long executions - can be found here: http://www.visualbasicscript.com/m_32390/tm.htm


And the one posted below is the IE-based one.  I don't like this one as much as it is kinda limited as to what it looks like, and you can't get rid of the title bar. 
I am also no longer supporting it with additional code-updates so any errors are kinda stuck there. heh heh
But some folks like it so I'll leave it around.
=============


Here is a small class that I put together to have a progress or "wait-till-I'm-finished!" bar that pops up while the script goes on with other tasks.
It doesn't really show percent complete or anything, just a series of colored squares that move back and forth while it is showing.  This goes on until
the window is closed.
The text it displays can also be changed on the fly, to reflect changes in status, etc.
This is a pretty heavily modified version of an actual progress indicator from the web, made into a class for ease of use.
Attached is a screenshot of what it looks like when running:



      



Thumbnail Image


Attachment (1)

< Message edited by DiGiTAL.SkReAM -- 7/4/2006 11:09:36 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: 3 | Post #: 1
 
 RE: Progress / Activity Bar as a Class - 3/1/2006 2:34:49 AM   
  ebgreen


Posts: 4613
Score: 31
Joined: 7/12/2005
Status: offline
Very nice. I plan to shanelessly steal this code promptly. 

_____________________________

"... 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 DiGiTAL.SkReAM)
 
 
Post #: 2
 
 RE: Progress / Activity Bar as a Class - 7/4/2006 3:03:58 AM   
  Jack in the Box

 

Posts: 6
Score: 0
Joined: 4/1/2006
Status: offline
Thanks for the updated code.  I've been using your HTA-based progress bar since I first found it and I just happened to come back and see you updated your original post with an IE based progress bar.  I like the changes.

There is one minor error, you're missing the the following line somewhere before Line 41:

Set oShell = CreateObject("Wscript.Shell")

Other then that this piece of code works brilliantly.  Thanks again.

(in reply to ebgreen)
 
 
Post #: 3
 
 RE: Progress / Activity Bar as a Class - 7/10/2006 9:23:41 AM   
  Fredledingue


Posts: 337
Score: 0
Joined: 5/9/2005
From:
Status: offline
Very nice little progressbar.

But why so complicated?

20 lines to erase a registry key, 25 lines to delete a file... are you working for M$ or what?

The most incredible is maybe using the dictionary to form the hta code in a text string.
Why not using...:

HTAcode  =   "some line of code" _
& VbCrlf & "some more line of code" _
& VbCrlf & "some more line of code" _
& VbCrlf & "some more line of code"





_____________________________

Fred

(in reply to Jack in the Box)
 
 
Post #: 4
 
 RE: Progress / Activity Bar as a Class - 7/11/2006 5:12:00 AM   
  DiGiTAL.SkReAM


Posts: 1157
Score: 7
Joined: 9/6/2005
From: Florida, USA
Status: offline
This really should be in the other thread, but I guess it deosn't matter.

To answer your questions, :

quote:


20 lines to erase a registry key


The 20 lines you mention are part of the subKillRegistrykey subroutine.  That routine is taken almost verbatim from the includes file that I use in all of my scripts.  Since it is in the includes file, it needs to be as generic as possible so that it can be used in many different scripts.  And since I am lazy by nature, i figured I would just paste it in with a minimum of trimming... it doesn't hurt anything, and heck, someone else might want to pilfer the code for use in their own scripts in a different way. 

Also, you will notice that it will delete a key, even if there are values, or subkeys under it.

quote:


25 lines to delete a file


By this, I assume that you are referring to the fKillFile function.  That routine is taken almost verbatim from the includes file that I use in all of my scripts.  Since it is in the includes file, it needs to be as generic as possible so that it can be used in many different scripts.  And since I am lazy by nature, i figured I would just paste it in with a minimum of trimming... it doesn't hurt anything, and heck, someone else might want to pilfer the code for use in their own scripts in a different way.

quote:


The most incredible is maybe using the dictionary to form the hta code in a text string.
Why not using...:

HTAcode  =   "some line of code" _
& VbCrlf & "some more line of code" _
& VbCrlf & "some more line of code" _
& VbCrlf & "some more line of code"


I use a dictionary object because that is how I do my string concatenation.  It is about 250 times faster - on average - than doing string = string & newstring.
Of course, if you were just going to be catting a small string

      

then yes, it would be faster to use strings.  BUT, if you are doing a large amount of catting, then it is undeniably faster to use arrays or dictionaries for that than to use strings.  We've done studies on this previously here in the forums, and it has been confirmed.  Because of this speed benefit, I use dictionaries almost exclusively for my string concatenation through the use of a class to handle them that, once again, is in my includes file.

Now, the reason that I included all of these "bloated" functions and subroutines in my ProgressBar class is because they
1.) Work with no difficulty
2.) Provide others with ready-made functions and subs that they can use int heir scripts, almost verbatim from what I have posted here
3.) Are easily pasted in to make my job easier



_____________________________

"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 #: 5
 
 RE: Progress / Activity Bar as a Class - 7/11/2006 6:26:11 AM   
  ebgreen


Posts: 4613
Score: 31
Joined: 7/12/2005
Status: offline
If it makes you feel any better it takes me just shy of 900 lines to write a line to a text file using my Logger class. 

_____________________________

"... 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 DiGiTAL.SkReAM)
 
 
Post #: 6
 
 RE: Progress / Activity Bar as a Class - 7/11/2006 11:11:29 AM   
  Fredledingue


Posts: 337
Score: 0
Joined: 5/9/2005
From:
Status: offline
No problem, Digital Skream!

I was just curious. And I agree: [sarcasm] the most important goal of these routines is that others can use them too in other script. If a beginner reads one of your script, he will learn about almost all the possibilities of VBS. [/sarcasm]

I will analys this interrresting script again in the future. I will find many things that I don't know. Thanks.


About the concatenation of the string... I agree that using arrays and dictionary is much faster than "var = var & text". I myself made some experiments and attended the conversation.
What I don't undertsand is why you need to "concatenate" this string, (except for the fun of it).... because it's a static string!
Look:
in

HTAcode  =   "some line of code" _
& VbCrlf & "some more line of code" _
& VbCrlf & "some more line of code" _
& VbCrlf & "some more line of code"

There is no event, just a value given to a variable.
You could write it like that as well:

HTAcode  =   "some line of code" & VbCrlf & "some more line of code" & VbCrlf & "some more line of code" & VbCrlf & "some more line of code"

...but that's not easy to read in the editor.

In the case of creating an HTA the VbCrlf's are superflous. They are useful only if you want to read the HTA source later for checking.
So it can be like this:

HTAcode  =   "some line of code" _ 
& "some more line of code" _ 
& "some more line of code" _ 
& "some more line of code"

Or does it still takes more time than dashing them in a dictionary?
What does take time is this:

HTAcode  = HTAcode & VbCrlf &  "some line of code"
HTAcode  = HTAcode & VbCrlf & "some more line of code"
HTAcode  = HTAcode & VbCrlf & "some more line of code"
HTAcode  = HTAcode & VbCrlf & "some more line of code"

...because the variable is everytime rewritten in the memory (as I understand). Not when you set it once.
Am I wrong?

_____________________________

Fred

(in reply to ebgreen)
 
 
Post #: 7
 
 RE: Progress / Activity Bar as a Class - 7/11/2006 9:57:25 PM   
  DiGiTAL.SkReAM


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

ORIGINAL: Fredledingue

No problem, Digital Skream!

I was just curious. And I agree: [sarcasm] the most important goal of these routines is that others can use them too in other script. If a beginner reads one of your script, he will learn about almost all the possibilities of VBS. [/sarcasm]

I will analys this interrresting script again in the future. I will find many things that I don't know. Thanks.



Why are you so mad?  I've not been insulting at all, nor have I been a jerk about any of this.  I've just explained why I posted the non-optimized (read: contains more code than is strictly needed to do the job) code that I did, since you questioned me about it.  What's the big deal?  At no point have I ever said that "if a beginner reads one of my scripts he will learn almost all the possibilities of VBS". 

I freely admit that i have only been writing vbscript for about a year now.  Before that, I was limited to quickbasic 4.5 and batch.  So what I don't understand is the sarcasm and general anger that the above snippet of yours seems to be portraying towards me. 
I was under the impression that the purpose of posting code in the Post a VBScript forum was to share snippets of code that we find interesting or usefull and want to share with the community.  If I was mistaken, i sincerely apologize and won't do it again.  I did not mean to step on anyone's toes by posting code or trying to help others with their questions.

I will leave the posting to those of you with far more experience.


_____________________________

"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 #: 8
 
 RE: Progress / Activity Bar as a Class - 7/11/2006 11:23:37 PM   
  ehvbs

 

Posts: 2077
Score: 50
Joined: 6/22/2005
From: Germany
Status: offline
Hi DiGiTAL.SkReAM,

Quote:

   I will leave the posting to those of you with far more experience.

Please don't! I would miss your contributions.

ehvbs

(in reply to DiGiTAL.SkReAM)
 
 
Post #: 9
 
 RE: Progress / Activity Bar as a Class - 7/12/2006 12:40:52 AM   
  Fredledingue


Posts: 337
Score: 0
Joined: 5/9/2005
From:
Status: offline
DigitalSKREAM,

I'm not mad at all and I sincerly do appreciate your input on this forum and your progressbar script in particular.
What I meant above is that, indeed, we can learn a lot of things by reading your code.
I apologize if my reply sounded offensive. It was not intended to be so.







_____________________________

Fred

(in reply to ehvbs)
 
 
Post #: 10
 
 RE: Progress / Activity Bar as a Class - 7/12/2006 11:51:06 AM   
  Fredledingue


Posts: 337
Score: 0
Joined: 5/9/2005
From:
Status: offline
DiGiTAL.SkReAM
 
Here is a link for you
 
http://www.gnu.org/fun/jokes/helloworld.html
 
Seasoned professional! LOL!

_____________________________

Fred

(in reply to Fredledingue)
 
 
Post #: 11
 
 RE: Progress / Activity Bar as a Class - 7/13/2006 3:51:13 AM   
  NssB

 

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

Seasoned professional! LOL!



      


Seasoned what??

Clearly does not get out much and has too much time on one's hands!


_____________________________

Its all about the code!

(in reply to Fredledingue)
 
 
Post #: 12
 
 
 
  

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 >> Progress / Activity Bar as a Class Page: [1]
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