![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | How to display a progress window Hi Is it possible to show a window from a VBScript? I would like to show some status while the script is working. The script is run from WSH on the command line. Thanks Sub BigProcess Dim I <Show a progess window> "Starting..." For I = 1 To 100 Call DoSomething(I) <Update the progress window> "Done: " & FormatNumber(I) & "%" Next <Close the progress window> End Sub |
My System Specs![]() |
| | #2 (permalink) |
| | Re: How to display a progress window Maybe this will get you started: <html> <HEAD> <TITLE>This is the Application Caption</TITLE> <HTA:APPLICATION ID="oApp" APPLICATIONNAME="Splash Screen" BORDER="thick" MAXIMIZEBUTTON="yes" MINIMIZEBUTTON="yes" CAPTION="YES" ICON="C:\Program Files\RBTI\RBG7\Samples\Icons\win1.ico" SHOWINTASKBAR="yes" SINGLEINSTANCE="yes" SYSMENU="yes" WINDOWSTATE="normal"> <SCRIPT> var cntr = 0; var ID = 0; function UpdateTimer() { cntr = cntr - 5000; } function UpdateProg() { //debugger; //var IDtx; if (ID <= 9) { document.getElementById('C' + ID.toString()).bgColor="blue"; } //IDtx.bgcolor=blue; ID++; cntr = cntr-5000; } function init() { cntr = 30000; UpdateProg(); var UpdateTime = window.setInterval('UpdateProg()',1000); return; } function Terminate() { window.clearTimeout(); // window.close(); } </SCRIPT> </HEAD> <body onload="init(); return false;" onUnload="Terminate(); return false;"> <table width="100%" cellpadding="0" cellspacing="0" hspace="0" vspace="0" height=20> <tr> <td width="10%" bgcolor=white id="C0"></td> <td width="10%" bgcolor=white id="C1"></td> <td width="10%" bgcolor=white id="C2"></td> <td width="10%" bgcolor=white id="C3"></td> <td width="10%" bgcolor=white id="C4"></td> <td width="10%" bgcolor=white id="C5"></td> <td width="10%" bgcolor=white id="C6"></td> <td width="10%" bgcolor=white id="C7"></td> <td width="10%" bgcolor=white id="C8"></td> <td width="10%" bgcolor=white id="C9"></td> </tr> </table> </body> </html> "Pascal Boivin" <pascal.boivin@xxxxxx> wrote in message news:xn0gd1c1l88e6w000@xxxxxx Quote: > Hi > > Is it possible to show a window from a VBScript? I would like to show > some status while the script is working. The script is run from WSH on > the command line. > > Thanks > > Sub BigProcess > Dim I > <Show a progess window> "Starting..." > For I = 1 To 100 > Call DoSomething(I) > <Update the progress window> "Done: " & FormatNumber(I) & "%" > Next > <Close the progress window> > End Sub |
My System Specs![]() |
| | #3 (permalink) |
| | Re: How to display a progress window On Jul 24, 12:01*pm, "Pascal Boivin" <pascal.boi...@xxxxxx> wrote: Quote: > Hi > > Is it possible to show a window from a VBScript? *I would like to show > some status while the script is working. *The script is run from WSH on > the command line. > > Thanks > > Sub BigProcess > Dim I > * <Show a progess window> "Starting..." > * For I = 1 To 100 > * * Call DoSomething(I) > * * <Update the progress window> "Done: " & FormatNumber(I) & "%" > * Next > * <Close the progress window> > End Sub Dim oIE, oPgCtl, i Set oIE = CreateObject("InternetExplorer.Application") oPgCtl = ProgressBar(oIE) ' Create control and return object array ' properties can be altered before revealing bar ' For example, ... oPgCtl(0).max = 250 oIE.Visible = 1 ' Reveals the progress bar ' For example, write an initial message to Message Area oPgCtl(1).innerHTML = "<font size=+1><b>Running ...</b></font>" ' Simulate a proccess delay & update progress bar With oPgCtl(0) ' Progress bar For i=.min to .max step 10 ' step changes progress bar increment .value = CSng(i) Wscript.sleep 100 ' process goes here Next End With ' For example, write closing message to Message Area oPgCtl(1).innerHTML = "<font size=+1><b>Maximum reached: " _ & oPgCtl(0).value & "</b></font>" wsh.sleep 2000 ' wait 2 seconds - just for demo oIE.quit ' ------------------------------------------------------------------- ' Requires "InternetExplorer.Application" object (oIE) input ' Returns two element array: ' ' element 0 is the Progress Bar control object - 5 properties ' .focus, .value, .min, .max, .appearance & .borderstyle ' ' element 1 is a message area to receive progress text (HTML) ' Function ProgressBar(oIE) Dim oPgCtl, h, w With oIE .RegisterAsDropTarget = False .Resizable = 0 : addressbar = 0 : menubar = 0 : .toolbar = 0 .statusbar = 0 '.FullScreen = True ' removes "chrome", but don't use with IE7+ .Navigate "about:blank" Do Until .ReadyState = 4 : WScript.Sleep 50 : Loop .document.open .document.write _ "<html><head><title>Progress</title></head>" _ & "<body bgcolor=silver scroll=no" _ & " style='border-Style utset;border-Width:3px'><center>" _& "<table bgcolor=lightskyblue width=100% height=100%>" _ & "<tr valign=middle><td align=center>Progress: <object "_ & "classid=""clsid:35053A22-8589-11D1-B16A-00C0F0283628"" " _ & "id=PrgBar height=20 width=500></object>" _ & "</td></tr><tr><td align=center id=amsg> " _ & "</td></tr></table></center></body></html>" .document.close .document.parentWindow.status = "Working" Do Until .ReadyState = 4 : WScript.Sleep 50 : Loop with .document.parentwindow.screen h = .availheight w = .availwidth end with .height = h\8 : .width = 3 * (w\4) .top = h\10 : .left = w\10 Set oPgCtl = .document.applets("PrgBar") End with ' Bring progress bar to the front CreateObject("Wscript.Shell").Appactivate "Progress" With oPgCtl ' defaults - can be changed .focus .min = 0 .max = 100 .appearance = 1 'OR 0 .borderstyle = 0 'OR 1 End With ' Return references to the Progress Bar Control and the Message Area Progressbar = Array(oPgCtl, oIE.document.all.amsg) End Function ' ------------------------------------------------------------------- |
My System Specs![]() |
| | #4 (permalink) |
| | Re: How to display a progress window Il giorno Fri, 24 Jul 2009 12:01:50 -0400, "Pascal Boivin" <pascal.boivin@xxxxxx> ha scritto: Quote: >Is it possible to show a window from a VBScript? I would like to show >some status while the script is working. The script is run from WSH on >the command line. show that something is happening. My favourite method is as follows, but so far nobody in the newsgroup seemed to appreciate it. Notice that your processing will start a lot before Merlin starts to prepare the magic potion. '************************************************ ' File: Processing.vbs 22.1.2009 ' Autore: Giovanni Cenati 'reventlov at katamail com '************************************************ Dim Agent, Merlin,n,animation Set Agent = CreateObject("Agent.Control.2") Agent.Connected = true Agent.Characters.Load "merlin", _ "c:\windows\msagent\chars\merlin.acs" Set Merlin = Agent.Characters("merlin") Merlin.Left = 0 Merlin.Top = 0 Merlin.Show Merlin.MoveTo 220,240 merlin.play "domagic1" merlin.play "domagic2" merlin.play "confused" merlin.play "announce" ' these conclude automatically merlin.play "processing" 'this must be concluded with the stop method msgbox "The actions are queued and the script arrives here before they are concluded. Click OK to stop processing." merlin.stop merlin.play "read" merlin.play "write" merlin.play "search" Merlin.Speak "Hello" merlin.play "congratulate" merlin.think "I think it works...." merlin.listen true merlin.play "wave" Merlin.Hide 'This waits until all the actions are concluded (waits the Hide method) 'If you remove the sleep loop, the script does not wait for all 'the actions to be completed. Do While Merlin.Visible: WScript.Sleep 10 : Loop Agent.connected = false Set Merlin = Nothing Set Agent = Nothing -- Giovanni Cenati (Bergamo, Italy) Write to "Reventlov" at katamail com http://digilander.libero.it/Cenati (Esempi e programmi in VbScript) -- |
My System Specs![]() |
| | #5 (permalink) |
| | Re: How to display a progress window Il giorno Fri, 24 Jul 2009 12:01:50 -0400, "Pascal Boivin" <pascal.boivin@xxxxxx> ha scritto: Quote: >Is it possible to show a window from a VBScript? I would like to show >some status while the script is working. The script is run from WSH on >the command line. I'm very happy tonight because Mayayana solved my problem with vbs drag and drop registry entries. '*** Crea una finestra che funge da output *** Dim myIE, IEWindow Set myIE = CreateObject("InternetExplorer.Application") myIE.Navigate "about:blank" myIE.ToolBar = False:myIE.StatusBar = False:myIE.Resizable = False Do Loop While myIE.Busy myIE.Width = 500:myIE.Height=500 myIE.Left = 50:myIE.Top = 50 myIE.Visible = True myIE.document.writeln("<html><title>" & Title & "</title>"&_ "<body><div id='cont'></div></body></html>") 'myIE.Document.title= Title Set IEWindow = myIE.Document.All("cont") IEWindow.INNERHTML = "<h1>This is only the beginning" wscript.sleep 3000 'processing here IEWindow.INNERHTML = "<h1>Somethin happened" -- Giovanni Cenati (Bergamo, Italy) Write to "Reventlov" at katamail com http://digilander.libero.it/Cenati (Esempi e programmi in VbScript) -- |
My System Specs![]() |
| | #6 (permalink) |
| | Re: How to display a progress window On Jul 24, 4:24*pm, no...@xxxxxx (Reventlov) wrote: Quote: > Il giorno Fri, 24 Jul 2009 12:01:50 -0400, "Pascal Boivin" > <pascal.boi...@xxxxxx> ha scritto: > Quote: > >Is it possible to show a window from a VBScript? *I would like to show > >some status while the script is working. *The script is run from WSH on > >the command line. > In the command line you could put a colon every n files/data/arrays processed. Just to > show that something is happening. > > My favourite method is as follows, but so far nobody in the newsgroup seemed to appreciate > it. Notice that your processing will start a lot before Merlin starts to prepare the magic > potion. > > '************************************************ > ' File: * *Processing.vbs 22.1.2009 > ' Autore: *Giovanni Cenati > 'reventlov at katamail com > '************************************************ > > Dim Agent, Merlin,n,animation > Set Agent = CreateObject("Agent.Control.2") > Agent.Connected = true > Agent.Characters.Load "merlin", _ > * "c:\windows\msagent\chars\merlin.acs" > Set Merlin = Agent.Characters("merlin") > Merlin.Left = 0 > Merlin.Top = 0 > Merlin.Show > Merlin.MoveTo 220,240 > > merlin.play "domagic1" > merlin.play "domagic2" > merlin.play "confused" > merlin.play "announce" ' these conclude automatically > merlin.play "processing" 'this must be concluded with the stop method > msgbox "The actions are queued and the script arrives here before they are concluded. > Click OK to stop processing." > merlin.stop > merlin.play "read" > merlin.play "write" > merlin.play "search" > > Merlin.Speak "Hello" > merlin.play "congratulate" > merlin.think "I think it works...." > merlin.listen true > merlin.play "wave" > Merlin.Hide > > 'This waits until all the actions are concluded (waits the Hide method) > 'If you remove the sleep loop, the script does not wait for all > 'the actions to be completed. > Do While Merlin.Visible: WScript.Sleep 10 : Loop > Agent.connected = false > Set Merlin = Nothing > Set Agent = Nothing > -- > Giovanni Cenati (Bergamo, Italy) > Write to "Reventlov" at katamail comhttp://digilander.libero.it/Cenati(Esempi e programmi in VbScript) > -- into them. For one thing, I feel their canned actions take too long, so they can easily slow thing down - as your script illustrates - though yours lays it on pretty thick ;-) One small quibble I have is that I found the hard coding of the SystemRoot to be problematic. The machine I am on was upgraded from Win2K to XP so that its SystemRoot folder is not named Windows, but rather the older WINNT. So, in cases like this, it's best to do something like this instead ... '... sSystemRoot = CreateObject("Wscript.shell")_ .Environment("PROCESS")("SYSTEMROOT") Agent.Characters.Load "merlin", _ sSystemRoot & "\msagent\chars\merlin.acs" '... You also failed to mention the other 'official' MSAgent charaters available for free download here: www.microsoft.com/products/msagent/main.aspx. A google search will turn up a number of other places to get characters. Thanks for the chuckle, Tom Lavedas *********** |
My System Specs![]() |
| | #7 (permalink) |
| | Re: How to display a progress window That's what I was looking for. Thanks! |
My System Specs![]() |
| | #8 (permalink) |
| | Re: How to display a progress window Quote: > That's what I was looking for. Thanks! you might be using it. The OBJECT tag references a progress bar control from mscomctl.ocx. That file comes with VB6. (It may also come with some or all versions of MS Office. I don't know.) The file requires a license. In other words, Tom Lavedas has installed something that gives him a license to use the Microsoft "common controls", so the progress bar control works for him. But on PCs where that is not the case the bar won't work. The file mscomctl.ocx itself may not even be present. With any commercial ActiveX controls -- including those from Microsoft -- using them will give you extra options but at the same time limited support. If you want to use the "fancy" version you might want to also have an IE-only version around for scripts that need to run elsewhere than on your own PC or controlled local network. On the other hand, if you want a fancy version and don't mind needing to install a control, there are also other options for various types of progress bars. |
My System Specs![]() |
| | #9 (permalink) |
| | Re: How to display a progress window On Jul 27, 9:36*am, "mayayana" <mayaXXy...@xxxxxx> wrote: Quote: Quote: > > That's what I was looking for. Thanks! > * *Be sure you test that on any system where > you might be using it. The OBJECT tag references > a progress bar control from mscomctl.ocx. That > file comes with VB6. (It may also come with some > or all versions of MS Office. I don't know.) The > file requires a license. In other words, Tom Lavedas > has installed something that gives him a license to > use the Microsoft "common controls", so the progress > bar control works for him. But on PCs where that is not > the case the bar won't work. The file mscomctl.ocx > itself may not even be present. > > * *With any commercial ActiveX controls -- including > those from Microsoft -- using them > will give you extra options but at the same time > limited support. If you want to use the "fancy" version > you might want to also have an IE-only version around > for scripts that need to run elsewhere than on your > own PC or controlled local network. On the other hand, > if you want a fancy version and don't mind needing to > install a control, there are also other options for various > types of progress bars. machine that does NOT have the necessary license rights. I had failed to realize that fact when I found that sample in my archive of bits and pieces (it's not something I actually use). I had thought it was just a standard (but little used) IE control. As I recall, I adapted it from a posting I saw in a news group, somewhere. I guess I need to document that stuff better. Tom Lavedas *********** |
My System Specs![]() |
| | #10 (permalink) |
| | Re: How to display a progress window > Yes, you are exactly right, as I found out this weekend on a home machine that does NOT have the necessary license rights. I had failed to realize that fact when I found that sample in my archive of bits and pieces (it's not something I actually use). I had thought it was just a standard (but little used) IE control. As I recall, I adapted it from a posting I saw in a news group, somewhere. I guess I need to document that stuff better. Quote: > with gifts, but through a window. There are so manycontrols on the typical system but very few that don't need a license. The only ones I can think of offhand, other than 3rd-party controls that have to be installed, are the basic IE controls and maybe a couple of Active Desktop odds and ends like webvw.dll. The IE controls were discontinued after Win98 1st, I think: iemenu.ocx, ielabel.ocx, ietimer.ocx They weren't all that great, anyway, but it's a shame that they were removed. iemenu.ocx could show a system menu. Webvw.dll can be used to render thumbnails, but IE with width and height spec-ed in an IMG tag does just as well. |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Progress window does not show | Live Mail | |||
| No progress window in Send/Receive | Live Mail | |||
| show progress window checking mail | Live Mail | |||
| progress window | Live Mail | |||
| Copying progress window disappeared | Vista General | |||