Jump to content

Simulate Mouse Click / Click and Hold on keyboard


Go to solution Solved by Nine,

Recommended Posts

Hello !

i am doing some work on my computer that requires me to drag and drop objects A LOT and it puts a strain on my Mouse buttons

and this kills my mouse a lot faster and i often have to replace my mouse. im using G203 Lightsync this is my second G203.

i thought i should be able to create a simple hotkeyset to bind my ALT button (which is not used) to simulate LEFT MOUSE button instead

but i couldn't find it in the SEND() key list.

i was wondering if anyone can point me in the right direction.

the objective is to simulate LEFT MOUSE button functions using ALT key so pressing and holding ALT key should also be the same as Pressing and Holding the LEFT MOUSE button.

 

thanks very much for any help

Link to post
Share on other sites
2 hours ago, Nine said:

Look at Mouse Management in help file.  And _IsPressed in UDF Misc Management.

 

thanks  man ill have a look as soon as i can find out why my help file is not displaying anything when i clicked on the right subcategories from the panel.

Link to post
Share on other sites

i researched _IsPressed on the web and i think it may not work for me since it will keep triggering the function when i press and hold a key.

i was hoping i could press and hold my ALT key and then i could do some codes to make it simulate a press and hold on the LEFT MOUSE BUTTON.

Link to post
Share on other sites
25 minutes ago, Jos said:

Check out the HotKeySet() function in the helpfile.

hi thank you. i did check it out from the web but it seems i cant use it to make ALT KEY execute a LEFT CLICK because there is no mouse buttons in the Send() function list.

do you know why my HELPFILE displays a blank white page when i click a result ? like if i search "HotKeySet" and i see "Function _Hotkeyset" from the result and i click or double click on it nothing is displayed in the right side panel. its just white space on the right. it wasn't like this before.

so i downloaded the latest version today ( the zip portable version ) and i extracted, double clicked on the helpfile and search

but its the same thing, nothing is displayed. results are displayed on the left panel but when i click on a result nothing gets displayed on the right side panel.

Link to post
Share on other sites
27 minutes ago, Jos said:

Did you RightClick the helpfile and change the setting to allow the content?

ah THANKS ! that did it. i can see the help sections now. 

but checking on hotkeyset still did not say anything about being able to simulate a LEFT MOUSE click when i press a key on the keyboard

or simulate a PRESS & HOLD on the LEFT MOUSE button when i PRESS & HOLD a key on the keyboard.

Link to post
Share on other sites
  • Solution
7 hours ago, SIDEKICK said:

i was hoping i could press and hold my ALT key and then i could do some codes to make it simulate a press and hold on the LEFT MOUSE BUTTON.

Try this.  It will only works one time, you will need to add code to loop it around :

#include <Misc.au3>

While Not _IsPressed("12") ; Alt key
  Sleep(50)
WEnd
MouseDown("left")
While _IsPressed("12")
  Sleep(50)
WEnd
MouseUp("left")

But remember with your request of holding alt key, you may found some side effects that you may not want...

Link to post
Share on other sites
30 minutes ago, Nine said:

Try this.  It will only works one time, you will need to add code to loop it around :

#include <Misc.au3>

While Not _IsPressed("12") ; Alt key
  Sleep(50)
WEnd
MouseDown("left")
While _IsPressed("12")
  Sleep(50)
WEnd
MouseUp("left")

But remember with your request of holding alt key, you may found some side effects that you may not want...

ahh dude. these MouseDown / MouseUp functions seems to be what i was looking for. 

ill find a way to get around the press and hold issue but at least now i know what functions to use to simulate Mouse clicks.

now i can just find a substitute KEY on my keyboard.

this will really help prolong my mouse buttons because keyboard keys always last longer than mouse for some reason.

thanks very much for this.

Link to post
Share on other sites

im thinking maybe not doing the Press and Hold method rather i would be using a keyboard KEY as a SWITCH for LEFT MOUSE ON/OFF.

so perhaps pressing say "ALT" key will trigger MouseDown("left") and turn a "mouseISdown" switch variable to 1

then the next time i press "ALT" key again it will check if mouseISdown = 1 then it will trigger MouseUp("left")

Link to post
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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...