Skip to content

Instantly share code, notes, and snippets.

@andymasteroffish
Created February 16, 2025 22:23
Show Gist options
  • Save andymasteroffish/41a02deb5d2924dadb4e3c005e564b8f to your computer and use it in GitHub Desktop.
Save andymasteroffish/41a02deb5d2924dadb4e3c005e564b8f to your computer and use it in GitHub Desktop.
AutHotkey script for launching aracde games
#Persistent
; Relaunch Game on Crash or Close
; also hides the mouse
; by Andy Wallace (cobbled together from other scripts)
;
; Make sure to specify the window_title and program_path
; Note: Press Win-Z while this is running to kill it
;
; If you need to hide the mouse, you can uncomment HideCursor()
SetTitleMatchMode, 2 ; Allow partial matches on window titles
window_title := "ice_cold_wall" ; Window title to check
program_path := "C:\Users\salmon\Desktop\salmon_roll_2018-01-02_normal\salmon_roll_2018-01-02_normal.exe" ; Replace with the full path to your program
check_interval := 10000 ; Check every X milliseconds
; UNCOMMENT TO HIDE THE CURSOR
; HideCursor()
; Monitor the program
SetTimer, CheckProgram, %check_interval%
; Exit the script when Win+Z is pressed
#z::
ShowCursor() ; Restore the cursor
ExitApp
CheckProgram:
; Check if the window exists
IfWinNotExist, %window_title%
{
; Launch the program if the window is not found
Run, %program_path%,,
Sleep 5000 ; Wait 5 seconds
Send {Enter} ; Press Enter
}
return
; Function to hide the cursor
HideCursor() {
SystemCursor("Hide")
}
; Function to show the cursor
ShowCursor() {
SystemCursor("Show")
}
; Utility function to manipulate the system cursor
SystemCursor(action) {
static hCursor
if (action = "Hide") {
hCursor := DllCall("LoadCursor", "Ptr", 0, "Int", 32512, "Ptr") ; IDC_ARROW
DllCall("SetSystemCursor", "Ptr", hCursor, "Int", 32512)
DllCall("SetSystemCursor", "Ptr", hCursor, "Int", 32513) ; IDC_IBEAM
DllCall("SetSystemCursor", "Ptr", hCursor, "Int", 32514) ; IDC_WAIT
DllCall("SetSystemCursor", "Ptr", hCursor, "Int", 32515) ; IDC_CROSS
DllCall("SetSystemCursor", "Ptr", hCursor, "Int", 32516) ; IDC_UPARROW
DllCall("SetSystemCursor", "Ptr", hCursor, "Int", 32517) ; IDC_SIZE
} else if (action = "Show") {
DllCall("SystemParametersInfo", "UInt", 0x57, "UInt", 1, "UInt", 0, "UInt", 0)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment