App Rotator
Jump to navigation
Jump to search
App Rotator allows for automatically rotating between apps, making them visible when needed.
It
$app=@{}
$timeline=@()
$wshell = New-Object -ComObject WScript.Shell
function App($name, $run, $keys)
{
$global:app += @{$name = @{ID = (Start-Process $run -PassThru).Id}}
$wshell.SendKeys($keys)
}
function Timeline($apps, $seconds)
{
$global:timeline += @{Apps = $apps; Seconds = $seconds}
}
function Rotate
{
for($index = 0; $index -lt $global:timeline.Count; $index++)
{
foreach($app in $global:timeline[$index].Apps)
{
$wshell.AppActivate($global:app[$app].ID) # prints true/false?
}
Start-Sleep -Seconds $global:timeline[$index].Seconds
}
Rotate
}
App "app1" "notepad.exe" App "app2" "mspaint.exe" App "app3" "cmd.exe" Timeline "app1","app2" 10 Timeline "app3" 5 Rotate