办公脚本——基于python自动导出疫情通每日打卡数据for XUT_FDY

第一步 标定坐标

import pyautogui
import time
# 自动防故障功能
pyautogui.FAILSAFE =False
# 停顿功能
pyautogui.PAUSE = 2

# 屏幕总参数获取
width,height = pyautogui.size()
print(width,height)  # 1366 768

# 屏幕位置获取
time.sleep(2)
print(pyautogui.position())   # 得到当前鼠标位置

"""
位置参数:
总人数:100,420
导出列表:250,105
发送邮箱:480,405
请输入邮箱:175,330
确定:447,417
再次确定:447,417
返回:37,50
日期总选择:348,132
x方向间距:△x = 66.7
y方向间距:△y = 40
日期选择2021-02-20540,400
"""

第二步 导出数据

import pyautogui
import time
# 自动防故障功能
pyautogui.FAILSAFE =False
# 停顿功能
pyautogui.PAUSE = 2

# 屏幕总参数获取
width, height = pyautogui.size()
print(width, height)  # 1366 768

# 循环操作
def Bacia():
    pyautogui.click(85, 413, button='left')  # 单击总人数
    pyautogui.click(230, 117, button='left')  # 单击导出列表
    pyautogui.click(473, 405, button='left')  # 单击发送邮箱
    pyautogui.click(221, 336, button='left')  # 选中输入邮箱框
    pyautogui.typewrite('*****@163.com', 0.1)  # 输入邮箱地址
    pyautogui.press('enter')  # 按下回车键入.com
    pyautogui.click(447, 417, button='left')  # 点击确定
    time.sleep(1)
    pyautogui.click(447, 417, button='left')  # 二次确定
    pyautogui.click(37, 50, button='left')  # 返回
    time.sleep(6)

# main函数
Pos_y = 400
P_x = 540
dx = 67
for Pos_x in range(135, 550):
    P_x = P_x-dx
    Pos_x = P_x

    pyautogui.click(348, 132, button='left')  # 选择日期
    pyautogui.click(Pos_x, Pos_y, button='left')  # 选择具体日期
    time.sleep(2)
    pyautogui.click(516, 536, button='left')  # 点击确定按钮
    Bacia()
    if Pos_x <140:
        break

在这里插入图片描述

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 3
    评论
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值