Web Images News Groups Scholar Blogs Gmail more »
Recently Visited Groups | Help | Sign in
Google Groups Home
msgbox update/clear
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  8 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
bof  
View profile  
 More options Nov 4, 9:17 am
Newsgroups: microsoft.public.scripting.vbscript
From: bof <nothingr...@hotmail.com>
Date: Wed, 4 Nov 2009 09:17:07 +0000
Local: Wed, Nov 4 2009 9:17 am
Subject: 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


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Richard Mueller [MVP]  
View profile  
 More options Nov 4, 1:21 pm
Newsgroups: microsoft.public.scripting.vbscript
From: "Richard Mueller [MVP]" <rlmueller-nos...@ameritech.nospam.net>
Date: Wed, 4 Nov 2009 07:21:37 -0600
Local: Wed, Nov 4 2009 1:21 pm
Subject: Re: msgbox update/clear

"bof" <nothingr...@hotmail.com> wrote in message

news:Hjn$qh7TaU8KFwxu@hotmail.com...

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


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
bof  
View profile  
 More options Nov 4, 1:34 pm
Newsgroups: microsoft.public.scripting.vbscript
From: bof <nothingr...@hotmail.com>
Date: Wed, 4 Nov 2009 13:34:51 +0000
Local: Wed, Nov 4 2009 1:34 pm
Subject: Re: msgbox update/clear
In message <#Xc7CHVXKHA.4...@TK2MSFTNGP02.phx.gbl>, "Richard Mueller
[MVP]" <rlmueller-nos...@ameritech.nospam.net> writes

Thanks, does exactly what I was looking to do

--

http://www.stopblair.eu/

bof at bof dot me dot uk


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Todd Vargo  
View profile  
 More options Nov 4, 9:31 pm
Newsgroups: microsoft.public.scripting.vbscript
From: "Todd Vargo" <tlva...@sbcglobal.netz>
Date: Wed, 4 Nov 2009 16:31:55 -0500
Local: Wed, Nov 4 2009 9:31 pm
Subject: Re: msgbox update/clear

"Richard Mueller [MVP]" <rlmueller-nos...@ameritech.nospam.net> wrote in
message news:%23Xc7CHVXKHA.4704@TK2MSFTNGP02.phx.gbl...

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)


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Richard Mueller [MVP]  
View profile  
 More options Nov 4, 9:52 pm
Newsgroups: microsoft.public.scripting.vbscript
From: "Richard Mueller [MVP]" <rlmueller-nos...@ameritech.nospam.net>
Date: Wed, 4 Nov 2009 15:52:16 -0600
Local: Wed, Nov 4 2009 9:52 pm
Subject: Re: msgbox update/clear

"Todd Vargo" <tlva...@sbcglobal.netz> wrote in message

news:O4iV5YZXKHA.3428@TK2MSFTNGP06.phx.gbl...

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


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
bof  
View profile  
 More options Nov 4, 9:56 pm
Newsgroups: microsoft.public.scripting.vbscript
From: bof <nothingr...@hotmail.com>
Date: Wed, 4 Nov 2009 21:56:05 +0000
Local: Wed, Nov 4 2009 9:56 pm
Subject: Re: msgbox update/clear
In message <O4iV5YZXKHA.3...@TK2MSFTNGP06.phx.gbl>, Todd Vargo
<tlva...@sbcglobal.netz> writes

Yes

--

http://www.stopblair.eu/

bof at bof dot me dot uk


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
X22degg5  
View profile  
 More options Nov 5, 12:40 am
Newsgroups: microsoft.public.scripting.vbscript
From: "X22degg5" <inva...@invalid.invalid>
Date: Wed, 4 Nov 2009 18:40:47 -0600
Local: Thurs, Nov 5 2009 12:40 am
Subject: 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.

    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
mr_unreliable  
View profile  
 More options Nov 5, 3:17 am
Newsgroups: microsoft.public.scripting.vbscript
From: mr_unreliable <kindlyReplyToNewsgr...@notmail.com>
Date: Wed, 04 Nov 2009 22:17:02 -0500
Local: Thurs, Nov 5 2009 3:17 am
Subject: 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.

[ kixForms_ProgDlgTest.vbs.txt 5K ]
' 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 Sub

[ wshDlg_ProgBarText.vbs.txt 1K ]
Option 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


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google