I'm looking to automate rotation between multiple applications, specifically Internet Explorer windows that have been opened in kiosk mode. This is for an overhead display.
I've tried the suggestions in the article (how to perform a hold ALT+TAB sendkey event in C#) but it does not work for me. I get the following errors.
Exception calling "SendWait" with "1" argument(s): "Specified repeat count is not valid."
At line:1 char:35
+ [Windows.Forms.Sendkeys]::SendWait <<<< ("%{Alt Up}")
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : DotNetMethodException
With manual testing, an alt+tab and even alt+tab+tab will only toggle between the first two/three windows and I currently have 6 with the possibility for more in the future. It looks like I might be able to try pulling up the window by title maybe but that seems unreliable.
#ADD external assemblies here
add-type -AssemblyName microsoft.VisualBasic
add-type -AssemblyName System.Windows.Forms
#Sets interval before changing screens
Start-sleep -Seconds 2
[System.Windows.Forms.SendKeys]::SendWait("%{TAB}%{tab}")
[System.Windows.Forms.SendKeys]::SendWait("%{TAB}%{tab}")
I've also tried this:
[System.Windows.Forms.SendKeys]::SendWait("%{alt down}")
[System.Windows.Forms.SendKeys]::SendWait("%{tab}")
I figured it out.
Use SendWait("%{TAB}")
In powershell the only way to use the alt key seems to be with the % symbol.
So I think I figured it out. You don't want to do an ALT + TAB for the toggle since this is a Z-Based swap. This means it only toggles between the first and second applications running. However, if you do Alt+Shift+ESC, this will tell the system to pull the last item in the list and bring it forward
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With