0
votes

I want to use a simple script to backup the existing quicksave file before it's being overwritten by the game. Essentially, what I want is a new save file each time I hit F5:

F5::
OldQuickSave := "c:\Users\Me\Documents\My Games\Skyrim\Saves\quicksave.ess"
FileGetTime, qstime, %OldQuickSave%
BackupFileName := "c:\Users\Me\Documents\My Games\Skyrim\Saves\OldQuicksave" . qstime . ".ess"
FileCopy, %OldQuickSave%, %BackupFileName%
SendPlay {F5}
return

Outside the game it works, but while the game runs the command does not reach AutoHotkey. The game saves, as it should, but the script is not launched. It's as if I never pressed the key. My guess is that Skyrim uses DirectInput to read the keyboard, it consumes the event and doesn't send it further. Is there any workaround? Or any other solution to create a new savegame file for each quicksave?

1
Did you try GetKeyState?user1944441
@Armin Great tip! I didn't end up using GetKeyState but rather a combination of KeyWait, Sleep and a GoTo at the end. It does exactly what I wanted, thanks!Ciri

1 Answers

0
votes

I found a workaround using the following script:

Label:
KeyWait, F5, D
OldQuickSave := "c:\Users\Me\Documents\My Games\Skyrim\Saves\quicksave.ess"
FileGetTime, qstime, %OldQuickSave%
BackupFileName := "c:\Users\Me\Documents\My Games\Skyrim\Saves\OldQuicksave" . qstime . ".ess"
FileCopy, %OldQuickSave%, %BackupFileName%
Sleep, 5000
Goto, Label

The Sleep is there to prevent multiple executions in case the key was pressed for a longer period of time. I'm still curios what went wrong the first time though.