For some reason I don't understand the below script works as intended, but most of the simple remappings,
like > to ) or : to ; do work only in cmd.exe, and not in any other applications, and I would like those
to work everywhere. (o.O)
It's a modified/customized capslock script from https://github.com/Vonng/Capslock/blob/master/win/CapsLock.ahk for those interested
There are probably some dumb things and errors, would be cool if one can point out those if something does not makes sense.
Thank you in advance,
Best.
P.
Code: Select all
#SingleInstance force
SetTitleMatchMode(2)
PORTABLE := EnvGet("PORTABLE")
APPS := EnvGet("APPS")
USERPROFILE := EnvGet("USERPROFILE")
SetCapsLockState("AlwaysOff")
;______________________________________________________________________
~*CapsLock::
SetCapsLockState("AlwaysOff")
;______________________________________________________________________
CapsLock & h::
if GetKeyState("control") = 0
{
if GetKeyState("alt") = 0
Send("{Left}")
else
Send("+{Left}")
}
else {
if GetKeyState("alt") = 0
Send("^{Left}")
else
Send("+^{Left}")
}
Return
;______________________________________________________________________
CapsLock & j::
if GetKeyState("control") = 0
{
if GetKeyState("alt") = 0{
Send("{Down}")
}
else{
Send("+{Down}")
}
}
else {
if GetKeyState("alt") = 0{
Send("^{Down}")
}
else{
Send("+^{Down}")
}
}
Return
;______________________________________________________________________
CapsLock & k::
if GetKeyState("control") = 0
{
if GetKeyState("alt") = 0{
Send("{Up}")
}
else{
Send("+{Up}")
}
}
else {
if GetKeyState("alt") = 0{
Send("^{Up}")
}
else{
Send("+^{Up}")
}
}
Return
;______________________________________________________________________
CapsLock & l::
if GetKeyState("control") = 0 {
if GetKeyState("alt") = 0{
Send("{Right}")
}
else{
Send("+{Right}")
}
}
else {
if GetKeyState("alt") = 0 {
Send("^{Right}")
}
else{
Send("+^{Right}")
}
}
Return
;______________________________________________________________________
CapsLock & i::
if GetKeyState("control") = 0 {
if GetKeyState("alt") = 0 {
Send("{Home}")
}
else {
Send("+{Home}")
}
}
else {
if GetKeyState("alt") = 0 {
Send("^{Home}")
}
else {
Send("+^{Home}")
}
}
Return
;______________________________________________________________________
CapsLock & o::
if GetKeyState("control") = 0 {
if GetKeyState("alt") = 0 {
Send("{End}")
}
else {
Send("+{End}")
}
}
else {
if GetKeyState("alt") = 0 {
Send("^{End}")
}
else {
Send("+^{End}")
}
}
Return
;______________________________________________________________________
CapsLock & u::
if GetKeyState("control") = 0 {
if GetKeyState("alt") = 0{
Send("{PgUp}")
}
else {
Send("+{PgUp}")
}
}
else {
if GetKeyState("alt") = 0
Send("^{PgUp}")
else
Send("+^{PgUp}")
}
Return
;______________________________________________________________________
CapsLock & p::
if GetKeyState("control") = 0 {
if GetKeyState("alt") = 0
Send("{PgDn}")
else
Send("+{PgDn}")
}
else {
if GetKeyState("alt") = 0
Send("^{PgDn}")
else
Send("+^{PgDn}")
}
Return
;______________________________________________________________________
CapsLock & m::
if GetKeyState("control") = 0 {
if GetKeyState("alt") = 0
Send("{BS}")
else
Send("+{BS}")
}
else {
if GetKeyState("alt") = 0
Send("^{BS}")
else
Send("^{BS}")
}
Return
;______________________________________________________________________
CapsLock & n::
if GetKeyState("control") = 0
{
if GetKeyState("alt") = 0
Send("+{BS}")
else
Send("{BS}")
}
else {
if GetKeyState("alt") = 0
Send("+^{BS}")
else
Send("^{BS}")
}
Return
;______________________________________________________________________________
CapsLock & z::
Send("^z")
Return
;______________________________________________________________________________
CapsLock & x::
Send("^x")
Return
;______________________________________________________________________________
CapsLock & c::
Send("^c")
Return
;______________________________________________________________________________
CapsLock & v::
Send("^v")
Return
;______________________________________________________________________________
CapsLock & a::
Send("^a")
Return
;______________________________________________________________________________
CapsLock & y::
Send("^y")
Return
;______________________________________________________________________________
CapsLock & w::
Send("^{Right}")
Return
;______________________________________________________________________________
CapsLock & b::
Send("^{Left}")
Return
;______________________________________________________________________________
CapsLock & \::
Send("{AppsKey}")
Return
;______________________________________________________________________
CapsLock & F1::
Send("{Volume_Down}")
Return
CapsLock & F2::
Send("{Volume_Up}")
Return
CapsLock & F3::
Send("{Volume_Mute}")
Return
CapsLock & F4::
Send("{Media_Play_Pause}")
Return
CapsLock & F5::
Send("{Media_Next}")
Return
CapsLock & F6::
Send("{Media_Stop}")
Return
;______________________________________________________________________
CapsLock & q::
#if WinActive("ahk_exe cmd.exe")
Send("exit{Enter}")
Return
;______________________________________________________________________
CapsLock & `::
Run('C:\tools\portable\misc\PowerRun.exe C:\Windows\System32\cmd.exe')
Return
;______________________________________________________________________
CapsLock & 1::
Run('C:Windows\System32\cmd.exe')
Return
;______________________________________________________________________
CapsLock & 2::
Run('C:\tools\portable\tcup\tcup.exe')
Return
;______________________________________________________________________
CapsLock & 3::
Run('C:\Windows\System32\cmd.exe /k %TOOLS%\bin\##.cmd')
Return
;______________________________________________________________________
CapsLock & 4::
Run('C:\Windows\System32\cmd.exe /k C:\tools\scoop\apps\far\current\far.exe')
Return
;______________________________________________________________________
CapsLock & 5::
Run('C:\tools\portable\subl\subl.exe')
Return
;______________________________________________________________________
CapsLock & 6::
Run('C:\tools\portable\atom-nightly\atom-nightly.exe')
Return
;______________________________________________________________________
CapsLock & 9::
Run(USERPROFILE . '\AppData\Local\Google\Chrome SxS\Application\chrome.exe')
Return
;______________________________________________________________________
CapsLock & 0::
Run("::{20d04fe0-3aea-1069-a2d8-08002b30309d}")
Return
;______________________________________________________________________
;CapsLock & /::
; Send("^e")
; Send("c")
; Return
;______________________________________________________________________
;CapsLock & \::
; Send("^e")
; Send("u")
; Return
;______________________________________________________________________
;Tap ALT+Q twice to close a window, so you dont have to add to rsi with fucktarded windows shortcuts
~!q::
if (A_PriorHotkey != "~!q" or A_TimeSincePriorHotkey > 300) {
Send("!q")
}
else {
Send("!{F4}")
}
Return
;______________________________________________________________________
; ` to tilde
$`::~
;______________________________________________________________________
; `+shift to `
$+~::`
;______________________________________________________________________
; semicolon to colon
`;:::
;______________________________________________________________________
; backslash to pipe
\::|
;______________________________________________________________________
; shift+semicolon to semicolon
+;::`;
;______________________________________________________________________
; quote to duouble-quote
'::"
;______________________________________________________________________
; shift+quote to quote
+"::'
;______________________________________________________________________
; shift+backslash to backslash
+\::\
;______________________________________________________________________
; shift+coma to leftparen
+,::(
;______________________________________________________________________
; shift+point to rightparen
+.::)
;______________________________________________________________________
; shift+9 to less
+9::<
;______________________________________________________________________
; shift+0 to greater
+0::>
;______________________________________________________________________
; win+[ to parenleft
#[::(
;______________________________________________________________________
; win+] to parenright
#]::)
;______________________________________________________________________
!,::<
;______________________________________________________________________
!.::>
;______________________________________________________________________
CapsLock & Shift::
Send("{ShiftDown}{CapsLock Down}{CapsLock Up}{Shift Up}")
Return
;______________________________________________________________________
CapsLock & .::
Send("{Del}")
Return
;______________________________________________________________________
CapsLock & ,::
Send("^{Del}")
Return
;______________________________________________________________________
AppsKey Up::
ToolTip
Return
;______________________________________________________________________
~AppsKey & RCtrl::
Send("!{Tab}")
Return
;______________________________________________________________________
~AppsKey & RAlt::
Send("+!{Tab}")
Return
;______________________________________________________________________
;Send("{CtrlDown}{Tab}{CtrlUp}")
;Send("{CtrlDown}{ShiftDown}{Tab}{ShiftUp}{CtrlUp}")
If WinExist("ahk_class Chrome") {
#if WinActive("Chrome")
+WheelUp::
Send("^{PgUp}")
+WheelDown::
Send("^{PgDn}")
CapsLock & ]::
Send("^{PgDn}")
Return
CapsLock & [::
Send("^{PgUp}")
Return
![::
Send("{Browser_Back}")
Return
!]::
Send("{Browser_Forward}")
Return
}
;______________________________________________________________________
; RWin & d::
; if GetKeyState("control") = 0 and GetKeyState("alt") = 0 {
; ComObjCreate("Shell.Application").ToggleDesktop()
; } else {
; Send("#{d}")
; }
; Return
;______________________________________________________________________
CapsLock & d::
ComObjCreate("Shell.Application").ToggleDesktop()
Return
;