Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mouse click that called from function #16

Open
artemchege opened this issue Aug 13, 2020 · 3 comments
Open

mouse click that called from function #16

artemchege opened this issue Aug 13, 2020 · 3 comments

Comments

@artemchege
Copy link

artemchege commented Aug 13, 2020

Guys, i need your help, i cannot understand how can i call left button mouse click not binding it to any button.
I have this:

def exitAutoHotKey(autohotpy, event):
"""
exit the program when you press ESC
"""
autohotpy.stop() # makes the program finish successfully. Thisis the right way to stop it

def superCombo(autohotpy, event):
stroke = InterceptionMouseStroke()
stroke.state = InterceptionMouseState.INTERCEPTION_MOUSE_RIGHT_BUTTON_DOWN
autohotpy.sendToDefaultMouse(stroke)
stroke.state = InterceptionMouseState.INTERCEPTION_MOUSE_RIGHT_BUTTON_UP
autohotpy.sendToDefaultMouse(stroke)

if name == "main":
auto = AutoHotPy() # Initialize the library
auto.registerExit(auto.ESC, exitAutoHotKey)
auto.registerForKeyDown(auto.A, superCombo)
auto.start() # Now that everything is registered we should start runnin the program

When i press A, everithing is working, right mouse button is pushed. But i want to do this not pushing A or any button, but just calling the function superCombo(). How can i do this?
I call function ==> left click is working (once or in endless loop, that doesnt matter).

@Bic0n
Copy link

Bic0n commented Aug 22, 2021

Guys, i need your help, i cannot understand how can i call left button mouse click not binding it to any button.
I have this:

def exitAutoHotKey(autohotpy, event):
"""
exit the program when you press ESC
"""
autohotpy.stop() # makes the program finish successfully. Thisis the right way to stop it

def superCombo(autohotpy, event):
stroke = InterceptionMouseStroke()
stroke.state = InterceptionMouseState.INTERCEPTION_MOUSE_RIGHT_BUTTON_DOWN
autohotpy.sendToDefaultMouse(stroke)
stroke.state = InterceptionMouseState.INTERCEPTION_MOUSE_RIGHT_BUTTON_UP
autohotpy.sendToDefaultMouse(stroke)

if name == "main":
auto = AutoHotPy() # Initialize the library
auto.registerExit(auto.ESC, exitAutoHotKey)
auto.registerForKeyDown(auto.A, superCombo)
auto.start() # Now that everything is registered we should start runnin the program

When i press A, everithing is working, right mouse button is pushed. But i want to do this not pushing A or any button, but just calling the function superCombo(). How can i do this?
I call function ==> left click is working (once or in endless loop, that doesnt matter).

Hi!

Did u find an answer? I face exact same trouble now.

@lekary
Copy link

lekary commented Aug 23, 2021

Guys, i need your help, i cannot understand how can i call left button mouse click not binding it to any button.
I have this:
def exitAutoHotKey(autohotpy, event):
"""
exit the program when you press ESC
"""
autohotpy.stop() # makes the program finish successfully. Thisis the right way to stop it
def superCombo(autohotpy, event):
stroke = InterceptionMouseStroke()
stroke.state = InterceptionMouseState.INTERCEPTION_MOUSE_RIGHT_BUTTON_DOWN
autohotpy.sendToDefaultMouse(stroke)
stroke.state = InterceptionMouseState.INTERCEPTION_MOUSE_RIGHT_BUTTON_UP
autohotpy.sendToDefaultMouse(stroke)
if name == "main":
auto = AutoHotPy() # Initialize the library
auto.registerExit(auto.ESC, exitAutoHotKey)
auto.registerForKeyDown(auto.A, superCombo)
auto.start() # Now that everything is registered we should start runnin the program
When i press A, everithing is working, right mouse button is pushed. But i want to do this not pushing A or any button, but just calling the function superCombo(). How can i do this?
I call function ==> left click is working (once or in endless loop, that doesnt matter).

Hi!

Did u find an answer? I face exact same trouble now.

I was able to achieve this by following the example of someone else's code.
Now I don't remember how I did it

@lekary
Copy link

lekary commented Aug 23, 2021

look for information on the topic of trading

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants