Files
AHK-Scripts/DeadCells Auto Save.ahk
MohandL3G e5d6f480da Add AutoHotkey utility scripts
Adds four AutoHotkey scripts: DeadCells Auto Save (AHK v2) — F6 runs an elevated robocopy backup of the Steam userdata save folder to a Desktop "Dead Cells Backup" with timestamped folders and retention keeping the 7 newest backups; shows success/failure. EldenRingNIGHTREIGN fix — when nightreign.exe is active remaps Tab to sc032 (M) while allowing Shift+Tab and Alt+Tab to pass through. Idle Auto Playing — F8 starts an infinite loop sending 'w' and 'd' with 100ms delay; F9 hotkey is present but does not currently stop the loop. SmallKeyboardFix — maps Ctrl+Up and Ctrl+Shift+Up to vkBF (unshifted and shifted).
2026-03-03 16:00:42 +02:00

57 lines
1.8 KiB
AutoHotkey

#Requires AutoHotkey v2.0
; --- Admin Elevation Logic ---
if !A_IsAdmin {
try
{
Run('*RunAs "' A_AhkPath '" "' A_ScriptFullPath '"')
}
ExitApp
}
; -----------------------------
F6::
{
source := "C:\Program Files (x86)\Steam\userdata\462943940\588650\remote"
userProfile := EnvGet("USERPROFILE")
baseDest := userProfile "\Desktop\Dead Cells Backup"
; Create timestamp
now := A_Now
ts := SubStr(now, 1, 4) "-" SubStr(now, 5, 2) "-" SubStr(now, 7, 2) "_" SubStr(now, 9, 2) "-" SubStr(now, 11, 2) "-" SubStr(
now, 13, 2)
dest := baseDest "\Save Backup [" ts "]"
; Ensure directories exist
DirCreate(baseDest)
; Run Robocopy
cmd := 'robocopy "' source '" "' dest '" /E /COPYALL /R:2 /W:2'
rc := RunWait(cmd, , "Hide")
if (rc <= 7) {
; --- Cleanup Logic Starts Here ---
backups := []
; 1. Loop through all folders starting with "Save Backup ["
loop files, baseDest "\Save Backup [*", "D" {
backups.Push(A_LoopFilePath)
}
; 2. If we have more than 7, delete the oldest ones
; Note: Because the names are timestamped, they sort naturally by time.
if (backups.Length > 7) {
; The folders are pushed in chronological order by the OS.
; We delete from the start of the array until only 7 remain.
while (backups.Length > 7) {
oldestBackup := backups.RemoveAt(1)
DirDelete(oldestBackup, 1) ; 1 = recurse (delete contents)
}
}
; --- Cleanup Logic Ends Here ---
MsgBox "Backup completed successfully.`nOld backups cleaned. Total kept: 7`n`nNewest: " dest
}
else {
MsgBox "Backup may have failed.`nRobocopy exit code: " rc
}
}