Python Forum
Python win32api keybd_event: How do I input a string of characters?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Python win32api keybd_event: How do I input a string of characters?
#1
Hi,

I used the below to get the Window Handle of an app and bring it to be the focus. I want to type in a string of characters into the app. But using win32api.keybd_event, I am able to type in only single characters? Is there a way to type in a string of characters?

Eg, "I am happy"

Thank you
import win32gui
import win32api
import win32con

hld = win32gui.FindWindow (None, "UNTITLED") # Returns the handle of the window titled UNTITLED

if hld>0:

    win32gui.SetForegroundWindow(hld)
    win32api.keybd_event(0x46, 0, ) # F
Reply


Messages In This Thread
Python win32api keybd_event: How do I input a string of characters? - by JaneTan - Oct-18-2020, 08:53 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Using string input for boolean tronic72 3 635 Nov-01-2023, 07:48 AM
Last Post: Gribouillis
  doing string split with 2 or more split characters Skaperen 22 2,317 Aug-13-2023, 01:57 AM
Last Post: Skaperen
Sad How to split a String from Text Input into 40 char chunks? lastyle 7 1,054 Aug-01-2023, 09:36 AM
Last Post: Pedroski55
  How do I check if the first X characters of a string are numbers? FirstBornAlbratross 6 1,429 Apr-12-2023, 10:39 AM
Last Post: jefsummers
Big Grin General programming question (input string)[ jamie_01 2 1,569 Jan-08-2022, 12:59 AM
Last Post: BashBedlam
Question [SOLVED] Delete specific characters from string lines EnfantNicolas 4 2,143 Oct-21-2021, 11:28 AM
Last Post: EnfantNicolas
  Creating new column with a input string drunkenneo 2 2,194 Apr-14-2021, 08:10 AM
Last Post: drunkenneo
  Extract continuous numeric characters from a string in Python Robotguy 2 2,581 Jan-16-2021, 12:44 AM
Last Post: snippsat
  How to get first two characters in a string scratchmyhead 2 2,037 May-19-2020, 11:00 AM
Last Post: scratchmyhead
  Remove escape characters / Unicode characters from string DreamingInsanity 5 13,420 May-15-2020, 01:37 PM
Last Post: snippsat

Forum Jump:

User Panel Messages

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