AutoHotkey – Display an on-screen message

When I use AutoHotkey to run background tasks, download files and prepare backups, I want to know what happens without wondering if it is really working or not. Also, I like to be prompted and to confirm actions before running them.

There is a command in AutoHotkey, MsgBox, that displays a message box on screen.

For instance, to show a message that confirms that I open my Calculator, I would write the following AutoHotkey script:

Run Calculator
MsgBox, Calculator is open and running.

This dialog box would show « Calculator is open and running. » with a OK button that I must click to close it.

There are many ways to display an on-screen message with MsgBox by adding parameters, such as (in order):

  • Options (number)
  • Title
  • Text to display in the message box
  • Showing delay (after this delay, the message box closes automatically)

Add a title to the message box

MsgBox, 0, My title, Calculator is open and running.

Display a message box for 3 seconds
MsgBox, 0, My title, Calculator is open and running, 3

Display a confirmation (Yes/No) in the message box

MsgBox, 4, My title, Do you want to open Calculator?

In this case, you can use the confirmation to generate actions whether you clicked Yes or No in the message box. For example, if I want to launch Calculator after clicking on the Yes button:

MsgBox, 4, Calculator, Do you want to open Calculator?
IfMsgBox, Yes, run, calc

For more information about the MsgBox command, please refer to AutoHotkey documentation available on the Web:


Leave a Comment