Jump to content

Recommended Posts

Posted (edited)

How can one make a InputBox keep focus, even if the user clicks on a different window?

See here: http://www.autoitscript.com/forum/index.php?showtopic=13820

Edit: boils down to making your own GUI version of an inputbox and using WS_EX_TOPMOST

GUICreate("PopUP", 191, 85, -1, -1, $WS_DLGFRAME, $WS_EX_TOPMOST)

[see gafrost's code in the link above]

Edited by herewasplato

[size="1"][font="Arial"].[u].[/u][/font][/size]

Posted

thanks. I was hoping I wouldn'r have to use that route, but it looks like it is my only option.

That's an oxymoron for sure. another option would be to have another compiled script executed with Run() before the inputbox is displayed. That will give you the multi-threaded approach that you're looking for. Example

Code 1

Run('"Code 2.exe"')
InputBox("YOU WILL FILL THIS OUT","I'm not going anywhere until you cancel or submit me")

Code 2

Opt("WinTitleMatchMode",4)
WinWait("YOU WILL FILL THIS OUT")
WinSetOnTop("YOU WILL FILL THIS OUT","",1)
While WinExists("YOU WILL FILL THIS OUT")
If WinExists("YOU WILL FILL THIS OUT") And WinGetTitle("active") <> "YOU WILL FILL THIS OUT" Then WinActivate("YOU WILL FILL THIS OUT")
WEnd

there's another option for you that doesn't involve a new gui

Posted

how do u change it so u have to put a certain word in the input box

example using input

#include <GuiConstants.au3>


GuiCreate("ResNet CD", 285, 280)
GuiCtrlCreateGroup("Step 1 - Sign In For Certification", 10, 45,260,100)
$LabelS = GUICtrlCreateLabel("Name: " , 20, 80)
$name = GuiCtrlCreateInput("", 70, 78, 150, 20)
$LabelPass = GUICtrlCreateLabel("Password: ",20,110)
$pass = GUICtrlCreateInput("Password",70,108,150,20)
$Check= GUICtrlCreateButton("Sign In", 40,160,200,60)
GUISetState(); display the GUI

While 1
    $msg = GUIGetMsg()
  
    Select
        
        Case $msg= $Check
            If GUICtrlRead($pass) = "Password" Then
           ;verify or write password to a file
                GUIDelete()
                ExitLoop
            EndIf
        Case $msg= $GUI_EVENT_CLOSE
            Exit
            
    EndSelect
WEnd 

MsgBox(64, "OK!!!!", "The password was correct   ")

8)

NEWHeader1.png

Posted

I can make it with a GUI, but I was simply hoping for a way to have the input box be forced to keep it's focus. It's no biggy.

that's what i gave you man. a way to keep focus on the inputbox.

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
×
×
  • Create New...