Windows Vista Forums

msgbox update/clear
  1. #1


    bof Guest

    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 SpecsSystem Spec

  2. #2


    Richard Mueller [MVP] Guest

    Re: msgbox update/clear


    "bof" <nothingread@newsgroup> wrote in message
    news:Hjn$qh7TaU8KFwxu@newsgroup

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

    --
    Richard Mueller
    MVP Directory Services
    Hilltop Lab - http://www.rlmueller.net
    --



      My System SpecsSystem Spec

  3. #3


    bof Guest

    Re: msgbox update/clear

    In message <#Xc7CHVXKHA.4704@newsgroup>, "Richard Mueller
    [MVP]" <rlmueller-nospam@newsgroup> writes

    >
    >"bof" <nothingread@newsgroup> wrote in message
    >news:Hjn$qh7TaU8KFwxu@newsgroup

    >>
    >>
    >> 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 SpecsSystem Spec

  4. #4


    Todd Vargo Guest

    Re: msgbox update/clear


    "Richard Mueller [MVP]" <rlmueller-nospam@newsgroup> wrote in
    message news:%23Xc7CHVXKHA.4704@newsgroup

    >
    > "bof" <nothingread@newsgroup> wrote in message
    > news:Hjn$qh7TaU8KFwxu@newsgroup

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


      My System SpecsSystem Spec

  5. #5


    Richard Mueller [MVP] Guest

    Re: msgbox update/clear


    "Todd Vargo" <tlvargo@newsgroup> wrote in message
    news:O4iV5YZXKHA.3428@newsgroup

    >
    > "Richard Mueller [MVP]" <rlmueller-nospam@newsgroup> wrote in
    > message news:%23Xc7CHVXKHA.4704@newsgroup

    >>
    >> "bof" <nothingread@newsgroup> wrote in message
    >> news:Hjn$qh7TaU8KFwxu@newsgroup

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

    --
    Richard Mueller
    MVP Directory Services
    Hilltop Lab - http://www.rlmueller.net
    --



      My System SpecsSystem Spec

  6. #6


    bof Guest

    Re: msgbox update/clear

    In message <O4iV5YZXKHA.3428@newsgroup>, Todd Vargo
    <tlvargo@newsgroup> writes

    >
    >"Richard Mueller [MVP]" <rlmueller-nospam@newsgroup> wrote in
    >message news:%23Xc7CHVXKHA.4704@newsgroup

    >>
    >> "bof" <nothingread@newsgroup> wrote in message
    >> news:Hjn$qh7TaU8KFwxu@newsgroup

    >> >
    >> >
    >> > 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
    >
    >Does it work with IE7?
    Yes

    --

    http://www.stopblair.eu/

    bof at bof dot me dot uk

      My System SpecsSystem Spec

  7. #7


    X22degg5 Guest

    Re: msgbox update/clear


    >>> 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
    >>
    >> 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.
    >
    Works on IE8, loaded on Windows XP-pro.



      My System SpecsSystem Spec

  8. #8


    mr_unreliable Guest

    Re: msgbox update/clear

    bof wrote:

    > I have a script that performs 100 actions at regular interval and I'd
    > like to give a progress indication.
    >
    hi Bof,

    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 SpecsSystem Spec

msgbox update/clear problems?

Similar Threads
Thread Thread Starter Forum Replies Last Post
msgbox on top Amir Atary VB Script 2 04 Mar 2010
MsgBox help needed Vgolfmaster VB Script 2 02 May 2009
MsgBox Question Vgolfmaster VB Script 7 20 Apr 2009
VS 2008 update causes VS2005 to no longer clear undo history on document close PJ6 .NET General 1 16 Jan 2009
Using msgbox Marco Shaw PowerShell 4 22 Nov 2006