D
Deleted User
Guest
OP
If you've never used autohotkey and need any help getting started I'll be happy to help.
Internet autoreconnect
If your internet randomly disconnects and isn't a major outage by your ISP, this will force it to reconnect within a few seconds. (I was just having this happen to me for months with 5G internet) Maybe goes without saying but replace the words your internet connection name goes here with your internet connection name.
Disable Caps Lock, Number Lock can't be disabled
Does anyone actually want Caps Lock on or Number keys off? I can't remember ever wanting either in my life.
Super Escape key to exit PC games
Since some PC games use Alt+F4 this combines Escape with Alt+F4 so you can escape most PC games with Esc. There are however still some stubborn ones that don't let you remap keys at all but this will work with most.
Make a hotkey to launch any app
It's best to use Ctrl or alt obviously since you will usually want your keys to just type the letters you want it to type. Here's an example for ctrl or alt.
Ctrl+whatever key (example here is ctrl+y, can be numbers or F keys too or home or whatever)
Alt+whatever key (example here is alt+7)
Delete key = Ctrl + Delete
This just makes it easier to delete something without having to hold ctrl with delete because I know with me most of the time items would end up in the recycling bin when I really want to get rid of them all together. You will still get confirmation do you want to delete item so no fear of using this unintentionally.
Restart Windows with a keyboard key (example home key)
I make two different scripts for this. The first one you can just click on the ahk and it will restart windows, I call it restart windows.exe (right click the ahk after you're done and you can compile it to an exe)
The second one will make it a keyboard key, I use ctrl+home.
Just do the same thing if you want to shut down just a slightly different script. Obviously don't use the same key as restart though.
These are just a few I use I use more than these. I have my laptop hooked up to my TV and I have a script to change screens from laptop to computer or vice versa or dual screen, and i have one to change audio to the computer or laptop, I have an app that can turn off my Xbox 360 controller and I turned it into ctrl+0 to do that. There's endless things you can do on autohotkey, even assign key to open gbatemp. Just about anything Microsoft was too lazy to add to Windows. You can add them to your start menu for easier access if it's a script you just want to click on and not use a key or for example the first script listed about internet reconnecting you would want to add that to startup so that it starts with windows and is always making sure your internet is connected. You could make loops to check a million other things too.
I started using this Saturn emulator called SSF and you had to mount the ISO using a virtual drive then launch the emulator and I never cared for having to do that every time I want to play a game, that's when I discovered autohotkey as it can mount the image and starts the emulator, and can unmount the ISO too if you want all with double click of a mouse or hotkey. It can be a lot of work getting these scripts to work sometimes, but when they work properly it makes your computer work smoother so you can be more lazy. I am lazy and want things to be easier even if I have to work hard to make it happen.
Internet autoreconnect
If your internet randomly disconnects and isn't a major outage by your ISP, this will force it to reconnect within a few seconds. (I was just having this happen to me for months with 5G internet) Maybe goes without saying but replace the words your internet connection name goes here with your internet connection name.
#Persistent
#SingleInstance Force
SetTimer, CheckOnlineStatus,% 3*1000 ; for testing check the 'online' status every 5sec
CheckOnlineStatus:
(Ping() = "offline") ? Network("wlan") : Return ; if ping()ing results in being 'offline', reconnect the wifi connection, else let's wait another 15secs
Return
Ping(host="8.8.8.8") { ; pinging/requesting a response from the Google server
colPings := ComObjGet("winmgmts:").ExecQuery("Select * From Win32_PingStatus where Address = '" host "'")._NewEnum
While colPings[objStatus]
Return oS := (objStatus.StatusCode = "") || (objStatus.StatusCode != 0) ? "offline" : "online"
}
Network(type){
If (A_IPAddress1 = "127.0.0.1") ; detecting the 'local host' IP from your first network device, so let's ...
RunWait, % comspec " /c netsh " type " connect name=your internet connection name goes here",, hide ; connect to the router (and let's start thinking about how to provide the SSID and the pw if requested!)
Else
RunWait, % comspec " /c netsh " type " disconnect",,hide ; disconnect a current wifi connection
}
!x::Network("wlan")
#SingleInstance Force
SetTimer, CheckOnlineStatus,% 3*1000 ; for testing check the 'online' status every 5sec
CheckOnlineStatus:
(Ping() = "offline") ? Network("wlan") : Return ; if ping()ing results in being 'offline', reconnect the wifi connection, else let's wait another 15secs
Return
Ping(host="8.8.8.8") { ; pinging/requesting a response from the Google server
colPings := ComObjGet("winmgmts:").ExecQuery("Select * From Win32_PingStatus where Address = '" host "'")._NewEnum
While colPings[objStatus]
Return oS := (objStatus.StatusCode = "") || (objStatus.StatusCode != 0) ? "offline" : "online"
}
Network(type){
If (A_IPAddress1 = "127.0.0.1") ; detecting the 'local host' IP from your first network device, so let's ...
RunWait, % comspec " /c netsh " type " connect name=your internet connection name goes here",, hide ; connect to the router (and let's start thinking about how to provide the SSID and the pw if requested!)
Else
RunWait, % comspec " /c netsh " type " disconnect",,hide ; disconnect a current wifi connection
}
!x::Network("wlan")
Disable Caps Lock, Number Lock can't be disabled
Does anyone actually want Caps Lock on or Number keys off? I can't remember ever wanting either in my life.
; Set Lock keys permanently
SetNumlockState, AlwaysOn
SetCapsLockState, AlwaysOff
SetScrollLockState, AlwaysOff
return
SetNumlockState, AlwaysOn
SetCapsLockState, AlwaysOff
SetScrollLockState, AlwaysOff
return
Super Escape key to exit PC games
Since some PC games use Alt+F4 this combines Escape with Alt+F4 so you can escape most PC games with Esc. There are however still some stubborn ones that don't let you remap keys at all but this will work with most.
$ESC::Send !{F4}
return
return
Make a hotkey to launch any app
It's best to use Ctrl or alt obviously since you will usually want your keys to just type the letters you want it to type. Here's an example for ctrl or alt.
Ctrl+whatever key (example here is ctrl+y, can be numbers or F keys too or home or whatever)
HotKey, ^y, LaunchUpdate
return
LaunchUpdate:
Run, "full path to the application you want to run"
;...any code you need...
return
return
LaunchUpdate:
Run, "full path to the application you want to run"
;...any code you need...
return
HotKey, !7, LaunchUpdate
return
LaunchUpdate:
Run, "full path to the application you want to run"
;...any code you need...
return
return
LaunchUpdate:
Run, "full path to the application you want to run"
;...any code you need...
return
Delete key = Ctrl + Delete
This just makes it easier to delete something without having to hold ctrl with delete because I know with me most of the time items would end up in the recycling bin when I really want to get rid of them all together. You will still get confirmation do you want to delete item so no fear of using this unintentionally.
Send {LShift down};
Send {DEL};
Send {LShift up};
Send {DEL};
Send {LShift up};
Restart Windows with a keyboard key (example home key)
I make two different scripts for this. The first one you can just click on the ahk and it will restart windows, I call it restart windows.exe (right click the ahk after you're done and you can compile it to an exe)
shutdown, 2
The second one will make it a keyboard key, I use ctrl+home.
HotKey, ^Home, LaunchUpdate
return
LaunchUpdate:
Run, "Restart Windows.exe"
;...any code you need...
return
return
LaunchUpdate:
Run, "Restart Windows.exe"
;...any code you need...
return
Just do the same thing if you want to shut down just a slightly different script. Obviously don't use the same key as restart though.
run shutdown /s /f /t 0
These are just a few I use I use more than these. I have my laptop hooked up to my TV and I have a script to change screens from laptop to computer or vice versa or dual screen, and i have one to change audio to the computer or laptop, I have an app that can turn off my Xbox 360 controller and I turned it into ctrl+0 to do that. There's endless things you can do on autohotkey, even assign key to open gbatemp. Just about anything Microsoft was too lazy to add to Windows. You can add them to your start menu for easier access if it's a script you just want to click on and not use a key or for example the first script listed about internet reconnecting you would want to add that to startup so that it starts with windows and is always making sure your internet is connected. You could make loops to check a million other things too.
I started using this Saturn emulator called SSF and you had to mount the ISO using a virtual drive then launch the emulator and I never cared for having to do that every time I want to play a game, that's when I discovered autohotkey as it can mount the image and starts the emulator, and can unmount the ISO too if you want all with double click of a mouse or hotkey. It can be a lot of work getting these scripts to work sometimes, but when they work properly it makes your computer work smoother so you can be more lazy. I am lazy and want things to be easier even if I have to work hard to make it happen.
Last edited by ,