![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| 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) |
| | msgbox update/clear I have a script that performs 100 actions at regular interval and I'd like to give a progress indication. My thought was to use a msgbox that displayed the current number, and either clear it and replace it from the script or to update it's message, without any user action. Is this possible, or is there a better way of performing this action? MTIA -- http://www.stopblair.eu/ bof at bof dot me dot uk |
My System Specs![]() |
| | #2 (permalink) |
| | Re: msgbox update/clear "bof" <nothingread@newsgroup> wrote in message news:Hjn$qh7TaU8KFwxu@newsgroup Quote: > > > I have a script that performs 100 actions at regular interval and I'd like > to give a progress indication. > > My thought was to use a msgbox that displayed the current number, and > either clear it and replace it from the script or to update it's message, > without any user action. > > Is this possible, or is there a better way of performing this action? > > MTIA > Internet Explorer. I have a simple example linked here: http://www.rlmueller.net/IE%20Display.htm -- Richard Mueller MVP Directory Services Hilltop Lab - http://www.rlmueller.net -- |
My System Specs![]() |
| | #3 (permalink) |
| | Re: msgbox update/clear In message <#Xc7CHVXKHA.4704@newsgroup>, "Richard Mueller [MVP]" <rlmueller-nospam@newsgroup> writes Quote: > >"bof" <nothingread@newsgroup> wrote in message >news:Hjn$qh7TaU8KFwxu@newsgroup Quote: >> >> >> I have a script that performs 100 actions at regular interval and I'd like >> to give a progress indication. >> >> My thought was to use a msgbox that displayed the current number, and >> either clear it and replace it from the script or to update it's message, >> without any user action. >> >> Is this possible, or is there a better way of performing this action? >> >> MTIA >> >If the script has something like a number to indicate progress, you can use >Internet Explorer. I have a simple example linked here: > >http://www.rlmueller.net/IE%20Display.htm Thanks, does exactly what I was looking to do -- http://www.stopblair.eu/ bof at bof dot me dot uk |
My System Specs![]() |
| | #4 (permalink) |
| | Re: msgbox update/clear "Richard Mueller [MVP]" <rlmueller-nospam@newsgroup> wrote in message news:%23Xc7CHVXKHA.4704@newsgroup Quote: > > "bof" <nothingread@newsgroup> wrote in message > news:Hjn$qh7TaU8KFwxu@newsgroup Quote: > > > > > > I have a script that performs 100 actions at regular interval and I'd Quote: Quote: > > to give a progress indication. > > > > My thought was to use a msgbox that displayed the current number, and > > either clear it and replace it from the script or to update it's Quote: Quote: > > without any user action. > > > > Is this possible, or is there a better way of performing this action? > > > > MTIA > > > If the script has something like a number to indicate progress, you can Quote: > Internet Explorer. I have a simple example linked here: > > http://www.rlmueller.net/IE%20Display.htm (I'm using Windows 98 so I can not test it right now.) -- Todd Vargo (Post questions to group only. Remove "z" to email personal messages) |
My System Specs![]() |
| | #5 (permalink) |
| | Re: msgbox update/clear "Todd Vargo" <tlvargo@newsgroup> wrote in message news:O4iV5YZXKHA.3428@newsgroup Quote: > > "Richard Mueller [MVP]" <rlmueller-nospam@newsgroup> wrote in > message news:%23Xc7CHVXKHA.4704@newsgroup Quote: >> >> "bof" <nothingread@newsgroup> wrote in message >> news:Hjn$qh7TaU8KFwxu@newsgroup Quote: >> > >> > >> > I have a script that performs 100 actions at regular interval and I'd Quote: Quote: >> > to give a progress indication. >> > >> > My thought was to use a msgbox that displayed the current number, and >> > either clear it and replace it from the script or to update it's Quote: Quote: >> > without any user action. >> > >> > Is this possible, or is there a better way of performing this action? >> > >> > MTIA >> > >> If the script has something like a number to indicate progress, you can Quote: >> Internet Explorer. I have a simple example linked here: >> >> http://www.rlmueller.net/IE%20Display.htm > Does it work with IE7? > (I'm using Windows 98 so I can not test it right now.) > > -- > Todd Vargo > (Post questions to group only. Remove "z" to email personal messages) > with IE7. However, the window starts up minimized, so perhaps I should look into code to correct that. Also, I have purposely not upgraded to IE8 yet, so that is another question. -- Richard Mueller MVP Directory Services Hilltop Lab - http://www.rlmueller.net -- |
My System Specs![]() |
| | #6 (permalink) |
| | Re: msgbox update/clear In message <O4iV5YZXKHA.3428@newsgroup>, Todd Vargo <tlvargo@newsgroup> writes Quote: > >"Richard Mueller [MVP]" <rlmueller-nospam@newsgroup> wrote in >message news:%23Xc7CHVXKHA.4704@newsgroup Quote: >> >> "bof" <nothingread@newsgroup> wrote in message >> news:Hjn$qh7TaU8KFwxu@newsgroup Quote: >> > >> > >> > I have a script that performs 100 actions at regular interval and I'd Quote: Quote: >> > to give a progress indication. >> > >> > My thought was to use a msgbox that displayed the current number, and >> > either clear it and replace it from the script or to update it's Quote: Quote: >> > without any user action. >> > >> > Is this possible, or is there a better way of performing this action? >> > >> > MTIA >> > >> If the script has something like a number to indicate progress, you can Quote: >> Internet Explorer. I have a simple example linked here: >> >> http://www.rlmueller.net/IE%20Display.htm >Does it work with IE7? -- http://www.stopblair.eu/ bof at bof dot me dot uk |
My System Specs![]() |
| | #7 (permalink) |
| | Re: msgbox update/clear Quote: Quote: Quote: >>> If the script has something like a number to indicate progress, you can Quote: >>> Internet Explorer. I have a simple example linked here: >>> >>> http://www.rlmueller.net/IE%20Display.htm >> Does it work with IE7? >> (I'm using Windows 98 so I can not test it right now.) > Good question, as I haven't tested in awhile. It works on my Vista machine > with IE7. However, the window starts up minimized, so perhaps I should > look into code to correct that. Also, I have purposely not upgraded to IE8 > yet, so that is another question. > |
My System Specs![]() |
| | #8 (permalink) |
| | Re: msgbox update/clear bof wrote: Quote: > I have a script that performs 100 actions at regular interval and I'd > like to give a progress indication. > Yes, yes, I've said this before, but here goes again. vbs is sadly lacking in a gui interface, and so most people here will recommend using IE as a gui. But there are other possibilities if you don't mind using 3rd party software. There is kixForms, written by: Shawn Tassie of CGI Canada: http://www.kixforms.org/assets/index.htm, and wshDialog, written by: Peter J.C. van der Klugt: http://home.hccnet.nl/p.vd.klugt/, Note that kixForms was written for the kix language, but works perfectly well with vbs. I have attached two vbs scripts, both showing progressbar dialogs. The kixForms script was written by me, and the wshDlg example comes from Peter v.d.K's help file. cheers, jw ____________________________________________________________ You got questions? WE GOT ANSWERS!!! ..(but, no guarantee the answers will be applicable to the questions) p.s. note that the file extensions were changed to txt, to avoid nasty accusations by some AV software as being "malicious" scripts. ' wshKixtartFormsDemo Script, jw 17Dec07 ' ' --- description block -------------------------- ' ' Title: Kixtart Forms Demo Script... ' ' Description: The Kixtart Forms (KixForms) actX object was originally ' intended for use by Kixtart scripters to provide a GUI interface. ' But, since it is an actX object you may also use it from vbScript... ' ' In this example, a status message / progress bar dialog is ' shown -- something that vbScript ought to have had of its own. ' ' Author: mr_unreliable ' Website: none at present (but may be found lurking around the vbs ng)... ' ' Usage: Use at you own risk, tested on win98se... ' ' --- revision history --------------------------- ' 17Dec07: initial attempt... ' 19Dec07: (finally) figured out how the KixForms events work(?)... ' --- end of description block ------------------- ' ' --- these objects are global in scope ---------- ' The following line imports the System (root) namespace: Dim oKixSystem : Set oKixSystem = CreateObject("Kixtart.System") ' Set Up the Top-Level Container (called "the Form Object") Dim oForm : Set oForm = oKixSystem.Form() Dim oBtn, oLbl, oProgBar ' as object(s) ' --- end of global variables -------------------- ' ================================================ ' === MAIN LINE SCRIPT LOGIC HERE ================ ' ================================================ Call Create_Dialog() ' using kixforms ' run through the demo, showing status messages and advancing progbar... Dim iPct : iPct = 0 Do WScript.Sleep 100 if ((iPct Mod 10) = 0) then oLbl.Text = "Script Status: " & CStr(iPct) & " pct complete" if (iPct < 100) then iPct = iPct + 1 oProgBar.Value = iPct ' advance the progbar ' --- discussion of event processing ---------- ' o.k., can't say how this works exactly. The Documentation says: ' "DoEvents returns a string representing the next event in the queue". ' Apparently that string referred to is the string stored in the event ' property. For example: say a click event is detected, then the ' DoEvents method will return the string stored in the onClick property. ' Then that string (retrieved by DoEvents) gets executed here... ' ' As to the DoEvents "wait" parameter, according to the documentation: ' false means process an event if one is detected, but otherwise DON'T WAIT for an event. ' true means wait (i.e., don't return until there is some event to report). ' But here, it seems to work JUST THE OPPOSITE from what the doc says. ' Ain't this fun... ' --- end of discussion ---------------------- Execute(oForm.DoEvents(True)) ' Loop Until (iPct >= 100) ' o.k., the demo is finished, now exit gracefully... oLbl.Text = "the demo is finished" WScript.Sleep 1000 oLbl.Text = "this dlg will close in 2ses" WScript.Sleep 2000 oForm.Visible = False Set oForm = nothing Set oKixSystem = nothing ' provide reassurance that this script closed MsgBox("Script Terminating Now... ") WScript.Quit ' ================================================ ' === SUBROUTINES FOLLOW ========================= ' ================================================ Sub oForm_Click() MsgBox("form click detected(!)") End Sub Sub oBtn_Click() MsgBox("button click detected(!)") End Sub Sub Create_Dialog() With oForm .Text = "vbs (KixForms) StatusMsg/Progbar dlg... " ' the form caption .MinimizeBox = "False" .MaximizeBox = "False" .Resizable = 0 .BackColor = "Azure" ' &HD0D0D0 ' Lt Gray .Width = 300 .Height = 130 .FontName = "Verdana" .FontBold = True .FontSize = 10 .onClick = "oForm_Click()" ' add a button to the form... Set oBtn = .Controls.Add("Button") With oBtn .Left = 65 : .Top = 70 : .Width = 180 : .Height = 20 .BackColor = &HFF ' this doesn't seem to work .FontSize = 9 .FontBold = False .Text = "Cancel the Script!" .onClick = "oBtn_Click()" ' "MsgBox(""hi"")" ' (this works too) End With ' obtn Set oLbl = .Controls.Add("Label") With oLbl .Left = 20 : .Top = 10 : .Width = 270 : .Height = 30 .Text = "Status Message Here... " End With ' olbl Set oProgBar = .Controls.Add("ProgressBar") With oProgBar .Left = 20 : .Top = 40 : .Width = 260 : .Height = 20 .Minimum = 0 : .Maximum = 100 : .Style = 1 ' smooth .Value = 50 End With ' oprogbar .Show ' show the form End With ' oform End SubOption Explicit Const vbModal = 1 Dim oDlg, oFrm, oCtl 'Create the WshDialog.Kit object and store a reference in oDlg Set oDlg = Wscript.CreateObject("WshDialog.Kit", "oDlg_") 'Add a new form and store a reference to it in the variable oFrm Set oFrm = oDlg.NewForm("Sample") 'Add a progressbar control and store a reference in the variable oCtl Set oCtl = oFrm.NewProgressBar("BAR1", 150, 100, 2450, 250, 0, 100, 0) 'Add a timer with an interval of 1 second oFrm.NewTimer "TIMER", 1 'Automatically size the form and enable event handling (callback) oFrm.Autosize oFrm.CallBack = True 'Show the form (modally) oFrm.Show vbModal MsgBox "Done" '-------------------------------------------------------------------------------------------------- ' oDlg_ClickHandler handles the events sent by the controls '-------------------------------------------------------------------------------------------------- Sub oDlg_ClickHandler(sForm, sControl) Dim oFrm, oCtl, oBar 'Get a reference to the form and the control that raised the event Set oFrm = oDlg.Frm(sForm) Set oCtl = oFrm.Ctl(sControl) 'Check which control caused the event Select Case sControl Case "TIMER" 'Move the progressbar by 5 percent Set oBar = oFrm.Ctl("BAR1") If oBar.Value < oBar.Max Then oBar.Value = oBar.Value + Cint((oBar.Max - oBar.Min) / 20) Else 'Maximum reached. Disable the timer and dismiss the form oCtl.Enabled = False oFrm.Hide End If Case Else 'Ignore all other events. Do NOT use oFrm.Hide here, 'or any event not handled above will dismiss the form End Select End Sub |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| MsgBox help needed | VB Script | |||
| MsgBox Question | VB Script | |||
| Script to launch a MSGBOX listing PST file locations for a logged onuser | VB Script | |||
| VS 2008 update causes VS2005 to no longer clear undo history on document close | .NET General | |||
| Using msgbox | PowerShell | |||