WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Dialogs

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Progressbar using HTA

 Keywords: HTA Javascript Progress Progressbar Status Statusbar HTML Application Splash Screen 

#DefineFunction udfHTAProgress(text)
   title = "waiting" : StrReplace(TimeYmdHms(), ":", "")
   ;filecopy(`\Program Files\WinBatch\programmes\world2.gif`, dirget(), @false)
   size  = 300
   splash_html =                            `<html><head><TITLE>` : title : `</TITLE>`
   splash_html = StrCat(splash_html, @CRLF, `<HTA:APPLICATION ID="my_splash_screen" APPLICATIONNAME="my_splash_screen" BORDER="dialog" CAPTION="no" SHOWINTASKBAR="no" SINGLEINSTANCE="yes" SYSMENU="yes" scroll="no" scrollFlat="yes" />`)
   splash_html = StrCat(splash_html, @CRLF, `<script>window.resizeTo(`, size, `,`, size, `); window.moveTo((screen.width-`, size, `)/2, (screen.height-`, size, `)/2);</script> `)
   splash_html = StrCat(splash_html, @CRLF, `<script language="JavaScript"> var time = 1; function increment() { time++; barre = ""; for(var i=0;i< time %% 19;i++) { barre = barre + '<img src="nothing.gif" width="10" height="10">  '; } document.getElementById('timer').innerHTML = "&nbsp; &nbsp;"+barre+"<br><center>Elapsed time: " + time + " seconds </center>"; window.setTimeout("increment()", 1000); return; } </script>`)
   splash_html = StrCat(splash_html, @CRLF, `</head><body style="background-color: #008080"><table height="100%%" width="100%%"><tr><td valign=middle style="background-color: #008080; color: #ffffff; FONT-FAMILY: Arial, Helvetica, Sans-serif; FONT-WEIGHT: Bold; FONT-STYLE: Normal; FONT-SIZE: 12pt;">`)
   splash_html = StrCat(splash_html, @CRLF, `<center>`, text, `</center><br><br><br><br><span id="timer"><br><br></span>`)
   splash_html = StrCat(splash_html, @CRLF, `</td></tr></table><script language="JavaScript"> window.setTimeout("increment()", 2000); </script></body></html>`)
   FilePut("waiting.hta", splash_html)
   Run(DirGet() : "waiting.hta", "")
   TimeDelay(1)
   winid1 = WinIdGet(title)
   WindowOnTop(winid1, 1)
   TimeDelay(1)
   FileDelete(DirGet() : "waiting.hta")
   Return winid1
#EndFunction

win = udfHTAProgress("CS4 Installation<br>Estimated time : 2500 seconds")

TimeDelay(10)

;put your code here

WinClose(win)

Article ID:   W18257
Filename:   Progressbar using HTA .txt
File Created: 2009:05:29:08:41:44
Last Updated: 2009:05:29:08:41:44