asweigart / pyautogui

A cross-platform GUI automation Python module for human beings. Used to programmatically control the mouse & keyboard.
BSD 3-Clause "New" or "Revised" License
10.07k stars 1.22k forks source link

typewriter doesnt write "@" character #437

Open levoo181 opened 4 years ago

levoo181 commented 4 years ago

Hello Guys, i try to code a spamming bot for giveaways on instagram, so i have to mark people on a picture. My problem is now: The typewriter from pyautogui prints a "Q" instead of a "@". I have a german layout keyboard and the for the "@" i have to press "alt gr + Q". Maybe you have some solutions.

Thank You

import pyautogui as pya import time i = 1 class Cordinate: chatbox = (1640, 835) sendChat = (1840, 835)

def clickChatbox(): pya.click(Cordinate.chatbox)

def write(): pya.typewrite("@eno181")

def send(): pya.click(Cordinate.sendChat) print("Erfolgreich " + str(i))

while i < 4: i = i + 1 clickChatbox() write() time.sleep(2.0) send()

btw here is the code, im a beginner in programming

elfelround commented 4 years ago

change keyboard to us

bitboy85 commented 4 years ago

Using a different layout for scripting might brake other things, I would suggest using the keyboard modifiers. Sadly i cannot not test because at least the altright modifier isn't working with linuxmint. See https://github.com/asweigart/pyautogui/issues/186 @levoo181 maybe its working in your system so might give it a try.


    pya.keyDown('altright')
    pya.keyDown('q')
    pya.keyUp('q')
    pya.keyUp('altright')