Handle process killing using PowerShell

This commit is contained in:
Manuel Thalmann 2023-07-17 02:45:34 +02:00
parent a9bf0df743
commit 5695406f85
3 changed files with 11 additions and 4 deletions

View file

@ -3,14 +3,17 @@ InstallGameHub()
SetTitleMatchMode, RegEx
windowTitle := "^Tobii Game Hub$"
Run, "setup.exe",,,pid
Run, "setup.exe"
WinWait % windowTitle,, 60
WinActivate % windowTitle
MouseClick, Left, 485, 365
MouseClick, Left, 600, 455
MouseClick, Left, 533, 623
MouseClick, Left, 936, 662
Process, Close, %pid%
Sleep, 10 * 1000
WinActivate % windowTitle
WinGet, pid, PID
Run, pwsh -c "Stop-Process -Force %pid%"
}
InstallGameHub()

View file

@ -3,7 +3,7 @@ InstallGhost()
SetTitleMatchMode, RegEx
windowTitle := "^Tobii Ghost$"
Run, "setup.exe",,,pid
Run, "setup.exe"
WinWait % windowTitle,, 60
WinActivate % windowTitle
MouseClick, Left, 44, 694
@ -13,7 +13,9 @@ InstallGhost()
MouseClick, Left, 563, 397
MouseClick, Left, 650, 497
Sleep, 10 * 1000
Process, Close, %pid%
WinActivate % windowTitle
WinGet, pid, PID
Run, pwsh -c "Stop-Process -Force %pid%"
}
InstallGhost()

View file

@ -18,6 +18,7 @@ Invoke-WebRequest "https://files.update.oem.tobii.com/Ghost/TobiiGhost.1.14.1-Se
Write-Information "Running Tobii Ghost installer";
Start-Process -Wait -FilePath "$PSScriptRoot/Ghost.ahk";
Stop-Process -Force "TobiiGhost.exe";
Write-Host "Installing Tobii Game Hub";
Write-Information "Downloading Tobii Game Hub installer";
@ -25,6 +26,7 @@ Invoke-WebRequest "https://files.update.oem.tobii.com/GameHub/TobiiGameHub.3.0.1
Write-Information "Running Tobii Game Hub installer";
Start-Process -Wait -FilePath "$PSScriptRoot/GameHub.ahk";
Stop-Process -Force "TobiiGameHub.exe";
Pop-Location;
Remove-Item -Recurse $tempDir;