Autotest: load through the Spielen screen

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
khallaandClaude Opus 5.5 committed 2026-10-25 18:24:29 +01:00
1 parent 401e20b1f2
commit 10c97f75e1
3 files changed
+19 -13

No files matched your search

+8 -1
View File
@@ -5,6 +5,7 @@
# Click-At 1720 779 # screen pixels (left click)
# Press-Key 0x1B # virtual key (ESC)
# Hold-Key 0x27 -Ms 1500 # hold a key (right arrow)
# Scroll-Wheel -3 # mouse wheel, 3 notches down
# Save-Screen screenshots\x.png # primary monitor area of the game
# Stop-Sacred $game # only the given process
#
@@ -25,7 +26,7 @@ $script:Root = Split-Path $PSScriptRoot
# synthetic Alt press lifts that restriction for SetForegroundWindow.
function Focus-Sacred($Game) {
$Game.Refresh()
if ($Game.MainWindowHandle -eq [IntPtr]::Zero) { return $false }
if (-not $Game.MainWindowHandle -or $Game.MainWindowHandle -eq [IntPtr]::Zero) { return $false }
[SacredRe.Input]::keybd_event(0x12, 0, 0, [UIntPtr]::Zero)
[SacredRe.Input]::keybd_event(0x12, 0, 2, [UIntPtr]::Zero)
[SacredRe.Input]::SetForegroundWindow($Game.MainWindowHandle)
@@ -116,3 +117,9 @@ function Hold-Key([byte]$VirtualKey, [int]$Ms = 1500, [int]$AfterMs = 500) {
[SacredRe.Input]::keybd_event($VirtualKey, 0, 2, [UIntPtr]::Zero)
Start-Sleep -Milliseconds $AfterMs
}
# Turns the mouse wheel by $Notches (negative: towards the user, "down").
function Scroll-Wheel([int]$Notches, [int]$AfterMs = 500) {
[SacredRe.Input]::mouse_event(0x0800, 0, 0, [BitConverter]::ToUInt32([BitConverter]::GetBytes([int]($Notches * 120)), 0), [UIntPtr]::Zero)
Start-Sleep -Milliseconds $AfterMs
}