TurboClick

Post your working scripts, libraries and tools for AHK v1.1 and older
Locksmitharmy
Posts: 6
Joined: 29 Sep 2017, 09:46

TurboClick

02 Oct 2017, 08:40

I was updating a software at work and it required about 20,000 lines to be inserted into a database. many already existed because this was a small monthly update. The software thought it was polite to tell me every time I was updating something that already exists... and forced me to click [OK] before continuing. I though that was silly and wrote this script to make my mouse click repeatedly while I walked away. (it clicked repeatedly because I layed something over the button)

after it worked so well I made it have a hotkey ([Ctrl] + [Insert]) to turn on and off this function (so dragging could be used)
I named it TurboClick (like the Turbo buttons on the old NES joypads):
.exe download: http://lsadevelopment.com/Software/Files/TurboClick.zip
Source:

Code: Select all

#NoTrayIcon
var = 1 
MsgBox TurboClick is OFF.`n`r([Ctrl] + [Insert])

^Ins::
  if(var = 0)
  {
    var = 1
    MsgBox TurboClick is OFF.
  }
  else
  {
    var = 0
    MsgBox TurboClick is ON.
  }
return 

~$LButton::
  if(var = 0)
    KeyWait LButton, T0.5
    if ErrorLevel
      While GetKeyState("LButton", "P")
      {
        Click
        Sleep 25
      }
BoBo
Posts: 6564
Joined: 13 May 2014, 17:15

Re: TurboClick

02 Oct 2017, 09:30

Are all those programms you provide for download (on your page) made with AHK?? :)
Locksmitharmy
Posts: 6
Joined: 29 Sep 2017, 09:46

Re: TurboClick

02 Oct 2017, 09:40

haha no.
actually this is my first venture into AHK.
most (not all) are C# programs.

I am learning AHK has some real power though. might be worth learning more and getting better with it.
User avatar
Delta Pythagorean
Posts: 627
Joined: 13 Feb 2017, 13:44
Location: Somewhere in the US
Contact:

Re: TurboClick

03 Oct 2017, 07:05

Code: Select all

#NoTrayIcon
Var = 1
MsgBox,, Turbo Click, Turbo Click is currently off. Use the hotkey`, Ctrl+Insert`, to toggle it on and off.

^Ins::
MsgBox, % "Turbo Click is " (Var := !Var) ? "on" : "off"
Return 

~$LButton::
While (GetKeyState("LButton", "P") && (Var = 1)) {
	SendInput, {LButton}
	Sleep 25
}
Untested, but made smaller.

[AHK]......: v2.0.12 | 64-bit
[OS].......: Windows 11 | 23H2 (OS Build: 22621.3296)
[GITHUB]...: github.com/DelPyth
[PAYPAL]...: paypal.me/DelPyth
[DISCORD]..: tophatcat

Locksmitharmy
Posts: 6
Joined: 29 Sep 2017, 09:46

Re: TurboClick

03 Oct 2017, 11:18

I like this:

Code: Select all

^Ins::
MsgBox, % "Turbo Click is " (Var := !Var) ? "on" : "off"
Return
is that a boolean AND assignment operator (the := )
pretty cool.
User avatar
Delta Pythagorean
Posts: 627
Joined: 13 Feb 2017, 13:44
Location: Somewhere in the US
Contact:

Re: TurboClick

04 Oct 2017, 08:46

Locksmitharmy wrote:I like this:

Code: Select all

^Ins::
MsgBox, % "Turbo Click is " (Var := !Var) ? "on" : "off"
Return
is that a boolean AND assignment operator (the := )
pretty cool.
If you want an easy explanation for it: ? : is basically a smaller, one line if and else expression.
The Var := !Var is for "toggling" the variable's state. If 1, or true, then it would flip to be 0, or false.

[AHK]......: v2.0.12 | 64-bit
[OS].......: Windows 11 | 23H2 (OS Build: 22621.3296)
[GITHUB]...: github.com/DelPyth
[PAYPAL]...: paypal.me/DelPyth
[DISCORD]..: tophatcat

Locksmitharmy
Posts: 6
Joined: 29 Sep 2017, 09:46

Re: TurboClick

04 Oct 2017, 09:22

I understand the one line if statement, it is the same as c#.
But in c# we would not use the := ... we could just say (Var = !Var)...
What is the : for?
User avatar
Delta Pythagorean
Posts: 627
Joined: 13 Feb 2017, 13:44
Location: Somewhere in the US
Contact:

Re: TurboClick

05 Oct 2017, 07:08

Locksmitharmy wrote:I understand the one line if statement, it is the same as c#.
But in c# we would not use the := ... we could just say (Var = !Var)...
What is the : for?
That turns the variable to be in Expression mode. Without it, it forces the if to ask if the Var is not the Var. Which is useless and makes no sense.
Without the colon, it's a normal if command. With it, it defines the variable.

[AHK]......: v2.0.12 | 64-bit
[OS].......: Windows 11 | 23H2 (OS Build: 22621.3296)
[GITHUB]...: github.com/DelPyth
[PAYPAL]...: paypal.me/DelPyth
[DISCORD]..: tophatcat

Locksmitharmy
Posts: 6
Joined: 29 Sep 2017, 09:46

Re: TurboClick

05 Oct 2017, 07:55

Neat Thanks.

(for completeness, In c# (var == !var) would do a comparison only while (var = !var) would do an assignment and still return a boolean because var IS a boolean)
Jaxter88

Re: TurboClick

10 Oct 2017, 22:23

Locksmitharmy wrote:Neat Thanks.

(for completeness, In c# (var == !var) would do a comparison only while (var = !var) would do an assignment and still return a boolean because var IS a boolean)
When using "=" to assign a value, literals are tolerated. However, assigning a variable's value requires bracketing the variable name with "%" delimiters, e.g. Var1 = %MyVar%.

The ":=" assignment operator doesn't require this, and has other useful properties.

See:

https://autohotkey.com/docs/Variables.htm

and the "Assign" section of the Operators help page at:

https://autohotkey.com/docs/Variables.htm#Operators
Locksmitharmy
Posts: 6
Joined: 29 Sep 2017, 09:46

Re: TurboClick

11 Oct 2017, 07:15

Neatoe, thanks for that
User avatar
Tomer
Posts: 366
Joined: 21 Aug 2016, 05:11

Re: TurboClick

15 Oct 2017, 09:35

Cool tnx

Return to “Scripts and Functions (v1)”

Who is online

Users browsing this forum: No registered users and 236 guests