sumone4life Posted January 20, 2006 Share Posted January 20, 2006 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. Link to comment Share on other sites More sharing options...
Moderators big_daddy Posted January 20, 2006 Moderators Share Posted January 20, 2006 You could build a GUI and update a label. Link to comment Share on other sites More sharing options...
sumone4life Posted January 20, 2006 Author Share Posted January 20, 2006 Any simplier way? I dont really need a GUI at this point maybe in the future though. Link to comment Share on other sites More sharing options...
theguy0000 Posted January 20, 2006 Share Posted January 20, 2006 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 Link to comment Share on other sites More sharing options...
Moderators big_daddy Posted January 20, 2006 Moderators Share Posted January 20, 2006 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 Link to comment Share on other sites More sharing options...
sumone4life Posted January 20, 2006 Author Share Posted January 20, 2006 Thanks Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted January 20, 2006 Moderators Share Posted January 20, 2006 (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 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 January 20, 2006 by SmOke_N 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. Link to comment Share on other sites More sharing options...
giantsquid Posted January 20, 2006 Share Posted January 20, 2006 You could also use WinSetTitle to change the title of the msgbox, but this is a bit clumsy. Link to comment Share on other sites More sharing options...
seandisanti Posted January 20, 2006 Share Posted January 20, 2006 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... Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted January 20, 2006 Moderators Share Posted January 20, 2006 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 ) 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. Link to comment Share on other sites More sharing options...
gunnersense Posted January 20, 2006 Share Posted January 20, 2006 (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 January 20, 2006 by gunnersense Link to comment Share on other sites More sharing options...
Ahihi Posted January 20, 2019 Share Posted January 20, 2019 MsgBox(4096, "Title", "10", 1) MsgBox(4096, "Title", "9", 1) MsgBox(4096, "Title", "8", 1) MsgBox(4096, "Title", "7", 1) MsgBox(4096, "Title", "6", 1) MsgBox(4096, "Title", "5", 1) MsgBox(4096, "Title", "4", 1) MsgBox(4096, "Title", "3", 1) MsgBox(4096, "Title", "2", 1) MsgBox(4096, "Title", "1", 1) MsgBox(4096, "Title", "0", 1) Link to comment Share on other sites More sharing options...
Subz Posted January 20, 2019 Share Posted January 20, 2019 @Ahihi Why resurrect a 13 year old post? If you are going to increment or de-increment it would be better to just use a loop For $i = 10 To 0 Step - 1 MsgBox(4096, "Title", $i, 1) Next Ahihi 1 Link to comment Share on other sites More sharing options...
Ahihi Posted January 20, 2019 Share Posted January 20, 2019 yeah right, thanks. I just find google msgbox countdown and auto close, so I go to here. And I find out a solution for his post for someone come here after me find solution like this Link to comment Share on other sites More sharing options...
mikell Posted January 20, 2019 Share Posted January 20, 2019 (edited) Anyway as mentioned before in this kind of situation a SplashTextOn is much more clean and classy Edited January 20, 2019 by mikell ... and it is still true 13 years later FrancescoDiMuro and Ahihi 1 1 Link to comment Share on other sites More sharing options...
Ahihi Posted January 20, 2019 Share Posted January 20, 2019 Ok sir, I even haven't known splashtexton yet. I'm newbie. But I lvoe u :)) Link to comment Share on other sites More sharing options...
Ahihi Posted January 20, 2019 Share Posted January 20, 2019 THank all, but I still have a question. If the countdown from 10 to 0 can be put on the "Cancel" button or "OK" button of Msgbox ? Like many msgbox normal they use I see before ? Link to comment Share on other sites More sharing options...
Subz Posted January 20, 2019 Share Posted January 20, 2019 Look at MsgBox in help file, you'll notice constants $MB_DEFBUTTON1... Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 20, 2019 Moderators Share Posted January 20, 2019 Ahihi, Quote If the countdown from 10 to 0 can be put on the "Cancel" button or "OK" button of Msgbox ? My ExtMsgBox UDF (the link is in my sig) can run a countdown for you - run "Test 6" in Example 1 in the zip. M23 Ahihi 1 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Gianni Posted January 20, 2019 Share Posted January 20, 2019 (edited) ; open a detached MsgBox and get handle $hwMSG = _MsgBox(0, "Hello", "Content", 5) ; auto close in 5 seconds ; get handle of the text label $hMSGtext = ControlGetHandle($hwMSG, "", "[CLASS:Static; INSTANCE:1]") ; get handle of the OK button $hButton = ControlGetHandle($hwMSG, "", "[CLASS:Button; INSTANCE:1]") $countdown = 4 While WinExists($hwMSG) ; wait the autoclose of the MsgBox ; change the text in the MsgBox ControlSetText($hwMSG, '', $hMSGtext, "Off in " & $countdown & " sec") ; label ControlSetText($hwMSG, '', $hButton, $countdown) ; ok button Sleep(1000) $countdown -= 1 WEnd ; spawn a detached MsgBox and returns an handle Func _MsgBox($flag = 0, $title = '', $text = '', $timeout = 0) Local $sCommand = 'MsgBox(' & $flag & ', "' & $title & '", "' & $text & '", ' & $timeout & ')' $sCommand = '"' & StringReplace($sCommand, '"', '""') & '"' Local $hPID = Run(@AutoItExe & ' /AutoIt3ExecuteLine ' & $sCommand) Sleep(1000) ; Retrieve a list of window handles. (MsgBox included) Local $aList = WinList(), $hwMSGBOX For $i = 1 To $aList[0][0] If WinGetProcess($aList[$i][1]) = $hPID Then $hwMSGBOX = $aList[$i][1] ExitLoop EndIf Next Return $hwMSGBOX EndFunc ;==>_MsgBox Edited January 20, 2019 by Chimp Ahihi 1 Chimp small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt.... Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now