*$LButton::
{
GoSub clicky
}
Return ; <<This?
clicky:
{
MouseClick, left,,,1,0,D
Sleep 1200
MouseClick, left,,,1,0,U
}
Return
Thats the script I'm currently using to hold my left mouse button down for 1.2 seconds. Works nicely, just that I cant stop it. Pausing it doesn't work. Well it would if my left mouse button wouldn't auto start it back up again. I'd like to be able to turn this off without having it take 1.2 seconds to click when I dont need it too.
I've also searched everywhere for an answer. Nothing I've tried seems to work. Left click starts by itself. need it to be on a toggle, where even if I click it wont activate, until I retoggle it. F12 or something.
Would anyone be able to help me with this?
Getting a script to stay off. On a toggle.
-
- Posts: 1
- Joined: 07 Feb 2018, 07:37
- divanebaba
- Posts: 805
- Joined: 20 Dec 2016, 03:53
- Location: Diaspora
Re: Getting a script to stay off. On a toggle.
If you want to suspend your script, try this tricky code I found in the forumIt will suspend and activate your script with same key.
BTW: Welcome to the AHK forum
Code: Select all
$Pause::
While, GetKeyState("Pause","P") {
suspend, on
Sleep, 150
}
KeyWait, Pause, D
suspend, off
return
*$LButton::
GoSub clicky
Return ; <<This is ok. Sometimes not necessary but never too much
clicky:
{
MouseClick, left,,,1,0,D
Sleep 1200
MouseClick, left,,,1,0,U
}
Return
BTW: Welcome to the AHK forum
Einfach nur ein toller Typ.
Re: Getting a script to stay off. On a toggle.
Another handy trick -- you can also use PostMessage to directly interact with scripts:
It doesn't require the script directory, just replace "NewAutoHotkeyScript.ahk" with the name (and .ahk suffix) of the script needed. Any script can then pause, suspend, kill, edit, or run any other script this way through hotkeys, labels, etc.
Code: Select all
PostMessage, 0x111, 65307,,, NewAutoHotkeyScript.ahk - AutoHotkey
Code: Select all
; PostMessage REF
; PostMessage, 0x111, 65304,,, SCRIPT.ahk - AutoHotkey
; Open: 65300
; Help: 65301
; Spy: 65302
; Reload: 65303
; Edit: 65304
; Suspend: 65305
; Pause: 65306
; Exit: 65307
Re: Getting a script to stay off. On a toggle.
F12::Suspend should work for you; not sure why the complex scripts requesting you work off of using a second script?
This would disable all hotkeys in your script.
If you need to be selectively disabling this hotkey, it can be done by using #If and custom variables. See toggle examples in (Note: The first link is from the old forums, the second link is on these forums) http://www.autohotkey.com/board/topic/6 ... re-thread/ or https://autohotkey.com/boards/viewtopic.php?f=7&t=11952
This would disable all hotkeys in your script.
If you need to be selectively disabling this hotkey, it can be done by using #If and custom variables. See toggle examples in (Note: The first link is from the old forums, the second link is on these forums) http://www.autohotkey.com/board/topic/6 ... re-thread/ or https://autohotkey.com/boards/viewtopic.php?f=7&t=11952
Who is online
Users browsing this forum: No registered users and 218 guests