AHK delay between clicks - autohotkey

I need to introduce a delay between left mouse clicks to make it impossible to accidentally double click but still be able to hold down LButton.
I've tried variations of loop, if and Sleep between send {LButton UP} and send {LButton DOWN}. Nothing seems to work

Related

autohotkey: How to make right mouse key mimic itself and the functions of left mousekey at same time?

aka RButton should activate both LButton and Rbutton's native functions based on whether it is held down or clicked.
~Rbutton::
send {lbutton down}{rbutton down}
return
This only works if I hold Rbutton down. When I release....Lbutton continues to press itself cause its still pressed down....I have to tap it to stop. It also doesn't address at all the single click function of mousekeys. Mouse is not like keyboard presses. I'm confused when the community acts like they are. Mouse has helddown state and it has single press state. I want both of these states translated over.
When rbutton is held it should also hold Lbutton. when rbutton is released it should also release lbutton. The above code activates when rbutton is pressed....so I'm guessing any usage of
If GetKeyState("RButton", "P")
send {lbutton down}
return
has to take place outside it. But this doesn't work outside of it. So do i use if not getkeystate()....well that is going to destroy the native function of LButton which is also a no-no. There should be no key destruction only key addition, I want to add Lbutton's workings to Rbutton. period.
~RButton::LButton
Seems to work. I'm confused as to why, and what this syntax is. I thought the solution would involve the Send, and its scripting of {click right mouse}{click right down}?

Is there an alternate way to hold down a mouse button with AHK?

For holding down a mouse button, I've tried:
Click down
and
Send {LButton down}
But both of these methods cause the game I'm making a macro for to log me out for "too many actions". Are there any alternative methods?
Mouseclick
Mouseclick, left, x, y, D

How would I hold down a click keystroke in AutoHotKey?

I am having a problem when using my AHK script.
I want to hold down the left click for 13 seconds.
Click down
Sleep, 13000
Click up
It works on Google Chrome when I am clicking on text and I drag my mouse it highlights (meaning of course it is clicking down).
When I go on my game it wont click anything.
Am I doing it wrong or is it a problem with AutoHotKey?
See SendPlay docs:
SendPlay's biggest advantage is its ability to "play back" keystrokes and mouse clicks in a broader variety of games than the other modes.
SendPlay {LButton down}
sleep 13000
SendPlay {LButton up}
Furthermore, I often find that running my scripts as administrator helps solve most of my problems when scripting for games, especially if the game itself is ran on administrator levels.

AutoHotKey alt stays pressed

I have this script
+#^a::
SetTitleMatchMode 2
IfWinExist InterCounter
{
WinActivate
Send x
Send !{ESC}
}
return
after using it, alt stays pressed and I have to press alt on my keyboard to get to normal state (no key pressed). If I forget to do it and type something, a key shortcut is initiated. If I type SPACE for example, ALT+SPACE is pressed.
I tried various things. {Alt up} and other. They did not work. Where is the problem? Is there a fix for my script?
(would do that in a comment if I could)
try to Send , {ALT down}{ALT up} which should do the trick. If not something else is interfering, like a 3d party program. Try close everything on your system except notepad and the AHK-script and see if that helps.

How to activate a window after it has lost focus?

So i am using this great software called Website-Watcher, which is rss feed reader and web content tracker.
I have configured it to open external links in firefox, which is opening tabs in the background.
BUT the problem is that Website-Watcher looses focus after i hit some link, so is there a way to open a link, regain lost focus and send click to be able to scroll, i have found a script that activates window on mouse scroll BUT the scroll functionality of program is not regained.
Please, give me some ideas!
EDIT UPDATE::: I have finally made it work, the problem was with the Windows 8.1 Admin rights, because i run Website-Watcher elevated, script that i was using stopped working.
The scripts are here:
http://www.autohotkey.com/board/topic/6292-send-mouse-scrolls-to-window-under-mouse/
http://www.autohotkey.com/board/topic/99405-hoverscroll-verticalhorizontal-scroll-without-focus-scrollwheel-acceleration/?p=623967
With those scripts you can perform scroll without activating windows or if you use the former you can even activate windows with mouse scroll.
Use WinActivate
For example, WinActivate Untitled - Notepad would activate (bring focus to) the window "Untitled - Notepad". This title must be exact and is case-sensitive.
It might be easiest to do this in a low-tech way. I'm not familiar with Website-Watcher, so I'll share a script I use that you should be able to adapt.
I use Feedly in Chrome for RSS reading, and hitting "v" in Feedly opens the story in a new tab. I use my Media Play button to hit "v" and bring me back to Feedly:
Media_Play_Pause::
send v
sleep 50
send {Ctrl Down}{Shift Down}{Tab}{Shift Up}{Ctrl Up}
return
So, define your hotkey, have it trigger the link to open in Firefox, and then hit Alt-Tab to jump back:
X::
send y
sleep 50
send {Alt Down}{Tab}{Alt Up}
return
Obviously, replace "X" and "y" above.
I don't care about using my Media Play button for anything else, but if you want your hotkey to be context sensitive, use #IfWinActive.
Use "WinGet, variableName , List, yourWindowName" (without quote)
then call your variableName contate it with 1 in every ControlSend
for example :
WinGet, nexid, List, myHyperTerminal
ControlSend, , {shift down}at=cmgs{shift up}=303{ENTER}, ahk_id %nexid1%
sleep, 1000
ControlSend, , {shift down}sms{shift up}{space}10000, ahk_id %nexid1%
sleep, 1000
if you want to use control key such as shift, ctrl, alt, don't forget to add "SetKeyDelay, intDelay, intPressDuration" (without quote)
for example the script will be list this
#usehook on
SetKeyDelay, 50, 20
WinGet, nexid, List, zz1
$F6::
ControlSend, , {shift down}at=cmgs{shift up}=303{ENTER}, ahk_id %nexid1%
sleep, 1000
ControlSend, , {shift down}sms{shift up}{space}10000, ahk_id %nexid1%
sleep, 1000
return
$F7::pause
it will be sent to active/inactive window "zz1" as :
AT+CMGS=303
SMS 10000