Jump to content

Always on top msgbox

Recommended Posts


Long time user, first time poster.  I'm not sure what to search on to find my answer (perused various part of the FAQ), so if it has been answered already, politely point me in the direction, please.

I have a script that mostly takes actions directed by the status of pixels on the screen.  For debugging purposes, I'd like to print out to a msgbox (or similar object) information as the script is running.  Initially, I was using MsgBox to pop up the info, but then the screen loses focus.  

One of the things that is important is that I need to keep the screen I care about "in-focus" so all the pixel data, key presses, mouse clicks etc are acted on that screen as opposed to the "debug msgbox data window."  

To go into a little more detail, right now, I use FileWrite to write the debug data out to a file that I can peruse it.  But, it isn't something I view in real time.  Ideally, I'm looking to see if there is already some AutoIt function that exists where I can do something similar to a FileWrite to this "debug msgbox data window."  Every time I call to write to it, either the old data scrolls off or disappears (doesn't really matter ultimately).  

I've looked at the splashText function, but it appears to make the window I'm working on lose focus.  

Any ideas or tips would be greatly appreciated.

Share this post

Link to post
Share on other sites

You'll most likely need to create a GUI yourself, so that you may update the control that has the debug info or overwrite it. Have a look at this topic as it gives some ideas on how to keep this window in the back, which would allow everything to keep functioning even as you update the debug info in your GUI. 

Try scripting this and post it if you hit a snag, we'd be more than happy to help on it. 

EDIT: Welcome to the AutoIt forum @taveren!

Edited by MikahS

Snips & Scripts

My Snips: graphCPUTemp ~ getENVvars
My Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4

Feel free to use any of my code for your own use.                                                                                                                                                           Forum FAQ


Share this post

Link to post
Share on other sites

Did you have a look at the Debug UDF that comes with AutoIt?

My UDFs and Tutorials:


Active Directory (NEW 2018-12-03 - Version - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki

ADO - Wiki


Share this post

Link to post
Share on other sites

You can set the MsgBox window topmost!


#include <MsgBoxConstants.au3>
MsgBox($MB_TOPMOST, "MsgBox Demo", "I'm topmost")


  • Like 2

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post

Link to post
Share on other sites


The flag parameter can be a combination of the following values: ? could not do it, then decided below.

_MsgBox_OnTop(0, "Example", "MagBox() on Top.")

Func _MsgBox_OnTop($iFlag, $sTitle, $sText, $iTimeOut = 0, $hHandle = -1)
    If $hHandle = -1 Then
        $hHandle = WinGetHandle(AutoItWinGetTitle())
        WinSetOnTop($hHandle, "", 1)
    Return MsgBox($iFlag, $sTitle, $sText, $iTimeOut, $hHandle)
EndFunc   ;==>_MsgBox_OnTop
Edited by guiltyking
code fault

Share this post

Link to post
Share on other sites

Considering all the requirements mentioned in post #1, a tooltip (non-blocking and no-focus) seems a much better solution than a msgbox

Edited by mikell

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