how to write a message in a Minecraft chat in minimized mode, Python

How to write a message in a Minecraft chat in minimized mode, Python

It is necessary that on the server, on behalf of the player, a certain line is written to the chat.

I used to write using keyboard , but this is wildly inconvenient, because the chat opens and due to the fact that the character is in motion, it is written incorrectly, for example, wwwPrivet world!

Author: itsfrit, 2020-07-21

1 answers

Try using PyAutoGUI - https://pypi.org/project/PyAutoGUI/

import pyautogui
pyautogui.write('Hello world!', interval=0.25)
pyautogui.write(['left', 'left', 'left', 'left', 'left', 'left'])

If you want to open a chat, use the mouse (find the coordinates of the chat on the screen):

pyautogui.moveTo(100, 150) # Передвигает мышку в координаты x, y - 100, 150.
pyautogui.click() # Нажимает на левую кнопку мыши в текущих координатах.
pyautogui.click(200, 220) # Нажимает на левую кнопку мыши в координатах x, y - 200, 220.

If you are already in the program try opening the chat using the keyboard:

pyautogui.press('enter') # Симулирует физическое нажатие клавиши Enter
 -1
Author: Alex Zab, 2020-07-22 12:16:37