Auto Left Click on Hold? - macros

I want my mouse to rapidly autoclick when I hold the left mouse button, how can I do this?
I have searched for hours, I didn't find anything!
Thanks in advance.
EDIT: P.S.: I want the rapid click to stop as soon as I release the left button.

Can you be slightly more specific? Are you trying to write out the program of just finding an auto clicker application?
If you are looking for the application only, then there is alot available online. Just google. One such application could be: http://auto-clicker-by-shocker.soft32.com/
If you are trying to write a program, its pretty simple too, but you need to let me know what language you are using, if its OOP, I should be able to help.

Nevermind, I made an AutoHotKey script:
Suspend, On
~XButton2::Suspend, Toggle
~LButton::
While GetKeyState("LButton", "P"){
Click
Sleep 50 ; milliseconds
}
return

Related

Keybindings with mouse click

I am developing in C#, and when I hold down cmd (macOS) and Click a method, I am taken to it's Definition. I am looking for a way to be able to hold down cmd+shift and click the method, and be taken to the methods Implementation. I have searched and tested for some time without finding anything; I am starting to think it is not possible.
Does anyone know how, or if it even is possible?
It's currently impossible. Mouse clicks are not considered modifiers and cannot be customized right now. There's an open issue for this: https://github.com/microsoft/vscode/issues/3130.
You can still press command+F12 to jump to Implementation (which may be unhandy, since you have to press Fn as well). Besides, some applications or specific mouses allow you to map keys.

AutoHotKey Right Click

I don't understand why most of the suggestions aren't working for me, so I'm asking here.
I'm trying to get AHK to right click when I press a shortcut. I found a couple of ways to do it:
^R:: RButton
return
and
^R:: AppsKey
return
and
^R:: Click Right
return
as well as a few others.
However, none of these actually seem to right click as if I were physically right clicking with my mouse. They all seem to right click as though ^R was remapped to Shift+F10, or some other system right click. What I actually want is a real right click, emulated just as if I were right clicking with my mouse. It should work in folders, applications, everywhere. Is there a way to do this?
As #Jim U said in the question's comments, put it in a new script file. From your reply to his comment it seems that solved the problem, so I have written this answer to clarify that.
In programming generally, always isolate the code first as the problem can be caused by something elsewhere.

how do you create a AutoHotKey spin macro?

I need something that repeats the keyboard keys "up, left, down and right" and repeats endlessly until the insert key is pressed to pause it. I'm not sure how i should approach this. Could someone help point me in the right direction?
I am not on a windows computer at the moment, so this code is untested
This is for ahk_L not ahk_basic.
You will need to create a hotkey to start this loop.
You should also make sure this runs only on the window you are indending, as well as a way to quickly exit the script, as the script may run away from you, causing you to restart the computer.
; While the physical insert key is up, send the keystrokes
While(!GetKeystate("Insert","D")) {
Send {Up}{Left}{Right}{Down}
}
If this is for a game, (and I suspect it might be) you might need to use a difrerent send mode. See the Autohotkey FAQ for info on that particualr topic.

ControlClick is not working

My script is supposed to press a button somewhere in my window, upper left. It is not working as it should be. I tried this:
ControlClick ClassNN ThunderRT6UserControlDC29, ahk_class ThunderRT6FormDC
Yet it doesn't work.
I tried the manual option:
Controlclick x160 y60, ....
But that doesn't work as well.
Eventually I resorted to a mere:
Click 160, 60 and that does work.
I was wondering why it is behaving like that? Also, is there a way for merely the button to get pressed without the mouse actually going all the way over there. I looks stupid and it is slow.
The main reason for me asking this question is because it is closely related to another question I posed:
How to obtain textual contents from a window
The common denominator is that anything with classNN and ahk_class seems to be problematic.
Try running script as a administrator (if you're on Windows 7 or Vista)
I finally found my own solution after skimming the documentation more thoroughly:
https://autohotkey.com/docs/commands/ControlClick.htm#Reliability
You can specify NA as the sixth parameter to wait for the mouse button to lift.
I found that when firing Control, Check, ,Button1 prior to ControlClick the click didn't work, but adding the NA to the end somehow magically fixed it. I suppose a click was being simulated and had not yet lifted.
First, make sure you have the capitalization correct. controlclick is case and space sensitive - everything in the name has to be correct.
Second, for your mouse-moving issue - first save the position of your mouse, then controlclick, and then put your mouse back where you found it. The mouse will only be out of place for the duration of either the click or the timeout. 160ms is not noticeable.
You might also try using ahk to activate the window, bringing it the front, and then seeing if you can tab through the controls to the one you want, and then push it by sending keys like space or return to the window in the forefront (which you have activated). This avoids using controlclick altogether. Some windows can be tricky.
Controlclick x160 y60,A,,Left,1, NA
Manual option like that should work,at least in my case it worked.
Left = your mouse button pressed
1 = number of clicks
A = Active Window
Also options to retrieve contents from the games or retrieve variables from other autohotkey parts for ControlClicks or SendMessage/PostMessage seem to not work yet.

Autohotkey fails to recognize image under resolution change

I have created an autohotkey scripts which automates a manual process by launching an application and clicking on the script mentioned icons. The script is working fine on one computer which having higher resoultion but fails to execute on other computer with different resoultion. Do you have any suggestions to workout in other way. This app doesn't have any keyboard shortcuts and only executes on mouse clicks. I hope there will be an anwer.
Most Apps Have Alt Shortcuts, have you tried them? also you may try re-adjusting mouse click x,y as per resoulution
::: Explaining the problem ::: Please read to understand the problem.
Lets start off simple you create the autohotkey script on COMPUTER_A, you print_screen/capture all your images & resize them on COMPUTER_A, however when you transfer your files to COMPUTER_B image_search does not find matchs as well or at all, why is this ?
Well COMPUTER_A and COMPUTER_B are two totally different computers, the problem comes cause with two different computers each have different COLOR TEMPLATES installed on them, if you copy the color template from COMPUTER_A onto COMPUTER_B or any computer. Overall problem is different color templates does not allow image_search to find a match pixel by pixel cause the varying difference between the two different computers. Thats why its best to copy color template from computer_A to another computer to allow image search to work properly.
::: Finding the COLOR Template :::
On Win7 --> Control Panel --> Color Management --> Mine was easy to find cause it is the color template that came with my computer monitor, however yours might take a little more work in finding. ICC profiles are generally printers, ICM profiles are display drivers/color templates for you computer screen. Once you find your display profile currently in use on COMPUTER_A find it on your computer storage & copy it to your autohotkey direction for easy access in the future so it can be copied with your autohotkey script to computer_B or computer_Z later. Right Click on the ICM once copied to computer_B and click install & its possible you may need to restart the computer for all changes to take affect.
::: Results :::
Once the color template from computer_A is installed on another computer image_search should work exactly how it does on computer_A, i've personally tested the results on 6 different computers from XP, Vista & Win7, always had a 100% success rate which i believe makes this a universal solution/fix to the image_search problem with other computers.
I do caution those few people who have trouble with this to have patience & do you fair share of research into "windows color profiles" to make this solution work for you, i just foresee someone accidently finding/copying the wrong ICM/ICC profile. Also to be warned if someone installs photography software/development software like adobe photoshop/multimedia/development software sometimes they come with their own ICM/ICC profiles and could overright the existing ones causing image_search to again become a problem. Just reinstall the default ICC/ICM profile again to fix that problem.
::: CONCLUSION :::
I hope this was helpful to someone, sorry for all the writing but i thought it best to share my complete findings with you all since it can get complicated.
Here is how I once solved it.. In the beginning I ask the user to capture the mouse position of each icon, and store these coordinates for later use.
Hotkey, LButton, off ; Make sure that the Left Mouse button inactivator is turned Off
Lbutton:: ; Disable the Left Mouse Button
SplashImage , %A_ScriptDir%/Images/YourScreenShot.jpg,,, Screen shot, Icons ; Show Screenshot of what the user needs to do
SoundBeep 1000, 300 ; wake up user
SplashTextOn, 200, 100, Script Preparations, Please Click on Icon1. ; Show new instructions to the user
WinMove, Script Preparations,, (A_ScreenWidth/2)-150, (A_ScreenHeight/2)-200 ; Move the text instructions window with the name "Script Preparations" 150 pixels right of the center of the screen and 200 pixels up
SoundBeep 600, 300 ; Wake up user
; Here the left mouse button will temporarily be disabled (to prevent actions)
Hotkey, LButton, on ; Turn Left Mouse Button OFF, to capture the Mouse click
KeyWait, LButton, D ; Wait for LeftMouseButton click Down
MouseGetPos, xpos1 ,ypos1 ; Store the position where the mouse was clicked (Icon1)
Repeat this for all icons used.
Then if you want to click on icon1 use:
MouseClick, left, %xpos1% ,%ypos1% ; Perform the mouse click on the captured mouse location