Skip to content

Commit

Permalink
Try to dismiss any previous error messages in Aida64 on program start.
Browse files Browse the repository at this point in the history
  • Loading branch information
sp00n committed Mar 24, 2021
1 parent 5cf2b7f commit 9039b37
Showing 1 changed file with 40 additions and 3 deletions.
43 changes: 40 additions & 3 deletions script-corecycler.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -1314,6 +1314,13 @@ function Send-CommandToAida64 {
[String] $command
)

# No windowProcessMainWindowHandler? No good!
if (!$windowProcessMainWindowHandler -or [String]::IsNullOrEmpty($windowProcessMainWindowHandler) -or [String]::IsNullOrWhiteSpace($windowProcessMainWindowHandler)) {
Write-Verbose('Could not get the windowProcessMainWindowHandler!')
return
}


Write-Verbose('Trying to send the "' + $command + '" command to Aida64')

if ($command.ToLower() -eq 'start') {
Expand Down Expand Up @@ -2164,7 +2171,7 @@ function Start-Aida64 {
:startProcessLoop for ($i = 1; $i -le 3; $i++) {
if ($startOnlyStressTest) {
# Send a keyboard command to the Aida64 window to start the stress test process
Send-CommandToAida64 'Start'
Send-CommandToAida64 'start'
}

# Repeat the check every 500ms
Expand Down Expand Up @@ -2285,7 +2292,7 @@ function Close-Aida64 {
# Repeat the whole process up to 3 times, i.e. 3x10x0,5 = 15 seconds total runtime before it errors out
:stopProcessLoop for ($i = 1; $i -le 3; $i++) {
# Send a keyboard command to the Aida64 window to stop the stress test process
Send-CommandToAida64 'Stop'
Send-CommandToAida64 'stop'

# Repeat the check every 500ms
for ($j = 0; $j -lt 10; $j++) {
Expand Down Expand Up @@ -2375,8 +2382,8 @@ function Close-Aida64 {
}
}


# Aida64 seems to create a "sst-is-running.txt" file in the %TEMP% directory
# Is this something we can utilize?
}


Expand Down Expand Up @@ -3303,6 +3310,36 @@ catch {
}


# If Aida64 was started, try to clear any error messages from previous runs
if ($settings.General.stressTestProgram -eq 'aida64') {
Write-Verbose('Trying to clear Aida64 error messages from previous runs')

$initFunctions = [scriptblock]::Create(@"
function Send-CommandToAida64 { ${function:Send-CommandToAida64} }
function Write-Verbose { ${function:Write-Verbose} }
"@)

$clearAidaMessages = Start-Job -ScriptBlock {
param(
$SendMessageDefinition,
$windowProcessMainWindowHandler,
$settings,
$logFileFullPath
)

$SendMessage = Add-Type -TypeDefinition $SendMessageDefinition -PassThru

Start-Sleep 3

# Send the command a couple of times
# Unfortunately we cannot get any Write-Verbose without adding a Wait-Job
for ($i = 0; $i -lt 3; $i++) {
Send-CommandToAida64 'dismiss'
Start-Sleep 500
}
} -InitializationScript $initFunctions -ArgumentList $SendMessageDefinition, $windowProcessMainWindowHandler, $settings, $logFileFullPath
}

# Start with the CPU test
# Repeat the whole check $settings.General.maxIterations times
for ($iteration = 1; $iteration -le $settings.General.maxIterations; $iteration++) {
Expand Down

0 comments on commit 9039b37

Please sign in to comment.