Yardley Posted July 14, 2020 Share Posted July 14, 2020 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 More sharing options...
Nine Posted July 14, 2020 Share Posted July 14, 2020 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. “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
Yardley Posted July 14, 2020 Author Share Posted July 14, 2020 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 More sharing options...
Moderators JLogan3o13 Posted July 15, 2020 Moderators Share Posted July 15, 2020 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 More sharing options...
Recommended Posts