Dana Posted January 31, 2018 Share Posted January 31, 2018 I've been trying (unsuccessfully) to get an InputBox to stay on top and active. The script I'm working with interacts with our document management software. It takes the contents of the clipboard, displays that in an inputbox to be edited if necessary, and when the user clicks OK or hits enter, continues interacting with the software. I have it set up so if the software is already running, it just does its thing (and that works), but if the software isn't already running, it starts it via the Run command, then displays the inputbox, and does its thing after the software main screen is up (using winwait). The problem is that the software takes some time to load, first there's a splash screen, then the main window. I want to display the inputbox so the user can interact with it immediately, or not, but when the software finally loads, its window goes on top of the inputbox. A search here shows me I can do the inputbox with: $searchstring = InputBox("Searching from clipboard", "Enter search string or <ENTER> to search from clipboard:", $searchstring, "", -1, -1, Default, Default, 0,GUICreate("", 0, 0, 0, 0, Default, @SW_SHOWDEFAULT)) That keeps the inputbox on top, but it loses focus when the main program starts, so the user has to click back in it, he can't just hit enter unless he does it before the main program loads. How can I keep it on top and maintain the focus? Link to comment Share on other sites More sharing options...
Developers Jos Posted January 31, 2018 Developers Share Posted January 31, 2018 InputBox() is a blocking function, so just build your own inputbox() with a gui and keep checking whether it is the active window, and if it isn't, do a WinActivate(). Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Dana Posted January 31, 2018 Author Share Posted January 31, 2018 Thanks... that's what I ended up doing. A little more work but works perfectly now. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now