Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


.HTA Help

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

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> .HTA Help
  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 >>
 .HTA Help - 2/24/2006 7:54:29 AM   
  DiGiTAL.SkReAM


Posts: 1183
Score: 7
Joined: 9/6/2005
From: Florida, USA
Status: offline
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
 
 
Post #: 1
 
 RE: .HTA Help - 2/26/2006 9:17:16 AM   
  Fredledingue


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


_____________________________

Fred

(in reply to DiGiTAL.SkReAM)
 
 
Post #: 2
 
 RE: .HTA Help - 2/26/2006 6:59:51 PM   
  crazymatt

 

Posts: 296
Score: 0
Joined: 3/4/2005
From:
Status: offline
I use this on my .hta´s to resize em.

Sub bodyLoaded()
window.ResizeTo 176,140 ' WIDTH, HEIGHT
End Sub

Check my proxyswitcher script under the "Post a VBScript " forum.

Hope it helps.

/CM

_____________________________

-There is only 10 sorts of people, those who understand binary and those who dont.

(in reply to Fredledingue)
 
 
Post #: 3
 
 RE: .HTA Help - 2/27/2006 4:08:04 AM   
  DiGiTAL.SkReAM


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

(in reply to crazymatt)
 
 
Post #: 4
 
 RE: .HTA Help - 3/1/2006 11:06:18 PM   
  rOOs


Posts: 63
Score: 0
Joined: 2/28/2006
From: Switzerland
Status: offline
This here is my version of showing the User that somethings is going on:


      

Save it as .hta and let it run. Move the DOS Box away to see what the .hta window shows....

Its like a progress bar. But with no end (you can't always know how long an operation will take, so progressbars are difficult to program)

(in reply to DiGiTAL.SkReAM)
 
 
Post #: 5
 
 RE: .HTA Help - 3/3/2006 6:08:22 AM   
  Country73


Posts: 732
Score: 10
Joined: 8/25/2004
From: USA
Status: offline
Nice little bit of code!


I changed one line in there so that the DOS window wouldn't get in the way.

Return = objShell.Run("cmd /c ping -n 5 " strPC,0,True)


strPC = Machine name

(in reply to rOOs)
 
 
Post #: 6
 
 RE: .HTA Help - 3/8/2006 1:21:38 AM   
  rOOs


Posts: 63
Score: 0
Joined: 2/28/2006
From: Switzerland
Status: offline
thanks ...

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)
 
 FSize = ts.Line
 ts.Close
 set ts = Nothing
 
 'Explorer Open! yeahh! 
 strHTML = "<html><body><p><object classid='clsid:35053A22-8589-11D1-B16A-00C0F0283628' id='ProgressBar1' height='20' width='800'><param name='Min' value='0'><param name='Max' value='100'><param name='Orientation' value='0'><param name='Scrolling' value='1'></object></p></body></html>"
 Set objExplorer = CreateObject("InternetExplorer.Application")
 objExplorer.Navigate "about:blank"
 objExplorer.Document.title = "Bitte warten . . ."  
 objExplorer.Document.body.bgcolor = "buttonface"
 objExplorer.Document.body.Innerhtml = strHTML
 objExplorer.ToolBar = 0
 objExplorer.StatusBar = 0
 objExplorer.Width = 850
 objExplorer.Height = 90
 objExplorer.Left = 50
 objExplorer.Top = 50
 objExplorer.Visible = 1            
 
 Do While (objExplorer.Busy)
     Wscript.Sleep 200
 Loop
   
 intIncrement = 5000/FSize

Elseif actstat = "Inc" Then
 objExplorer.Document.Body.All.ProgressBar1.Value = objExplorer.Document.Body.All.ProgressBar1.Value + intIncrement
  
   Elseif actstat = "Stop" Then 
 objExplorer.Quit
   End If
End Function


Call StatusBar("Start")
Call StatusBar("Inc")
Call StatusBar("Stop")

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...


(in reply to Country73)
 
 
Post #: 7
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> .HTA Help 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