Jump to content
Dana

InputBox always on top AND active

Recommended Posts

Dana

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?

Share this post


Link to post
Share on other sites
Jos

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 Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
Dana

Thanks... that's what I ended up doing.  A little more work but works perfectly now. :)

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

×