当前位置: 首页 > news >正文

自动化操作脚本

文章目录

  • vbs
  • openCV + pyautogui


vbs

SSH连接并执行指令操作

Dim WshShell 
Set WshShell=WScript.CreateObject("WScript.Shell") WshShell.Run "cmd.exe"
WScript.Sleep 1000
WshShell.SendKeys "ssh xcmg@10.27.40.103"
WshShell.SendKeys "{ENTER}"
WScript.Sleep 1000
WshShell.SendKeys "123"
WshShell.SendKeys "{ENTER}"
WshShell.SendKeys "cd agv_1 && xmake run"
WshShell.SendKeys "{ENTER}"

MQTT服务器启动

Dim WshShell 
Set WshShell=WScript.CreateObject("WScript.Shell") WshShell.Run "cmd.exe"
WScript.Sleep 1000
WshShell.SendKeys "C:\Users\USER\emqx-5.3.0-windows-amd64\bin\emqx start"
WshShell.SendKeys "{ENTER}"
Dim WshShell 
Set WshShell=WScript.CreateObject("WScript.Shell") WshShell.Run "cmd.exe"
WScript.Sleep 1000
WshShell.SendKeys "D:"
WshShell.SendKeys "{ENTER}"
WshShell.SendKeys "cd D:\Program Files {(}x86{)}\work\emqx\bin"
WshShell.SendKeys "{ENTER}"
WshShell.SendKeys "emqx start"
WshShell.SendKeys "{ENTER}"

openCV + pyautogui

import cv2
import numpy as np
import pyautogui
import time# 捕获屏幕的函数
def capture_screen():image = pyautogui.screenshot()image = cv2.cvtColor(np.array(image), cv2.COLOR_RGB2BGR)return image# 寻找目标图像的函数
def find_target(screen, target, threshold=0.8):result = cv2.matchTemplate(screen, target, cv2.TM_CCOEFF_NORMED)_, max_val, _, max_loc = cv2.minMaxLoc(result)if max_val > threshold:return max_locreturn None# 点击目标的函数
def click_target(target_image_path, waiting_time=5):# 等待程序加载或窗口出现time.sleep(waiting_time)target_image = cv2.imread(target_image_path)screen = capture_screen()target_location = find_target(screen, target_image)if target_location:# 计算图标的中心位置并点击target_center = (target_location[0] + target_image.shape[1]//2, target_location[1] + target_image.shape[0]//2)pyautogui.click(target_center)return Truereturn False# 主函数
def main():# 点击与软件链接的文件if not click_target('path_to_file_icon.jpg'):print("Failed to find the file icon.")return# 等待软件启动并点击软件界面中的按钮if not click_target('path_to_software_button.jpg', waiting_time=10):print("Failed to find the button in the software.")return# 点击新窗口中的按钮if not click_target('path_to_new_window_button.jpg', waiting_time=5):print("Failed to find the button in the new window.")returnprint("Operation completed successfully.")if __name__ == "__main__":main()
http://www.lryc.cn/news/256241.html

相关文章:

  • MVC、MVP、MVVM模式的区别
  • 【Vue】日常错误总结(持续更新)
  • java多线程(常用方法、实现方式、线程安全问题、生命周期、线程池)
  • Day05 linux高级系统设计 - 管道
  • 低代码:美味膳食或垃圾食品?
  • 免费网页抓取工具大全【附下载和工具使用教程】
  • Leetcode 39 组合总和
  • Windows下使用AndroidStudio及CMake编译Android可执行程序或静态库动态库
  • MySQL七 | 存储引擎
  • 网上下载的pdf文件,为什么不能复制文字?
  • Linux下apisix离线安装教程
  • 基于STM32 + DMA介绍,应用和步骤详解(ADC多通道)
  • openGauss学习笔记-144 openGauss 数据库运维-例行维护-慢sql诊断
  • 计算机毕业设计springboot+ssm停车场车位预约系统java
  • 打破常规思维:Scrapy处理豆瓣视频下载的方式
  • 系列学习前端之第 2 章:一文精通 HTML
  • SCSS Module 这样处理配置和使用太赞了
  • 【Unity动画】Unity 2D动画创建流程
  • 【算法每日一练]-图论(保姆级教程篇12 tarjan篇)#POJ3352道路建设 #POJ2553图的底部 #POJ1236校园网络 #缩点
  • Python数据科学视频讲解:数据挖掘与建模的注意事项
  • unity | 动画模块之循环滚动选项框
  • TinyMPC - CMU (卡耐基梅隆大学)开源的机器人 MPC 控制器
  • C++ 对象的初始化和清理:构造函数和析构函数
  • Tmux中使用Docker报错 - 解决方案
  • 如何在WordPress中批量替换图片路径?
  • el-pagination 纯前端分页
  • 基于springboot的校园二手市场
  • 【开源】基于Vue和SpringBoot的在线课程教学系统
  • Mysql分布式集群部署---MySQL集群Cluster将数据分成多个片段,每个片段存储在不同的服务器上
  • 身份认证技术