Luca Terzi
Forum Replies Created
-
Luca Terzi
May 17, 2016 at 9:26 am in reply to: Auto Shutdown PC after Encoding Done – Premiere Pro / Media EncoderI did it with Windows 7 and I just tried it with Windows 10 and it works perfectly, how did you save the file? Mine has extension .ps1
There is a function to close skype because I wanted like this in my computer 🙂
Unfortunately I don’t know how to check the upload status.
For sending an email you have to implement this: https://technet.microsoft.com/en-us/library/hh849925.aspx
Last but not least, yes, it checks only the load of the CPU, not AME directly (but with an encoding program such as AME is very effective because the CPU usage drops to very few percentage points after the program finishes to encode a video).
-
Luca Terzi
May 17, 2016 at 7:27 am in reply to: Auto Shutdown PC after Encoding Done – Premiere Pro / Media EncoderHi,
Indeed I completely changed everything time ago, but I forgot to post it here.. But this time I did it with PowerShell ISE.
Now it checks the total load of the CPU and it shuts down the computer if the load is lower than 20% (in this case).
If it detects that the CPU works under the 20% then it checks it again after 60 seconds (in this case), and in case it’s not loaded it shuts down AME and then the computer:# Set the policy otherwise it will not run
Set-ExecutionPolicy Bypass -Scope CurrentUser# Close the programs before to check the use of the CPU
Write-Host “Closing Skype..”
Get-Process -name Skype -erroraction silentlycontinue |
Stop-Process
Write-Host “..DONE”# Minutes to wait before checking the CPU’s load
$time = 60Start-Sleep -s $time
# Load reference percentage:
$ref = 20$cpu = Get-WmiObject -class Win32_Processor |select LoadPercentage
$load = $cpu.LoadPercentagewhile ($load -gt 0)
{
# Get the current load of the cpu
$cpu = Get-WmiObject -class Win32_Processor |select LoadPercentage
$load = $cpu.LoadPercentage
Write-Host “$load %”# If the cpu works under the reference number check if it’s really finished and in case shutdown the pc
if ($load -lt $ref) { Write-Host “Encoding Finished?”
Start-Sleep -s $time
# Get the current load of the cpu, again..
$cpu = Get-WmiObject -class Win32_Processor |select LoadPercentage
$load = $cpu.LoadPercentage
Write-Host “$load %”
if ($load -lt $ref) { Write-Host “Encoding Finished!”
Write-Host “Closing Adobe Media Encoder…”
Get-Process -name ‘Adobe Media Encoder’ -erroraction silentlycontinue |
Stop-Process
Write-Host “..DONE!”
Start-Sleep -s 15
Write-Host “Now sleep..”
Stop-Computer
Start-Sleep -s $time
}
}else { Write-Host “Encoding in Progress!”
Start-Sleep -s $time
}
Clear-Host
} -
Luca Terzi
October 16, 2015 at 12:04 pm in reply to: Auto Shutdown PC after Encoding Done – Premiere Pro / Media EncoderI’ve just wrote something that takes into account the load of the CPU for the specific process.
When AME finishes the CPU of the process “Adobe QT32 Server” used by AME to encode drops to 0.000000, and that’s what I’m looking for.
This code is set to shutdown the pc if the that process reaches that condition, checking every 90s and in case it finds the process at 0.000000 it will wait other 90s to be sure that the encoding is really ended.@echo off
SET “SERVICE=Themes”
SET USAGE=”0.000000″
SET /A “INTERVAL=90”
SET prc=Adobe QT32 Server:LOOP
cls
For /F “tokens=2 delims=,” %%P in (‘typeperf “Process(%prc%)%% Processor time” -sc 1 ^| FINDSTR /rc:”[0-9]”‘) do (
IF %%P EQU %USAGE% (
echo Waiting 60s…
Ping -n %INTERVAL% Localhost >NUL
For /F “skip=1 tokens=2 delims=,” %%P in (‘typeperf “Process(%prc%)%% Processor time” -sc 1 ^| FINDSTR /RC:”[0-9]”‘) do (
IF %%P EQU %USAGE% (
echo Encoding DONE!
echo Closing Adobe Media Encoder…
taskkill /IM “Adobe Media Encoder.exe” >NUL
echo Now Shutdown…
shutdown /s /t 60
))
) ELSE (
echo Encoding in Progress!
)
)
Ping -n %INTERVAL% Localhost >NUL
GOTO :LOOPHope you will find it useful.
LT