I have a Python Script to enable/ disable Airplane mode
using input simulation which works fine:
- Win + A : To Open Action Center
- Right Arrow (twice) : Navigate to Airplane toggle
- Space : To Press OK
- Win + A : To Leave Action Center
import pyautogui
pyautogui.hotkey('win', 'a')
pyautogui.press('right', presses=2)
pyautogui.press('space')
pyautogui.hotkey('win', 'a')
I tried doing that using PowerShell:
$shell = New-Object -ComObject WScript.Shell
$shell.SendKeys("^{ESC}")
$shell.SendKeys("{RIGHT}")
$shell.SendKeys("{RIGHT}")
$shell.SendKeys(" ")
$shell.SendKeys("^{ESC}")
However, it doesn't seem to work.
Because $shell.SendKeys("^{ESC}")
open Start Menu
, not Action Center
what I want.
What is the correct command for that? Win + A