Majedz Posted June 12, 2022 Share Posted June 12, 2022 hi to all; I have 2 loops; loop(1) go through a table line by line (max number of lines is 23; using for $i=1 to 23); distance between each line is 20; I am concerned in 3 columns of my table; Loop2 repeat loop (1) 100 time (using For $r=1 to 100) I use the following to go through lines of table (Loop1) depending on column 3 for $L=1 to 23; $L=Line number A)) Column 3 contain 3 color possibilities 1=red; 2=black; 3=white; X coordinate=871 $yLine=280+($L*20); the Y coordination of the first line is 300; so 300-20 is 280 MouseMove(871,$yLine) ; X coordinate of coulmn3=871 local $color3=PixelGetColor(871,$yLine); if $color3=6684730 or $color3=6160437 then ; if color is black do function1 function1() endif if $color3=16777215 or $color3=13143889 then ; the $color3=white; no data in line MsgBox("","You reach the last line","Exit For $i Loop start from $i=1",2); must exit Loop1 and start new round ContinueLoop(2);????? EndIf if $color3=16711738 or $color=16252981 then ;$color3 is red; go to coulmn2 MsgBox("","Color 3 is","Red",1);must skip line to the next without exiting loop1(lines) ContinueLoop(1); ??? not sure is it this code necessary EndIf B)) Column 2 contain 3 color possibilities 1=black; 2=white; 3=grey; X coordinate=660 Action1: is taken (function 1() ) only if color in column 3 is black and in column 2 is also black Action2: is taken (function 2() ) only if color in column 3 is black and in column 2 is white or grey MouseMove(660,$yLine); local $color2=PixelGetColor(660,$yLine); if $color2=6684730 or $color2=6160437 then MsgBox("","Color 2 s","Black",1); ((if $color3=" Black " And $color2=" Black" then function1() )) ((if $color3="Black" And ($color2="White" or $color2="grey") then function2() )) I am not sure that the last 2 lines are O.K!! C)) Column 1 have 2 possibilities 1=red; 2=blue; X coordinate=28; I need to count how many lines are red, and how many are , this column using the loop MouseMove(28,$yLine); local $color1=PixelGetColor(28,$yLine) if $color1=14170419 then $Type="Sell" ;color1="red" if $color1=24225 then $Type="buy" ;$coler1="green" I need to count red and blue Lines in this column using the loop; I couldn't do that; Any advice, help is highly appreciated Link to comment Share on other sites More sharing options...
Majedz Posted June 13, 2022 Author Share Posted June 13, 2022 The maine part of problm was solved, I will present the part that I couldnt solve in a new post in a clear way Link to comment Share on other sites More sharing options...
Majedz Posted June 13, 2022 Author Share Posted June 13, 2022 dear Autoit forum; I have only two colors in column 1; $color1=14170419 ;"red"; and $color1=24225 ;"blue" For $L=1 to 19 $yLine=280+($L*20); the Y coordination of the first line is 300; so 300-20 is 280 MouseMove(28,$yLine); local $color1=PixelGetColor(28,$yLine) $color1=14170419 ;"red" $color1=24225 ;"blue" next I need to count red and blue Lines in this column using the loop; I couldn't do that; Any advice, help is highly appreciated Link to comment Share on other sites More sharing options...
Developers Jos Posted June 13, 2022 Developers Share Posted June 13, 2022 Please stick to one topic for your question! SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Majedz Posted June 13, 2022 Author Share Posted June 13, 2022 Sorry Jos; may be I have comuncation problm english is not my first laguge, so if you look at the attached file it may be easir, I have one topic is it possble to count in each line of the coulmn thee red color, Thancks in advance Link to comment Share on other sites More sharing options...
junkew Posted June 13, 2022 Share Posted June 13, 2022 search for bitblt in the forum it will help you analysing colorbits quicker. But to start slow are you just looking for if ...then ? I would just start to see what happens if you do for $yLine=280 to 680 to see which values you get For $L=1 to 19 $yLine=280+($L*20); the Y coordination of the first line is 300; so 300-20 is 280 MouseMove(28,$yLine); local $color1=PixelGetColor(28,$yLine) consolewrite($color1) if ($color1=14170419) then consolewrite("red") endif if ($color1=24225) then consolewrite("blue") endif next Majedz 1 FAQ 31 How to click some elements, FAQ 40 Test automation with AutoIt, Multithreading CLR .NET Powershell CMDLets Link to comment Share on other sites More sharing options...
Majedz Posted June 13, 2022 Author Share Posted June 13, 2022 thanks junkew for your help, I usually like using for next loop; results are :24225blue24225blue24225blue24225blue24225blue24225blue24225blue14170419red24225blue14170419red24225blue24225blue24225blue24225blue24225blue24225blue24225blue14170419red24225blue so how to count blue and red?? Link to comment Share on other sites More sharing options...
genius257 Posted June 13, 2022 Share Posted June 13, 2022 (edited) Hi @Majedz. I guess you want to count the number of red and blue lines? then here: $iRed = 0 $iBlue = 0 For $L=1 to 19 $yLine=280+($L*20); the Y coordination of the first line is 300; so 300-20 is 280 MouseMove(28,$yLine); local $color1=PixelGetColor(28,$yLine) ;consolewrite($color1) if ($color1=14170419) then $iRed+=1 endif if ($color1=24225) then $iBlue+=1 endif next ConsoleWrite("Red: "&$iRed&@crlf) ConsoleWrite("Blue: "&$iBlue&@crlf) Sorry @junkew i was too lazy to type it all so i borrowed most of yours Edited June 13, 2022 by genius257 debug line Majedz 1 My highlighted topics: AutoIt Package Manager, AutoItObject Pure AutoIt, AutoIt extension for Visual Studio Code Github: AutoIt HTTP Server, AutoIt HTML Parser Link to comment Share on other sites More sharing options...
Majedz Posted June 13, 2022 Author Share Posted June 13, 2022 thanks genius257 it works, results: Red: 19 Blue: 8; but some adjustment is needed since 19 is the totall of red+blue ; 8 is blue Link to comment Share on other sites More sharing options...
genius257 Posted June 13, 2022 Share Posted June 13, 2022 Refresh the page and copy the code again i edited my post twice and the second time i removed a "or 1" from the if block that checks red Majedz 1 My highlighted topics: AutoIt Package Manager, AutoItObject Pure AutoIt, AutoIt extension for Visual Studio Code Github: AutoIt HTTP Server, AutoIt HTML Parser Link to comment Share on other sites More sharing options...
Majedz Posted June 13, 2022 Author Share Posted June 13, 2022 thanks genius257 yes it works thanks also to @junkew Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now