Jump to content

msgbox - pop up for certain time before continuing


Recommended Posts

What i'm looking for - is if there is a simple way to pop up a message box - to say something like

"Starting file upload" - and it gives the user two otions, continue, or cancel (or even yes or no, something)

have yes be the default - and have a countdown displayed on the box.

you ever see those popup windows - where it will say something like "Windows needs to be restarted, and will restart in 1 minute" and then it has a countdown timmer on the window.

user cna click shutdown now, or cancel shutdown.

i'm looking for that

just to give the user a chance to cancel

even if it just pauses the script - but does not necessarely needs to 'wait' for user to press ok before continueing - i would like that.

also - is there any place i can get a list of what the number corrispond to in the

msgbox(#,"title", "text")

i would like to find some sort of referance to what numbers are what - so i can generate scripts faster than playing around trying to find something.

Thanks guys!

Link to comment
Share on other sites

Here's an example that i believe was posted in this forum or at least a version of it was, this should give some ideas on how to do what you want

As to the #'s look in the help in MsgBox, they are all there

Func Prompt_Reboot($DEFTITLE, $DEFTEXT)
   AutoItSetOption("TrayIconHide", 1)
   Break(0)
   HotKeySet("^q", "bye")
   
   Dim $DEFAULTTITLE
   Dim $DEFAULTTEXT
   Dim $TEXT
   Dim $TITLE
   Dim $CLICK
   
  ;default window title and text
   $DEFAULTTITLE = 'AEDC'
   $DEFAULTTEXT = 'A patch has been applied to your computer and you must reboot.'
   
   if (StringLen($DEFTITLE)) Then
      $TITLE = $DEFTITLE
   Else
      $TITLE = $DEFAULTTITLE
   EndIf
   if (StringLen($DEFTEXT)) Then
      $TEXT = $DEFTEXT
   Else
      $TEXT = $DEFAULTTEXT
   EndIf
   
   
   $CLICK = 0
   
   Do
      $CLICK = MsgBox(4144, $TITLE, $TEXT & @CRLF & 'Save all work that needs to be saved and close all applications then click OK' & @CRLF & 'Clicking OK will reboot your computer' & @CRLF & 'This message box will repeat every thirty seconds until you reboot.', 30)
      Sleep(30000)
   Until $CLICK = 1
   
   Shutdown(6)
EndFunc  ;==>Prompt_Reboot

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

This will do what ya want

#include <GUIConstants.au3>

dim $Time = 10, $t = ""

$inst_win = GUICreate("Starting File Upload", 250, 100)

$go = GUICtrlCreateButton ("Continue" , 30, 60, 70, 25)
$stop = GUICtrlCreateButton ("Cancel" , 150, 60, 70, 25)
$message = GUICtrlCreateLabel("Install will Automatically continue in " & $time & " seconds", 20,20)

GUISetState()

While 1
    
    $msg = GUIGetMsg()
    
    If $msg = $GUI_EVENT_CLOSE Then Exit
    
    If $msg = $go Or $Time = 0 Then ExitLoop 
    
    If $msg = $stop then MsgBox(0,"","cancelling Install now"); exit program

    $t = $t +1
    If $t = 10 Then
        $t = ""
        $Time = $Time -1
        GUICtrlSetData( $message , "Install will Automatically continue in " & $time & " seconds")
    EndIf
    Sleep(100)
    
WEnd

GUIDelete($inst_win)
MsgBox(0,"","continuing Install now"); continue your install

but look in help for the "msgbox #"'s like gafrost said

8)

NEWHeader1.png

Link to comment
Share on other sites

here's another example, used this when upgrading pc's to XP:

Func WaitTime ()
    Dim $message, $o_message, $count
    $Max_Min = 15
    $CountDown = 15
    $count = 0

    $message = @LF & 'This machine will be REBOOTED' 
    $message = $message & @LF & 'to upgrade to Windows XP' 
    $message = $message & @LF & @LF & 'Please Close all Applications NOW!!!'
    $message = $message & @LF & @LF & 'Rebooting in ' & $CountDown & ' minute(s)'
    $o_message = $message
        
    SplashTextOn ( 'XPUpgrade', $message, 500, 150,-1,-1,1, "Courier New", 10, 700 )
 

    WinMove ( 'XPUpgrade', '', 1, 1 )

    while ($CountDown)
        $xval = Random ( 1, @DesktopWidth - 500 )
        $yval = Random ( 1, @DesktopHeight - 150 )
        WinMove ( 'XPUpgrade', '', $xval, $yval )
        Sleep ( 2000 )
        $count = $count + 2
        if $count >= 60 then
            $count = 0
            $CountDown = $CountDown - 1
            $message = @LF & 'This machine will be REBOOTED' 
            $message = $message & @LF & 'to upgrade to Windows XP' 
            $message = $message & @LF & @LF & 'Please Close all Applications NOW!!!'
            $message = $message & @LF & @LF & 'Rebooting in ' & $CountDown & ' minute(s)'
            ControlSetText("XPUpgrade", $o_message, "Static1", $message )

            $o_message = $message
        endif
        
    wend
    
;   SplashOff()
EndFunc

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

  • 3 years later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...