Search code examples
pythoninstagrampyautogui

Pyautogui not typing emojis


I want to send a message to a friend at a specific time, i was able to do it but, i need help in making pyautogui type emoji in the instagram web. i've tried pyautogui.hotkey, emoji/emojize, instabot, none of them worked.

import time
from datetime import datetime
import pyautogui
text = "Hello ❤️"
Time = input("Enter your time here:")
while(True):
    present = datetime.now()
    present = present.strftime("%H:%M")
    if (present == Time):
        pyautogui.write(text , interval=0.25)
        time.sleep(5)
        pyautogui.press("enter")
        time.sleep(2)
        break 

So, after trying instabot and etc, i wasn't able to make the code type the heart emoji in instagram web.


Solution

  • You can try using the clipboard module in conjunction with PyAutoGUI to paste the desired emoji into the text field. Here's an updated version of your code that demonstrates this approach:

    import time
    from datetime import datetime
    import pyautogui
    import clipboard
    
    text = "Hello ❤️"
    Time = input("Enter your time here:")
    
    while True:
        present = datetime.now()
        present = present.strftime("%H:%M")
        
        if present == Time:
            clipboard.copy(text)
            pyautogui.hotkey('ctrl', 'v')
            time.sleep(1)
            pyautogui.press("enter")
            break