Sign in to follow this  
Followers 0
sumone4life

Count down MsgBox

11 posts in this topic

is there any way to make a message box refresh and display somthing else. I know i can do it by closing the Msgbox and then opening a new one but is there a way to refresh it. Im trying to make a countdown kind of thing.

Share this post


Link to post
Share on other sites



You could build a GUI and update a label.

Share this post


Link to post
Share on other sites

Any simplier way? I dont really need a GUI at this point maybe in the future though.

Share this post


Link to post
Share on other sites

nope, sorry. A message box is the way it is as far as I know. There's no way to update it AFAIK.


The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN

Share this post


Link to post
Share on other sites

Here is a rough sample:

#include <GUIConstants.au3>
; == GUI generated with Koda ==
$Form1 = GUICreate("Count Down", 333, 128, 200, 125)
$Button1 = GUICtrlCreateButton("OK", 128, 80, 75, 25)
$Label = GUICtrlCreateLabel("", 128, 32, 76, 28, $SS_CENTER)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
GUISetState(@SW_SHOW)
While 1
    For $i = 10 to 1 Step -1
    GUICtrlSetData($Label, $i)  
    Sleep(500)
    Next
    GUICtrlSetData($Label, "Blast off!!!")
    Sleep(2000)
    ExitLoop
WEnd
Exit

Share this post


Link to post
Share on other sites

Thanks

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Could have done Splash also.

While 1
    For $i = 10 to 1 Step -1
        SplashTextOn('', $i, 30, 20)
        Sleep(1000)
    Next
    ExitLoop
WEnd
SplashOff()

Edit:

Could have a bit of fun with it :lmao:

While 1
    For $i = 10 to 1 Step -1
        SplashTextOn('', $i, $i&1.5, $i&1.5)
        Sleep(1000)
    Next
    ExitLoop
WEnd
SplashOff()
Much more too! Edited by SmOke_N

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

You could also use WinSetTitle to change the title of the msgbox, but this is a bit clumsy.

Share this post


Link to post
Share on other sites

a message box is still just a window like any other. you can't make a countdown on a standard message box in a single script, because execution of the script stops while the message box is active on the screen. now with autoit you do have the ability to fileinstall() in a second script, run() a compiled script etc etc, to give you the illusion of a multi-threaded approach to achieve the goal you want. here's a little example. 2 files. one just makes a message box.

Msgbox(0,"This is a Test","10")

now that script could be fileinstalled into the next script, and maybe run with an added #NoTrayIcon so that it would appear to be all one script. the other script would be:

Run("code1.exe")
WinWaitActive("This is a test")
ControlDisable("This is a test","",2)
for $x = 1 to 10
WinActivate("This is a test","")
ControlSetText("This is a test","",65535,10-$x)
Next
ControlEnable("This is a test","",2)

that will give you the result that you want, and even disable the user's ability to acknowledge the box via ok button while they watch your countdown...


1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
Share on other sites

a message box is still just a window like any other. you can't make a countdown on a standard message box in a single script, because execution of the script stops while the message box is active on the screen. now with autoit you do have the ability to fileinstall() in a second script, run() a compiled script etc etc, to give you the illusion of a multi-threaded approach to achieve the goal you want. here's a little example. 2 files. one just makes a message box.

Msgbox(0,"This is a Test","10")

now that script could be fileinstalled into the next script, and maybe run with an added #NoTrayIcon so that it would appear to be all one script. the other script would be:

Run("code1.exe")
WinWaitActive("This is a test")
ControlDisable("This is a test","",2)
for $x = 1 to 10
WinActivate("This is a test","")
ControlSetText("This is a test","",65535,10-$x)
Next
ControlEnable("This is a test","",2)

that will give you the result that you want, and even disable the user's ability to acknowledge the box via ok button while they watch your countdown...

If he didn't want to create more 'MsgBoxes' I doubt he'd want to create another script just to count down. ;) (My turn :lmao:)


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

I think he means

he wants a msgbox to come up after he clicks ok right? so he watnts 2 or more msg boxes?

here's the code for 2

pretty simple

(MsgBox 0, "TestBox", "10")
(MsgBox 0, "Testbox2", "9")
(MsgBox 0, "TestBox", "8")
(MsgBox 0, "Testbox2", "7")
(MsgBox 0, "TestBox", "6")
(MsgBox 0, "Testbox2", "5")
(MsgBox 0, "TestBox", "4")
(MsgBox 0, "Testbox2", "3")
(MsgBox 0, "TestBox", "2")
(MsgBox 0, "Testbox2", "1")

here's for infinite boxes

While1
(MsgBox 0, "TestBox", "10")
(MsgBox 0, "Testbox2", "9")
(MsgBox 0, "TestBox", "8")
(MsgBox 0, "Testbox2", "7")
(MsgBox 0, "TestBox", "6")
(MsgBox 0, "Testbox2", "5")
(MsgBox 0, "TestBox", "4")
(MsgBox 0, "Testbox2", "3")
(MsgBox 0, "TestBox", "2")
(MsgBox 0, "Testbox2", "1")
WEnd

is this what u mean?

Edited by gunnersense

Share this post


Link to post
Share on other sites

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
Sign in to follow this  
Followers 0