I have a Python Script to enable/ disable Airplane mode using input simulation:
- Win + A
- Right Arrow twice
- Space
- Win + A
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.