Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Find windows and send keys?
#1
Question 
Hello,

On Windows at least, I wonder if Python can 1) find a window, and 2) simulate typing keys.

Currently, I run an AutoIt just for this, so it'd be nice if I can remove that dependency.

Thank you.

#Python
result = subprocess.run(AUTOIT, capture_output=True, text=True)

#AutoIt
;chrome://extensions/shortcuts
Opt("WinTitleMatchMode", 2) ;1=start (default), 2=subStr, 3=exact, 4=advanced (deprecated), -1 to -4=Nocase
_WinWaitActivate("[TITLE: - Google Chrome;CLASS:Chrome_WidgetWin_1]","")
;click on extension and fill: Assigned CTRL+SHIFT+P to extension
Send("{CTRLDOWN}{SHIFTDOWN}p{CTRLUP}{SHIFTUP}")
Sleep(500)
Send("{TAB}" & $sTitle & "{TAB}" & $sAuthor & "{TAB}{ENTER}")
--
Edit: There appears to be at least two modules to automate Windows apps: pywinauto and pyautogui
Reply
#2
This URL lists keyboard simulator packages
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How to find out from outside Python (in Windows) the current version of Python? pstein 5 4,540 Jun-28-2024, 07:02 AM
Last Post: Samuel34
  Send keys to DirectX Orion 0 2,952 Jan-08-2021, 01:14 PM
Last Post: Orion
  Need to access Windows Machine or Personal Certificate Store and send to web app seswho 0 3,348 Sep-14-2020, 04:57 PM
Last Post: seswho
  How do I find the 64 bit download for Windows? Blackwood 1 2,505 Aug-18-2020, 11:19 AM
Last Post: snippsat
  [split] Windows can't find installed packages deep_logic 11 9,252 Nov-26-2019, 10:39 PM
Last Post: snippsat
  How to use subprocess send commands to windows shell hlhp 3 8,168 Nov-26-2019, 04:40 AM
Last Post: LeanbridgeTech
  Windows can't find installed packages TSheets13 7 10,940 Oct-02-2019, 06:12 PM
Last Post: snippsat
  Windows cannot find "wish.exe" - error while trying to run PAGE Nwb 0 8,598 Jun-11-2018, 12:08 PM
Last Post: Nwb
  Send Keys and Variables, HELP! jray204 0 3,325 Mar-11-2018, 10:44 AM
Last Post: jray204
  Email - Send email using Windows Live Mail cyberzen 2 7,868 Apr-13-2017, 03:14 AM
Last Post: cyberzen

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020