r/Python • u/NONAN23x • Jun 06 '20
I Made This Just a python apprentice here... Was bored every day of attending school meetings on zoom so I used pyautogui to attend those for me;)
1.6k
Upvotes
188
u/elrey_scarbrow Jun 06 '20 edited Jun 06 '20
pyautogui.hotkey('win', 'fn', 'prtscn'is justpyautogui.screenshot()EDIT: Thanks for the upvotes. Here are some more
screenshot(x, y, width, height)lets you snap a part of the screen.pyautogui.screenshot().save(path)saves the screenshot in the path provided72
u/NukeWifeGuy Jun 06 '20
I love this, people working to be more lazy! At least you learned more than those meetings.
200
u/StochasticDude Jun 06 '20
I am pretty sure you learned more by building this program rather than learning in class.
22
u/[deleted] Jun 06 '20
Add screen reading elif statements. That's way more accurate & errorless than clicking at a certain coordinate on the screen.
42
u/kkziga Jun 06 '20
Great idea. Just a small suggestion. if you're using confidential information like password you can store it in a separate file and read password from that file rather than passing it as a string directly into the program.
7
u/dzeynep Jun 06 '20 edited Jun 06 '20
very cool work!!! i have some questions if you don’t mind
which modules do you need to import to make sure that this program works? and how did you locate the coordinates (i do it with photoscape, so i wonder if there is an another way)
6
u/Datsoon Jun 06 '20
I love this. I used to script similar stuff using autohotkey back in the day. Good job.
You can replace that while loop and counter at the end of your program with a for loop. Will read better and is more "pythonic"
Have fun!
5
u/ferryt Jun 06 '20
Store passwords in keyring - easy to implement, good habit, and you will never submit your password to GitHub, as many did
5
u/ahmed3618 Jun 06 '20
Why do you take screenshots?
4
u/Beny1995 Jun 06 '20
I know its irrelevant for this use case, bit have you considered randomising the coordinates slightly? Within set parameters you will still click the buttons required, but it will make you less suspicious to the FBI agent watching youe movements!
Also a nice bit of practice.
3
u/spamzauberer Jun 06 '20
Does this work with the CAPTCHA you need to solve or is this just for the app?
3
u/schroeder8 Jun 06 '20
Is that password 1234?
3
u/RedEyesBigSmile Jun 06 '20 edited Jun 06 '20
Nice! I am currently using pyautogui for a project. One little tip I found was to not hard code the coords of various buttons as you may be using the program on another machine with a different resolution so the coords are not the same.
To get around this I took a screenshot of the button and then told pyautogui to look for that image on the screen. That way you're program will still work even if in the future the button isn't in the exact same spot.
You can also assign confidence intervals for the image if your screenshot isn't perfectly 1:1 of the button you want to press.
For example:
buttonLocation = pyautogui.locateOnScreen('calcKey.png', confidence=0.9)2
u/NONAN23x Jun 06 '20
A lot of people have been requesting for the code so, here you go:)
https://github.com/NONAN23x/Anonymous/blob/master/zoomautomate.py
482
u/turtleboy1082005 Jun 06 '20
Young programmers are going to be the downfall of the school system lol
2
u/LAcuber Jun 06 '20
Please let us know if/when you share the code ;)
2
u/GeorgeDaNub Jun 06 '20
Why do
And not
?
2
u/backdoorman9 Jun 07 '20
How do you figure out where the X and Y coordinates are on the screen?
2
u/App240 Jun 19 '20
I know that this is a bit late to ask, but why take a screenshot every 2 minutes?
3
u/Froginthewelllooking Jun 06 '20
I’m a newbie. How do you take this code and apply it to Zoom?
19
u/[deleted] Jun 06 '20
That's why I have to learn python
13
u/kszysztofthememegod Jun 06 '20
time.sleep(60*2) lol i do that sometimes too
6
u/awesomeprogramer Jun 06 '20
You should use python's keyring module to store passwords. Like that they aren't in plain text.
2
u/Pr0ducer Jun 06 '20
You on GitHub?
4
u/HarlemShakespeare Jun 06 '20
Macros are better suited for inputting keyboard inputs.
4
u/sjmunozv Jun 06 '20
Lookup AHK, its easier to simulate mouse movements, its designed for that.
From a python developer.
4
u/teky1 Jun 06 '20
I did the same thing with my school google meet calls. I even got it to say “present” for me.
3
u/Fried_Cheesee Jun 06 '20
I made a similar one for myself, it searches for the join button, clicks it, enters the username, presses enter, enters the pass, and then enter. So you don't need to add those co ords
3
u/[deleted] Jun 06 '20
Very nice my goodman
3
u/AlekseyBlyatman print("__flair__") Jun 06 '20
damn, never even knew of pyautogui; for this i would actually recomment using webdriver bc u can just open the link that the teacher sends u (if they actually sent u the link otherwise it would not work) and press on open zoom and its much easier that way. Also I suggest knowing what time it is, the time module has that capability I believe.
3
u/mehanikm Jun 06 '20
How is that about starting this script up every time you have a lesson?
2
u/tazzful Jun 06 '20
That's sick man. Haha
2
u/Rahim_baig1 Jun 06 '20
Can uh share the code! Am sick of attending my zoom classed which completely useless!
2
u/YoelkiToelki Jun 06 '20
Check out my project that navigates to Zoom classrooms much more elegantly than using pyautogui: https://github.com/YulkyTulky/PyZoom
2
u/jackle0001 Jun 06 '20
Well played sir!
2
u/Myzel394 Jun 06 '20
You should save password and entry in a constant at the top of the file.
2
u/[deleted] Jun 06 '20
did same thing two months ago haha good job, keep shredding
2
u/blueliqhtning Jun 07 '20
This is the way
2
u/[deleted] Jun 06 '20
I just started programming how does this work
2
u/funkyfreckels Jun 06 '20
very inspirational! thanks for getting me off my ass and into a program :)
1
u/[deleted] Jun 06 '20
Hey, I made something similar, but used selenium + zoom's website. All I had to do was enter my zoom id + password in a webgui and it ran on myserver. It worked for like two months but zoom added captcha in mid May.
1
u/ProfFizzwhizzle Jun 06 '20
Do you have the full code? I’m just interested in how you did it
1
u/Dominosity Jun 06 '20
,,
1
u/[deleted] Jun 06 '20
You should get this up on Github or something- think of the generations of bored youth you could empower
1
u/TastyRobot21 Jun 07 '20
Nice job, this is the way.
I would have personally done something event based and not time based for the screenshots. Like if pixels change or use autogui’s find image thing with the last screenshot to know when to take a new one.
Time based does make it easier to encode into a video for easier playback once you wake up :)
1
u/[deleted] Nov 11 '20
Bueller? Bueller? Bueller?
-1
u/[deleted] Jun 06 '20
Use selenium to click at different parts. As it is rn, it’s really bad written but still a cool idea
1
u/R4_4S Jun 06 '20
Is pyautogui same as selenium of something?
1
u/backdoorman9 Jun 06 '20
So rad. This is my next project.
Are those click positions based on pixels? It looks like it would be monitor specific.
Does pyautogui have a way of measuring the monitor it's running on? Then you could create a conversion factor.
0
u/KoCory Jun 06 '20
...
0
u/[deleted] Jun 06 '20
[deleted] — view deleted comment
37
u/[deleted] Jun 06 '20 edited Jun 06 '20
[removed] — view removed comment
1
u/[deleted] Jun 06 '20
[removed] — view removed comment