Jump to content

catch a boutton click


 Share

Recommended Posts

Thanks. I've read the examples from gui reference; good to know. What i want to do: being given a window not from a gui I made), I want to have my program in the background and, when a user click a specific button in that window, my program to show a message box(par example).

I don't know how to react to an event from an outside window. I can though get the position of the button i want to catch and use some mouse events when the user clicks in that area, but i didn't find the events on mouse click, just functions to perform clicks and other mouse operations.

Link to comment
Share on other sites

If you want to do OnEvent Mode (I prefer it)

At the begging of the script write a line of code: Opt("GUIOnEventMode",1) to set the mode to OnEvent

After creating the control have a line of code: GUIControlSetOnEvent($button,"Function") to set the Event to the control

Then define the function

Func Function()
     MsgBox(0,"Title","Text")
EndFunc
Link to comment
Share on other sites

  • Moderators

WinExists() + WinActive() + ControlGetFocus() + _IsPressed()

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

If you want to do OnEvent Mode (I prefer it)

At the begging of the script write a line of code: Opt("GUIOnEventMode",1) to set the mode to OnEvent

After creating the control have a line of code: GUIControlSetOnEvent($button,"Function") to set the Event to the control

Then define the function

Func Function()
     MsgBox(0,"Title","Text")
EndFunc
I did not create the control, and $button shoul be the controlID as returned by the fucntion GUICtrlCreate(..)..
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...