Jump to content

Mouse Click From Key Dll Call - (Locked)


Recommended Posts

Hi all, I want to write a script that sends a middle mouse click when I press the letter H. I found a script online that achieves this, however, it doesn't work with the program I am attempting to use it with. The program doesn't respond to the mouse click, I think it is because the click needs to be sent using another method than whatever default method AutoIt uses. After doing some research, it seems that adding a Dll call to user32.dll to the script might do the trick. I tried editing the original script and came up with what you see below which is very wrong as I am sure you will noticed. This is my first time using AutoIt and I am very much lost. Any help would be greatly appreciated. 

HotKeySet("h", "Actions")

$dll = DllOpen("user32.dll")

DllCall("user32.dll", "int", "mouse_event")

While 1
    Sleep(100)
WEnd


Func Actions()
    HotKeySet("h")
    MouseClick("right")
    HotKeySet("h", "Actions")
    Sleep(5)
 EndFunc
 DllClose($dll)

 

Link to comment
Share on other sites

What is the program you are attempting to automate ?

mouse_event api has a number of parameters you do not provide.

You should always setup error handling after each statement  that will inform you if function result failure or success.

Link to comment
Share on other sites

3 minutes ago, Nine said:

What is the program you are attempting to automate ?

mouse_event api has a number of parameters you do not provide.

You should always setup error handling after each statement  that will inform you if function result failure or success.

Hi, it is a Playstation 2 emulator called PCSX2 and the reason I need the script is because each time a lightgun game is launched, you are presented with a calibration screen with targets that you must shoot and after successful calibration, you have to press the middle mouse button to continue. The guns have buttons that I can assign to keyboard keys, therefore I just need a script that sends a middle mouse click after pressing a specific keyboard key. 

Link to comment
Share on other sites

  • Moderators

Welcome to the AutoIt forum.

Unfortunately you appear to have missed the Forum rules on your way in. Please read them now - particularly the bit about not discussing game automation - and then you will understand why you will get no help and this thread will now be locked.

See you soon with a legitimate question I hope.

The Moderation team

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...