Jump to content

Recommended Posts

Posted

Dear All,

My name's Hari from Indonesia. I want to ask about How to automatically close the OK button in the message box in AutoIt Program ?

File attached :

Please help and inform us related to problem solving, thank you.

Regards,

Hari

Message Box.JPG

Posted (edited)
  On 12/2/2021 at 3:03 AM, haripurnanto said:

How to automatically close the OK button in the message box in AutoIt Program ?

Expand  

I don't quite understand what you are trying to accomplish.

If you want to close a standard message box after e.g. 10 seconds, then use the optional Timeout flag ( which you obviously already do).

If you want to close the message box immediately, why should it be displayed at all?

EDIT  : If you want to display a counter, take a look at the following post : count-down-msgbox

Edited by Musashi

Musashi-C64.png

"In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move."

  • Moderators
Posted

Moved to the appropriate forum.

Moderation Team

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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:

  Reveal hidden contents

 

Posted
Posted (edited)
  On 12/2/2021 at 6:14 PM, Nine said:

MsgBox is a blocking function, you cannot interact with it within the same script.

Expand  

Not really sure 😉. Using a Timer, it works

#include <MsgBoxConstants.au3>
#include <Timers.au3>

Local $iDuration = 10

Local $iTimerProgress = _Timer_SetTimer(0, 1000, "_CountDown") ; create timer
Local $sMsgboxTitle = "My MsgBox"
Local $sMsgboxText = "The text of the MsgBox"

MsgBox($MB_YESNO, $sMsgboxTitle, $sMsgboxText)

Func _CountDown($hWnd, $iMsg, $iIDTimer, $iTime)
    Local Static $iCountDown = 10
    Local Static $hMsgBox = WinGetHandle($sMsgboxTitle, $sMsgboxText)
    $iCountDown -= 1
    ControlSetText($hMsgBox, "", "[CLASS:Button; INSTANCE:2]", "Close in " & $iCountDown & " s")
    If $iCountDown = 0 Then ControlClick($hMsgBox, "", "[CLASS:Button; INSTANCE:1]")
EndFunc

 

Edited by jguinch
  • 3 weeks 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
  • Recently Browsing   0 members

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