[PYTHON] I want to make a click macro with pyautogui (outlook)

Wait a minute! There are too many functions!

jidou.py


#!/usr/bin/python
# -*- coding: utf-8 -*-

import pyautogui as pg
import time as ti
import random as rm

grapath="bpic/"


def clicker(x,y):
	if x != None and y != None:
		pg.click(x,y,button="left",duration=0.5)
	else:
		print("nooo")

def clicktimerand():
	time=rm.randint(1,5)
	return time

def syutuxy():
	x,y=pg.locateCenterOnScreen(grapath+"syutu.png ")
	return x,y

def syuturand(x,y):
	rx=rm.randint(-39,21)
	ry=rm.randint(-39,26)
	x=x+rx
	y=y+ry
	return x,y

def hokyuxy():
	x,y=pg.locateCenterOnScreen(grapath+"hokyu.png ")
	return x,y

def hokyurand(x,y):
	rx=rm.randint(-27,27)
	ry=rm.randint(-30,30)
	x=x+rx
	y=y+ry
	return x,y

def honxy():
	x,y=pg.locateCenterOnScreen(grapath+"hon.png ")
	return x,y

def honrand(x,y):
	rx=rm.randint(-7,7)
	ry=rm.randint(-8,8)
	x=x+rx
	y=y+ry
	return x,y

def endxy():
	x,y=pg.locateCenterOnScreen(grapath+"end.png ")
	return x,y

def endrand(x,y):
	rx=rm.randint(-7,7)
	ry=rm.randint(-8,8)
	x=x+rx
	y=y+ry
	return x,y

###StartUp#################################
ti.sleep(1)
pg.FAILSAFE=True #move to left over

###Schedule#################################
syutub=syutuxy()
hokyux,hokyuy=hokyuxy()

hokyurx,hokyury=hokyurand(hokyux,hokyuy)
clicker(hokyurx,hokyury)

ti.sleep(2) #loading = Black out

honx,hony=honxy()
honrx,honry=honrand(honx,hony)
ti.sleep(clicktimerand())
clicker(honrx,honry)

print("Di endou")

Hoge: alien: For the time being, if I made a function to generate the center coordinates of each button and their random coordinates, it would be like this ... The names of variables are getting complicated because I'm making it with momentum ...
・ This time's catching point I was looking for an image too early and I was looking for it during loding → Good night with sleep When I come back, it seems that syutu can not be recognized because it is slightly filtered
·Outlook Reduce variables → reduce function arguments Random click length If you do not write the flowchart properly and schedule it, it will be messed up Don't look for all the images, take one place on the initial screen and use relative coordinates from there ... Gonyo Gonyo

Recommended Posts

I want to make a click macro with pyautogui (outlook)
I want to make a click macro with pyautogui (desire)
I want to make a blog editor with django admin
[Introduction] I want to make a Mastodon Bot with Python! 【Beginners】
I want to make matplotlib a dark theme
I want to write to a file with Python
I want to transition with a button in flask
I want to climb a mountain with reinforcement learning
I want to work with a robot in python.
I want to split a character string with hiragana
[Python] I want to make a nested list a tuple
I want to manually create a legend with matplotlib
I want to run a quantum computer with Python
I want to bind a local variable with lambda
I want to start a jupyter environment with one command
[Mac] I want to make a simple HTTP server that runs CGI with Python
I want to use a virtual environment with jupyter notebook!
I want to install a package from requirements.txt with poetry
I want to do ○○ with Pandas
[Visualization] I want to draw a beautiful graph with Plotly
I want to debug with Python
I want to make input () a nice complement in python
[Python] I want to make a 3D scatter plot of the epicenter with Cartopy + Matplotlib!
I want to make a voice changer using Python and SPTK with reference to a famous site
[5th] I tried to make a certain authenticator-like tool with python
I want to use a wildcard that I want to shell with Python remove
[2nd] I tried to make a certain authenticator-like tool with python
[3rd] I tried to make a certain authenticator-like tool with python
I want to do a full text search with elasticsearch + python
I tried to make a periodical process with Selenium and Python
I tried to make a 2channel post notification application with Python
I want to make a parameter list from CloudFormation code (yaml)
I tried to make a todo application using bottle with python
[4th] I tried to make a certain authenticator-like tool with python
[1st] I tried to make a certain authenticator-like tool with python
I tried to make a strange quote for Jojo with LSTM
I tried to make a mechanism of exclusive control with Go
I want to print in a comprehension
I want to analyze logs with Python
I want to play with aws with python
I want to make an automation program!
I tried to make a Web API
Python: I tried to make a flat / flat_map just right with a generator
I came up with a way to make a 3D model from a photo.
I tried to make a calculator with Tkinter so I will write it
I tried to make "Sakurai-san" a LINE BOT with API Gateway + Lambda
I tried to make a traffic light-like with Raspberry Pi 4 (Python edition)
[Outlook] I tried to automatically create a daily report email with Python
I tried to make a url shortening service serverless with AWS CDK
I want to make a web application using React and Python flask
I was addicted to trying Cython with PyCharm, so make a note
A memorandum to make WebDAV only with nginx
I want to easily create a Noise Model
I want to use MATLAB feval with python
I want to analyze songs with Spotify API 2
I want to INSERT a DataFrame into MSSQL
I want to mock datetime.datetime.now () even with pytest!
I want to display multiple images with matplotlib.
I want to knock 100 data sciences with Colaboratory
How to make a dictionary with a hierarchical structure.
I want to be an OREMO with setParam!