Use the ocv library to identify whether there is a forbidden sign in the window! The full code is at the bottom!
Go to the official account: daily recommended series to get more relevant knowledge
import required libraries
First, the code starts by importing a series of libraries to bring in the required functionality:
import win32gui
import win32con
import time
import win32api
import cv2
import numpy as np
import pyautogui
These libraries include functions for window control ( win32gui
, win32con
, win32api
), image manipulation ( cv2
, numpy
), and keyboard and mouse simulation ( ).pyautogui
Set message sending parameters
Next, the code defines the title of the window to send the message to, the content of the message, and the sending interval:
window_title = '实验群'
message = '软件'
interval = 0.01
These parameters will be used for subsequent window control and message sending operations.