Click here to Skip to main content
15,562,816 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Good morning, does anyone know how to do it? artificial intelligence press a key on my keyboard when there is a specific icon or image in a certain program and that it can also repeat it in a loop and add multiple icons (image) as an example: when I see icon 1 I press x, if I see icon 2 I press a, if I see icon 3 I press f IMPORTANT DETAIL that artificial intelligence does everything step by step example: I see icon 1 I press x, I see icon 2 I press a, it should be like this The information of keys pressed must be given with their respective icon to avoid confusion (I see icon 1 I press x at the same time) # so it should not be one step at a time (I see icon 2 I press) I am going to upload a video of how I want the icons to be pressed by highlighting in the video with the word icon [Video example]

https://www.youtube.com/watch?v=h2FycMW8zbs&ab_channel=Carlos

What I wanted you to help me with is a code that detects the icons that appear in this video highlighted with the word icon

https://www.youtube.com/watch?v=3O7iPkgMHFA&ab_channel=pythoncarlos

and that whenever you see them press the ai keys on the keyboard in qwerty order or an order specified in the response, eg icon 1: q icon 2: w etc, I already know which icon is 1 2 etc. simply in the order in which it appears in the video or at least help me with a code that only presses a key on my keyboard when I see an icon in the video there is a link to the reference of the icons or go to the channel or search for pythoncarlos < /pre>
*in Python language*
if someone does something like this please help me

my contact email: [DELETED]

code:
Python
from pyautogui import *
import pyautogui
import time
import keyboard
import random
import win32api, win32con

time.sleep(2)

def click(x,y):
    win32api.SetCursorPos((x,y))
    win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN,0,0)
    win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP,0,0)

#Color of center: (255, 219, 195)

while keyboard.is_pressed('q') == False:
    flag = 0
    pic = pyautogui.screenshot(region=(983,813,370,100))

    width, height = pic.size

    for x in range(0, 255, 5):
        for y in range(0, 99, 5):

            r, g, b = pic.getpixel((x, y))

            if b == 121 and r == 0 and g == 118:
                flag = 1
                click(x+983, y+813)
                time.sleep(0.05)

                break

        if flag == 1:
            break

something like the code that I have but it only detects one image at a time and for my project I need it to see an image and then wait to see another and so with all the icons and logically with each icon seen by pressing a key in difference that my code just clicks and for each icon there should be a 2 second delay which my code doesn't have

What I have tried:

I tried everything looking for information but nothing worked
Posted
Updated 22-Nov-22 22:33pm
v9
Comments
Richard Deeming 22-Nov-22 4:36am    
"What I wanted you to help me with is a code ..."

Then you've come to the wrong site. Whilst we're happy to help you fix problems with code you have written, nobody here is going to write the code for you.

There are plenty of sites where you can hire someone to write code for you. This is not one of them.

If you want someone to help you fix your code, then you need to show the relevant parts of your code any clearly explain what is wrong with it.

1 solution

 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900