I am using pyautogui.typewrite('text',interval=0.02)
for printing but the text comes out in uppercase if capslock is on. Is there any way to get lowercase characters even if capslock is on?
In order to make sure you always write lowecase text, you must do the following:
In windows, this snipped will do the job:
import ctypes
import pyautogui as pya
def is_capslock_on():
return True if ctypes.WinDLL("User32.dll").GetKeyState(0x14) else False
def turn_capslock_on():
if not is_capslock_on():
pya.press("capslock")
def turn_capslock_off():
if is_capslock_on():
pya.press("capslock")
if __name__ == "__main__":
import time
turn_capslock_off()
time.sleep(1)
the_text = "THIS TEXT will always be writen in LOWERCASE"
pya.typewrite(the_text.lower(), interval=0.02)