资源简介

基于python3.6 pyautogui 

资源截图

代码片段和文件信息

import math
import pywinauto
import os
from pywinauto.application import Application
import pyautogui
import time #导入时间库


# 创建对象
app_music = pywinauto.Application()

#开启应用
app_music.start(‘E:\CloudMusic\cloudmusic.exe‘)
# app_music.start(‘notepad.exe‘)
#连接应用  Chrome_WidgetWin_0
app_music.connect(path=r“E:\CloudMusic\cloudmusic.exe“)
#
time.sleep(2)



# window_title=‘Chrome_WidgetWin_0‘
screenWidth screenHeight = pyautogui.size()
#1.窗口最大化
print(screenWidthscreenHeight)
# pyautogui.moveTo(1425210duration=0.5)
# pyautogui.click(button=‘left‘)
#2.点击搜索歌曲
# pyautogui.moveTo(35025duration=0.5)
pyautogui.moveTo(389228duration=0.5)
pyautogui.click(button=‘left‘)
#3.输入歌曲名点击搜索

pyautogui.keyDown(‘ctrlleft‘)
pyautogui.press(‘a‘)
pyautogui.keyUp(‘ctrlleft‘)
pyautogui.keyDown(‘delete‘)
pyautogui.keyUp(‘delete‘)

#搜索歌曲
# pyautogui.keyDown(‘shiftleft‘)
# pyautogui.keyUp(‘shiftleft‘)
# pyautogui.typewrite(‘All  of  me  ‘ 0.25)
pyautogui.typewrite(‘juhao ‘ 0.2)


time.sleep(1)
pyautogui.moveTo(46025duration=0.5)
pyautogui.click(button=‘left‘)

# app_music[“网易云音乐“].Edit.TypeKeys(“125644444“)

time.sleep(1)

#4.点击播放
# pyautogui.moveTo(400200duration=0.5)
pyautogui.moveTo(430200duration=0.5)

pyautogui.doubleClick()

pyautogui.moveTo(180970duration=0.5)
pyautogui.click(button=‘left‘)
pyautogui.moveTo(145930duration=0.5)
pyautogui.click(button=‘left‘)

# wx = pywinauto.Application()
# wx.start(‘E:\Software\Tencent\WeChat\WeChat.exe‘)
# #连接应用  Chrome_WidgetWin_0
# wx.connect(path=r“E:\Software\Tencent\WeChat\WeChat.exe“)
# #
# time.sleep(1)
# #点击搜索打
#
# pyautogui.moveTo(680280duration=0.3)
# pyautogui.click(button=‘left‘)
#

评论

共有 条评论