Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I make an AutoHotkey message box dissapear without clicking okay?

Tags:

autohotkey

I need something like a msgbox displaying in my script but without the need for waiting to click okay.

What I need is to display a string for a certain duration of time and then make it disappear. It would be helpful if it can display a live timer string but not mandatory.

Something like:

;//...
msgbox, MyInformationString; display information
sleep, 30000 ; wait 30 seconds
;// close msgbox but HOW ???
;//...

It doesn't have to be the msgbox command. but I can not figure out how to create a new popup or any other way to display information. Format is the least of my concern here.

like image 345
MelBurslan Avatar asked Jul 07 '13 21:07

MelBurslan


1 Answers

Look at msgbox in the docs. Since you are producing the msgbox via AutoHotkey, you can set a time limit on it that will close the message automatically. That means that you don't have to push anything - the box appears and then just goes away.

MsgBox [, Options, Title, Text, Timeout]

Timeout is the last parameter:

(optional) Timeout in seconds, which can contain a decimal point but is not an expression by default. In v1.1.06+, this can be a forced expression such as % mins*60.

If this value exceeds 2147483 (24.8 days), it will be set to 2147483. After the timeout has elapsed the message box will be automatically closed and the IfMsgBox command will see the value TIMEOUT.

Known limitation: If the MsgBox contains only an OK button, IfMsgBox will think that the OK button was pressed if the MsgBox times out while its own thread is interrupted by another.

like image 153
bgmCoder Avatar answered Oct 13 '22 12:10

bgmCoder