Skip to content

Instantly share code, notes, and snippets.

@jrw254
Created November 30, 2020 18:20
Show Gist options
  • Select an option

  • Save jrw254/e99dc02fc1bfa7a3b9219e832ee6e453 to your computer and use it in GitHub Desktop.

Select an option

Save jrw254/e99dc02fc1bfa7a3b9219e832ee6e453 to your computer and use it in GitHub Desktop.
This is just some fun with Insert Key. Insert alone as a 4 key toggle. Insert & <key> as a 4 key toggle. (Just used ' a ' as an example) Control and Insert Key as a simple toggle. Alt and Insert Key with a toggle that is wrapped in an #If statement. GUI associated with Alt and Insert Key to show a visual of On and Off. This completely disables t…
#NoEnv
; #Warn
SendMode Input
SetWorkingDir %A_ScriptDir%
#SingleInstance, force
#Persistent
SetBatchLines, -1
#MaxThreadsPerHotkey 2
#InstallKeybdHook
;=================================;
; ;
; Insert Key Fun ;
; BY JRW254/SabeDth on Reddit ;
; ;
;=================================;
;This is just some fun with Insert Key. Insert alone as a 4 key toggle. Insert & <key> as a 4 key toggle. (Just used ' a ' as an example)
;Control and Insert Key as a simple toggle. Alt and Insert Key with a toggle that is wrapped in an #If statement.
;GUI associated with Alt and Insert Key to show a visual of On and Off.
;This completely disables the use of Insert. However, if you wish to retain it, you could just set it as the first switch. i.e Replace F5.
;I created this as an example doc. I saw some folks online seeming to not understand how to use their Insert Key in different ways.
;So this is just here for anyone who may need it as a guide. Hope it helps folks better understand some AHK things.
CustomColor = FFF666 ; This is for the transparency on the GUI
Gui AIN: new, +LastFound +AlwaysOnTop -Caption +ToolWindow
Gui, Color, Red
Gui, Font, s9, Arial Bold
Gui, Add, Text,, A Visual For Your Alt Insert Key
WinSet, Transcolor, %CustomColor% 100
Insert:: ; Creates a 1-4 key press toggle with just the Insert Key.
if (this_that > 0)
{
this_that += 1
return
}
this_that := 1
SetTimer, InsertKey, -600 ; You can find this lable at the bottom of the script. Don't channge the -600 lower or you may encounter issues with presses.
return
Insert & a:: ; Creates a 1-4 key press toggle while holding the Insert Key and pressing the A Key between one and four times.
if (this_that > 0)
{
this_that += 1
return
}
this_that := 1
SetTimer, AltInsertKey, -600 ; You can find this lable at the bottom of the script. Don't channge the -600 lower or you may encounter issues with presses.
return
^Insert:: ; Creates a simple toggle for Control and Insert Key.
cin := !cin ; This is the toggle on/off switch
if (cin) { ; This means the toggle is on.
MsgBox Control and Insert Toggled ON
}else{ ; !cin means the toggle would be off.
MsgBox Control and Insert Toggled OFF
}
return
!Insert:: ; Creates a toggle wrapped in an #IF statement using the Alt and Insert Keys.
ain := !ain ; This is the toggle on/off switch
if (ain) {
Gui, AIN: show, x0 y0, NoActivate ; GUI will appear in the top left corner of the screen.
}else{
GUI, AIN: hide
}
return
#IF (ain) ; This means the toggle is on. Anything pressed while on will work.
1:: MsgBox Pressed 1 Key while !Insert is engaged
2:: MsgBox Pressed 2 Key while !Insert is engaged
3:: MsgBox Pressed 3 Key while !Insert is engaged
#IF ; !ain means the toggle would be off. Anything above will no longer be passed.
InsertKey: ; Press the Insert Key between 1-4 times.
if (this_that = 1) ; Reload/F5
{
SendInput, {F5}
}
else if (This_that = 2) ; pressed twice
{
MsgBox You pressed Insert Twice
}
else if (this_that = 3) ; pressed 3 times
{
MsgBox You pressed Insert 3 times
}
else if (This_That = 4)
{
; Create a toggle within the fourth switch
tog := !tog
if (tog) {
MsgBox This is the first tog(toggle) i.e ON
}else{
MsgBox This is the second !tog(toggle) i.e OFF
this_that := 0 ;return to zero/zero out
} ; tog := !tog end
} ; This_That = 4 end
this_that := 0 ;return to zero/zero out
AltInsertKey: ; Hold down Insert and toggle the ' a ' key up to 4 times.
if (this_that = 1) ; pressd once
{
MsgBox You tapped 'a' Once
}
else if (This_that = 2) ; pressed twice
{
MsgBox You tapped 'a' Twice
}
else if (this_that = 3) ; pressed 3 times
{
MsgBox You tapped 'a' Three times
}
else if (This_That = 4) ; pressed 4 times
{
MsgBox You tapped 'a' Four times
}
this_that := 0 ; return to zero/zero out
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment