Hey folks! I'm in the beginning stages of putting together a "progress bar" for use in some of my scripts. Eventually, it will probably be a class, but for right now, is a standalone script. My problem is that while everything else works, I can NOT get the stupid thing to exit the script when I close the .HTA window. For example, there is a cancel button, but when clicked, it does some commands, and I can even end the window at that point, but the vbscript itself continues on. Also, I can close it by using Self.Close(), but then that pops up another dialogue "The window is trying to close itself, blah blah."
As a beginner to .HTA stuff, I copied most of this code from another script where I work, just to get a feelf or it, but the result is that I am lost on this last issue. Can anyone help?
_____________________________
"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
It doesn't close because the progressbar is launched via IE as html, NOT as hta.
I tested the progressbar page as an hta and it close immediately without warning message. It's just that it's not resizing. Maybe hta doesn't support resizing. (if someone has info about resizing hta, please post)
I tested the script but it does nothing except showing 4 blocks going left and right until I click "cancel". Looks like the data are not transmited from the vbs to the progressbar.
While you may want not to use that method for some reasons, it's much easier to use intermediary file to wirte datas on one side, read these datas on the other side as I do with my progressbar http://visualbasicscript.com/m_24746/mpage_1/key_progress/tm.htm#24746 Maybe I will do a version of my progressbar in hta...when I have time.
There are also tons of script simplications that can be done in your sample, but that's less important for the moment.
Thanks for the comments, folks. My direction ont his has changed a little, and I am developing it as a class for use in our includes file. There is one thing that is bugging me though... when I open the html windows via obj.IE object, the title bar shows "http://" on the left, then the Title that I assign the window, and then "Microsoft Internet Explorer". Is there a way, other than running it as an .hta, that i can get this behavior to stop?
_____________________________
"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
i got a new way to do status. If you know how long a script will run, or how much operations you do, then you can make a progressbar that shows the exact progress.
below some lines of code i used. (the object declarations you have to add)
Function StatusBar(actstat) Dim strHTML
If actstat = "Start" Then
Set FSTAT = fso.GetFile(FSource) Set ts = FSTAT.OpenAsTextStream(1) ts.Skip(FSTAT.Size)
The Function reads a textfile and counts how much rows it has, then the script part which i didnt post here executes a subroutine for each line in the textfile, every 50 lines it increases the statusbar with the increase value, and finally if the line number ist equal to the maximum line number, it stops the statusbar...
the statusbar increase value is calculated by the count of lines. then 5000 was divided by number of rows to get the exact increase value...
first i increased the statusbar every line, but then it takes tooooo long to execute, 10 times longer... every 50 line is a good value...