litlmike Posted March 24, 2006 Share Posted March 24, 2006 I have a GUI. Whenever the user presses enter, I want it to press/click my "Done" button. No matter where the user is focused. How do I do this? Thanks in advance! _ArrayPermute()_ArrayUnique()Excel.au3 UDF Link to comment Share on other sites More sharing options...
Nuffilein805 Posted March 24, 2006 Share Posted March 24, 2006 while 1 if _ispressed ("0D") then controlclick ("your window", "your text", "your button", "left", 1) wend this is the whole magic you'll need the beta my little chatmy little encryption toolmy little hidermy unsafe clickbot Link to comment Share on other sites More sharing options...
NegativeNrG Posted March 24, 2006 Share Posted March 24, 2006 you can use the button style called $BS_DEFPUSHBUTTON. [size=20]My File Upload[/size]Register at my site and upload. Link to comment Share on other sites More sharing options...
Nuffilein805 Posted March 24, 2006 Share Posted March 24, 2006 well, you could start a function when you're pressing enter ;1. hotkeyset("{enter}", "start") while 1 sleep (100) wend func start() msgbox (0, "Start", "Function started") endfunc ;or 2. while 1 if _ispressed ("0D") then start() wend func start() msgbox (0, "Start", "Function started") endfunc both should work you can edit the both that they only work if your window is active by: if winactive("your window title", "") then; do whatever my little chatmy little encryption toolmy little hidermy unsafe clickbot Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted March 24, 2006 Moderators Share Posted March 24, 2006 well, you could start a function when you're pressing enter ;1. hotkeyset("{enter}", "start") while 1 sleep (100) wend func start() msgbox (0, "Start", "Function started") endfunc ;or 2. while 1 if _ispressed ("0D") then start() wend func start() msgbox (0, "Start", "Function started") endfunc both should work you can edit the both that they only work if your window is active by: if winactive("your window title", "") then; do whateverYou don't get an error with 2 func start()(s)? Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Nuffilein805 Posted March 24, 2006 Share Posted March 24, 2006 You don't get an error with 2 func start()(s)?actually you don't, but i just was too lazy to do 2 code-boxes that's why there is a ";or 2. " in there my little chatmy little encryption toolmy little hidermy unsafe clickbot Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted March 24, 2006 Moderators Share Posted March 24, 2006 , I didn't notice that!! Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
CyberSlug Posted March 24, 2006 Share Posted March 24, 2006 Simple example using OnEvent, though GuiGetMsg could be used instead: #include <GuiConstants.au3> Opt("GuiOnEventMode", 1) $GUI = GuiCreate("Example") GuiSetOnEvent($GUI_EVENT_CLOSE, "quit") $input = GuiCtrlCreateInput("input box", 10, 10, 200, 30) $button = GuiCtrlCreateButton("Click Here", 10, 60, 100, 40) GUICtrlSetOnEvent($button, "simulateClick") GuiSetState() While 1 sleep(100) ; Set Enter as hotkey only when our GUI is active If WinActive($GUI) Then HotKeySet("{Enter}", "simulateClick") Else HotKeySet("{Enter}") EndIf WEnd Func simulateClick() HotKeySet("{Enter}");good idea to unregister hotkey when MsgBox appears.... MsgBox(0x1000, "Debug", "Button was 'clicked'") HotKeySet("{Enter}", "simulateClick") EndFunc Func quit() Exit EndFunc Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig! 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