Skip to content

Instantly share code, notes, and snippets.

@pmnlla
Last active December 13, 2020 19:39
Show Gist options
  • Save pmnlla/bc233e4ea225072d7c0f1447bd3b9b7e to your computer and use it in GitHub Desktop.
Save pmnlla/bc233e4ea225072d7c0f1447bd3b9b7e to your computer and use it in GitHub Desktop.
Share the shrek script with your friends
import pyautogui as auto
src = open("script.txt", "r")
auto.click(1700, 100);
for x in src:
print(x)
auto.write(x)
# To those who came from TikTok: I can't help you if you just say "it doesn't post the shrek script".
# Please make a video showing what happens in your messaging app and the console output.
# Also, make sure you followed the instructions correctly. They are below.
#
# You need to have pyautogui installed via pip,
# along with the shrek script saved as "script.txt"
# in the same folder. Each line will be sent seperately,
# so don't put everything on one line.
# Also, the app will click on the coordinates 1700, 100 to focus
# on your messaging app. It runs really fast, so if you use Discord
# you're bound to get ratelimited.
#
# Inspired by @hoppuman on TkTok.
@JustRayy
Copy link

JustRayy commented May 29, 2020

Is there a way I could change the speed it writes it so I can use it on Discord? ^-^

Edit: you could import time and between print(x) and auto.write(x) add time.sleep(0.5) so it sends a message every .5 seconds ^-^

@pmnlla
Copy link
Author

pmnlla commented May 29, 2020

Yup! Just keep in mind that Discord will ratelimit you even if you send a message every seccond, so add a longer delay. ^-^

@Phionaa
Copy link

Phionaa commented Jul 30, 2020

how exactly do i do that? my code looks like

import time
import pyautogui

def SendScript():
time.sleep(2)
with open('script.txt') as f:
lines = f.readlines()
for line in lines:
pyautogui.typewrite(line.strip())
pyautogui.press('enter')

SendScript()

@Xenotta-Alt
Copy link

try this:

import time
import pyautogui

def SendScript():
    with open('script.txt') as f:
        for x in f:
          pyautogui,typewrite(x)
          pyautogui.press(enter)
          time.sleep(2)

SendScript()

I haven't tried it out myself, but hopefully it works for you

@Phionaa
Copy link

Phionaa commented Jul 30, 2020

I tried this (copy and pasted it exactly into notepad++) but it said "NameError: name 'typewrite' is not defined" so I assumed maybe that was because you (maybe typo, i assumed this because the two lines under it have periods not commas) put a comma between pyatogui and typewrite, but when I added a period instead of a comma it said,"NameError: name 'enter' is not defined"

@JustRayy
Copy link

JustRayy commented Sep 3, 2020

I tried this (copy and pasted it exactly into notepad++) but it said "NameError: name 'typewrite' is not defined" so I assumed maybe that was because you (maybe typo, i assumed this because the two lines under it have periods not commas) put a comma between pyatogui and typewrite, but when I added a period instead of a comma it said,"NameError: name 'enter' is not defined"

My code looks like this

import time
import pyautogui as auto
file = open("script.txt", "r")
auto.click(860, 719);

for x in file:
    print(x)
    time.sleep(0.7)
    auto.write(x)

you can change the time.sleep to anything you want (I use 0.9 for Discord)

@Xenotta-Alt
Copy link

I tried this (copy and pasted it exactly into notepad++) but it said "NameError: name 'typewrite' is not defined" so I assumed maybe that was because you (maybe typo, i assumed this because the two lines under it have periods not commas) put a comma between pyatogui and typewrite, but when I added a period instead of a comma it said,"NameError: name 'enter' is not defined"

That is because 'typewrite' does not exist and is not part of the pyautogui library. Use 'write' instead

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment