Jump to content

Is it possible to get a MsgBox to lock on top?


Recommended Posts

I first want to say thanks to everyone on here. The wealth of knowledge here is amazing, and has helped me out tremendously. I have been stuck quite a few times, and swore I wouldn't post for help unless I exhausted every avenue on my own. Most of the time, I was able to search and find the answer I was looking for.

But this time I am stuck, and having no luck searching.

I am tasked with writing a bunch of scripts that are going to require a user's interaction. The script will perform a function, launch an application, navigate to a screen... etc. Occasionally, the user will be asked to click something on the screen behind the message box, then click OK.

Is it possible to have the message box always stay on top? I have tried using the WinSetOnTop command, but this doesn't seem to work with MsgBox.

Any help is greatly appreciated!

Link to comment
Share on other sites

  • Moderators

jerseyzuks,

Welcome to the AutoIt forum. :unsure:

Take a look at the Modal MsgBox Styles tutorial in the Wiki - it shows a couple of ways you can get the MsgBox to "stick" on top. :>

But this normally means you cannot interact with the script below - which may not be what you want. Could you post a short example of the sort of thing you are trying to do - it might be easier to code something in the script which will recall the MsgBox (or another child GUI ;)) once the required action has been taken by the user.

M23

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:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Thanks Melba!

I had seen that tutorial in the Wiki, but I wasn't able to make it do what I needed.

here is a bit of the code (ignore my silly comments, I need to explain each line of code to people with zero scripting experience)

Send("{LWIN}R")

Sleep(1000) ;pause for 1 second

Send("mmc devmgmt.msc") ;launches device manager

Send("{ENTER}") ;sends enter

Sleep(500) ;pause for 1/2 second

MsgBox(0, "MS Audio Patch Test", 'Expand the + sign next to "Sound, video, and game controllers" and verify that all audio devices are working properly, and none have a yellow symbol') ;prompts user to click ok after verifying that all audio devices are working properly

WinWaitClose("MS Audio Patch Test") ;waits for the message box to be closed before proceeding Windows

Sleep(500) ;pause for 1 second

WinClose("Device Manager") ;Tells the script to close the Windows Installer screen that is opened

Sleep(1000) ;pause for 1 second

Link to comment
Share on other sites

See MsgBox flag in help file

MsgBox ( 262144, "Test", "This box will time out in 10 seconds", 10 ) ; 262144 MsgBox has top-most attribute set

Thank you!

not sure how I missed that, but it did exactly what I needed!

Thanks everyone for having patience with an autoit newbie!

Link to comment
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
 Share

  • Recently Browsing   0 members

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