Hello, I need a script where I can predetermine the Pixels that will be pressed on the keys.
It can be like that, For example;
Pixels= 0xFFFFF0 , 0x593FFF , 0x92349 , 0x23494 ,
If win active RAYGOX
LOOP
PixelSearch, FoundX, FoundY, 200, 200, 200, 200,
if color=0xFFFFF0
sendinput 1
if color=0x593FFF
sendinput 2
if color=0x923495
sendinput 3
if color=0x234943
sendinput 4
There is 2 things will help me much, the stucture of this code. Speed of searching and pressing buttons.
Thanks for any help! ^^
Need a basic script and help
Re: Need a basic script and help
We have again had to move your thread from the main section, which is for AHK v2 code. Please notice where this thread has been moved to and post in the appropriate section from now on.
Also, makes your subject titles more descriptive about what you need help with. Everyone who posts here needs help.
Also, makes your subject titles more descriptive about what you need help with. Everyone who posts here needs help.
Re: Need a basic script and help
Thank you, sorry for confusion.boiler wrote: ↑09 May 2023, 04:07We have again had to move your thread from the main section, which is for AHK v2 code. Please notice where this thread has been moved to and post in the appropriate section from now on.
Also, makes your subject titles more descriptive about what you need help with. Everyone who posts here needs help.
Re: Need a basic script and help
Regarding your post, in a recent post, you tried to make a search rectangle when using PixelGetColor. Now your search rectangle is only one pixel, so you really should be using PixelGetColor in this case.
Re: Need a basic script and help
Sorry for making confusion.
This part of the script is important for me.
''
If win active RAYGOX
LOOP
PixelSearch, FoundX, FoundY, 200, 200, 200, 200,
if color=0xFFFFF0
sendinput 1
''
I gave the coordinates as an example. Not real coordinates.
Can it trace inside a rectangle with PixelGetColor? (I guess no.) (if yes, great)
Because PixelSearch is running a bit slow. As I wrote in the example, I would like to specify the place where the monitoring will be performed once. The place to be traced is a maximum 20x20 rectangle. **The pixels are not at the same place in that rectangle.**
I'm having trouble making the code whole. Can you help me?
Re: Need a basic script and help
Sure its like this, but please ignore the coords.
Also with these structure, im editing all other colors coords again an again. (pain)
Code: Select all
PixelSearch, FoundX, FoundY, 569, 555, 990, 672, 0x940000, 0, Fast RGB
Re: Need a basic script and help
I guess you’re looking to do something like this:
Code: Select all
Colors := [0xFFFFF0, 0x593FFF, 0x92349, 0x23494]
for Num, Color in Colors
{
PixelSearch,,, 569, 555, 990, 672, Color, 0, Fast RGB
if !ErrorLevel
Send, % Num
}
Re: Need a basic script and help
Yes,nearly.boiler wrote: ↑09 May 2023, 06:35I guess you’re looking to do something like this:Code: Select all
Colors := [0xFFFFF0, 0x593FFF, 0x92349, 0x23494] for Num, Color in Colors { PixelSearch,,, 569, 555, 990, 672, Color, 0, Fast RGB if !ErrorLevel Send, % Num }
Defining the coordinate. Done.
Defining colors. Done.
One last thing left, defining the keys to be pressed for the colors.
Like; press 1 for 0xFFFFF0 color. press 2 for 0x593FFF color. press 3 for 0x92349 color.
Also it would be awesome if its in loop
Re: Need a basic script and help
Nope. Also done for those numbers (and 4 for the last color).
Put the word loop on a line before the for… line.
Re: Need a basic script and help
Re: Need a basic script and help
Hello boiler,boiler wrote: ↑09 May 2023, 06:35I guess you’re looking to do something like this:Code: Select all
Colors := [0xFFFFF0, 0x593FFF, 0x92349, 0x23494] for Num, Color in Colors { PixelSearch,,, 569, 555, 990, 672, Color, 0, Fast RGB if !ErrorLevel Send, % Num }
how can i set the keys not like 1 , 2 , 3 but with shift; +{1}, +{2}, +{3}?
Re: Need a basic script and help
The easiest way is like this since they happen to be 1, 2 3, 4:
The braces aren't needed for keys like 1, 2, 3.
If you wanted to more generally map a set of keys to them that don't happen to line up numerically, you could make an associative array, like this:
Code: Select all
Colors := [0xFFFFF0, 0x593FFF, 0x92349, 0x23494]
for Num, Color in Colors
{
PixelSearch,,, 569, 555, 990, 672, Color, 0, Fast RGB
if !ErrorLevel
Send, % "+" Num
}
If you wanted to more generally map a set of keys to them that don't happen to line up numerically, you could make an associative array, like this:
Code: Select all
Colors := {"+{F4}": 0xFFFFF0, "+{F5}": 0x593FFF, "^{Tab}": 0x92349, "+{Space}": 0x23494}
for Key, Color in Colors
{
PixelSearch,,, 569, 555, 990, 672, Color, 0, Fast RGB
if !ErrorLevel
Send, % Key
}
Who is online
Users browsing this forum: Chunjee, GroggyOtter, moltenchees and 172 guests