(If you enjoy this scipt, download it, or find it interesting in any way please conisder giving the repo a star. It will help more people find it, and help the community in improving it.)
- Killswitch functionality to stop the script execution by pressing a specified key.
- Error handling for minimizing the command prompt window.
- Improved code readability and organization.
- Refactored the
minimize_cmd_window
function to minimize just the command prompt. - Enhanced the
search_and_click
function to handle a large number of image paths efficiently.
- Resolved issues with the killswitch not working properly.
- Fixed bugs related to image path validation and error reporting.
2024-05-08.17-36-29.mp4
This Python script searches for specific images on the screen and clicks on them if found. It can be useful for automating tasks where specific images need to be located and interacted with on the screen, such as in game automation or UI testing.
IMPORTANT NOTE:This Python code is compatible with the Windows operating system. This is because it relies on the win32gui and win32con modules, which are specific to Windows. Additionally, it utilizes the pyautogui library, which is compatible with Windows, macOS, and Linux, but the specific functionality used in this code (screen capturing and clicking) is primarily intended for Windows. Therefore, while the script may technically run on other operating systems, its functionality may be limited or behave differently on non-Windows platforms.
- Python 3.x
- OpenCV (
cv2
) - NumPy (
numpy
) - PyAutoGUI (
pyautogui
) - Keyboard (
keyboard
) - Win32gui (
win32gui
) - Win32con (
win32con
)
- Clone the repository to your local machine. (Or click on code, then download zip.)
- Ensure you have all the required libraries installed. You can install them using pip: pip install opencv-python numpy pyautogui keyboard pywin32
- Replace the paths in the
image_paths
list with the paths to your actual images. - Run the script using command prompt
- Press the 'q' key to stop the script at any time.
- Make sure the images you want to search for are available in the specified paths.
- Adjust the threshold value as needed for accurate template matching.
- This script may require adjustments based on the specific requirements of your task.
Contributions are welcome! Feel free to open an issue or submit a pull request.
Made by 2cz5. For any questions or suggestions, you can reach out to me on Discord:2cz5