Code: Select all
#NoEnv
;#Warn
#MaxThreadsPerHotkey 2
SetControlDelay -1
SendMode Input
toggle := 0
return
F8::
IfWinExist[, ("ahk_exe program.exe")]
{
toggle := !Toggle
While Toggle
{
Click
sleep 37
}
}
IfWinNotExist[, ("ahk_exe program.exe")]
{
MsgBox Not running.
}
return
I'm VERY new at this... So if my code look scrambled, don't think to much about it.
This is my very first script. Started using AutoHotkey today, so go easy on me.
Anywho...
My issue is this. I am trying to create an autoclicker, which will work, even if the window isn't active, or even behind another window. This is why I thought of ControlClick. But since I'm new, I do not yet have the understanding nor the experience to complete this wish. So I thought some of the experienced guys here, could help me out.
But what I precisely want the script to do.
#1. First of, I want it to click for as long as it is toggled on, or the program closes.
#2. I would love if it could activate at the mouse position, when I activate the script. And stay there, even if I move the mouse away. Sort of like using coords. They should just be changeable from everytime I click F8, as the needed area for clicking changes.
#3. If the program ain't running, and I click F8, I want it to show a popup telling me so.
So the autoclicker doesn't randomly start, if I'm watching a movie, or sitting on facebook or whatever... It should toggle it on, if program.exe ain't running, simple.
I've tried putting else in, instead of IfWinNotExist, but that gives me an error. :/
Don't understand the if's and else's yet. xD
Also... When I toggle it on, it works. Haven't tested it, if the program isn't running yet, but.. When I toggle it off again, I get the MsgBox twice! Which means. It pops up, when I activate, but gets suspended, and I get one when I deactive, which gives me 2 in a row...
Please someone help me out!
EDIT: Oh, I should maybe also mention.. The script should only work inside of the programs window, not outside.