TsunamiZ Posted March 9, 2013 Report Share Posted March 9, 2013 Please add "wait for pixel color". This is useful for confirming when mouse cursor is over a certain item that can't be identified any other way. Quote Link to comment Share on other sites More sharing options...
gagangoomer Posted September 24, 2013 Report Share Posted September 24, 2013 I couldn't find this option under MEP. Can you please advise where exactly this option is available ? Quote Link to comment Share on other sites More sharing options...
Cory Posted September 24, 2013 Report Share Posted September 24, 2013 There is no "Wait for pixel color" so I made my own loop. Simply use the Get Pixel Color and put it in a loop with a delay and logic. I use a timeout as well to avoid an infinite loop. EG loop for 100 times with 100mS delay and a condition that when the color is found to break. Be warned however it's probably not as simple as you think. Getting the pixel color is the easy part, making use of the integer 'representation' of it is not so easy. First off it's essentially 3 8 bit integer values glued together representing the 3 primary colors Blue, Green, Red in that order. IE black is 255, 255, 255 which will appear as 255255255 if memory serves. The reason I mention this is because in a modern OS GUI things like progress indicators are shaded meaning the exact color from one pixel to the next is slightly different. And because of the way the 3 values are glued together you can't really compare without first breaking them up. I have a webpage someplace explaining it all and there have been a few posts about it. If you get into it and need this edification let me know. Way to big to get into at this point. Quote Link to comment Share on other sites More sharing options...
gagangoomer Posted September 25, 2013 Report Share Posted September 25, 2013 Cory,Thanks for your reply.I found a macro(umRGBColorEvaluator.mex). This macro tells you the color location of your mouse pointer. If you go through the script you'll find all the color combinations we can get through using RGB. When i run the macro it shows most of the time results as White color only.Also you mentioned for Black color the color combination would be 255,255,255 where as in the macro script it is mentioned as 0,0,0.Unluckely i don't have the option to send you the script so i've attached the snapshot for your reference.I tried to attach the snapshot of the script but the editor is not letting me to that as well.So i've mentioned the simple script for your reference. <GET PIXEL COLOR Option="\x01" Rel_To_Screen="TRUE" X="482" Y="749" Destination="%pixel_color%"/> <DELAY Flags="\x12" Time="300"/> <END IF/> <REPEAT START Start="1" Step="1" Count="200" Save="FALSE"/> <DELAY Flags="\x02" Time="100"/> <IF VARIABLE Variable="%pixel_color%" Condition="\x01" Value="255" IgnoreCase="FALSE"/> <BREAK/> <END IF/> <END REPEAT/> <TEXT BOX DISPLAY Title="Result" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil\\fcharset0 Tahoma;}{\\f1\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs16 Color Matched\\f1 \r\n\\par }\r\n" Left="Center" Top="Center" Width="278" Height="200" Monitor="0" OnTop="FALSE" Keep_Focus="TRUE" Mode="\x00" Delay="0"/> Gagan Quote Link to comment Share on other sites More sharing options...
Samrae Posted September 25, 2013 Report Share Posted September 25, 2013 The color 16777215 / 0xFFFFFF / 255 255 255 is white while 0 / 0x000000 / 000 000 000 is black. Each number can vary between 0 and 255 and represents how much Red, Green and Blue to display. If the computer displays all red, green and blue possible you get white and if it displays no red, green and blue you get black. Since colors are represented by numeric values it is possible create a "Wait for Pixel Color" function by creating a Repeat statement to wait until the value matches a certain color. In my macros I use OR statements to check for several colors. You need to be careful, though, because changing the Windows theme may require that you adjust your macro for the different colors. Quote Link to comment Share on other sites More sharing options...
Cory Posted September 25, 2013 Report Share Posted September 25, 2013 Gagan you're correct. I misspoke about FF, FF, FF being black. 255 = FF in hex BTW. Hex is much easier to deal with. The snippet you sent is broken. Unmatched EndIf. But why do you need it? When I'm looking at colors I use the Mouse Locator tool. Right click the MEP tray icon > Tools > Launch Mouse Locator. It will show you the color under your mouse in integer and hex. I don't see a question in your last post. Quote Link to comment Share on other sites More sharing options...
gagangoomer Posted September 25, 2013 Report Share Posted September 25, 2013 Thanks a ton Cory...I never had a look at the color codes under the Mouse locator box. Quote Link to comment Share on other sites More sharing options...
Cory Posted September 25, 2013 Report Share Posted September 25, 2013 No problem. Good luck. Quote Link to comment Share on other sites More sharing options...
gagangoomer Posted October 4, 2013 Report Share Posted October 4, 2013 Cory, I've used the below code to check the mouse pointer. It moves the pointer to the progress bar area of the application and wait till the time the app gets the focused back from the server. Once it gets the focus back it execute the next set of code. The color code 14215660 is blue color. Mouse Move: 484, 729 Relative to Current Window Get Pixel Color from Beneath the Mouse into %N[1]% Repeat Until %N[1]% Equals "14215660" Mouse Move: 484, 729 Relative to Current Window Delay: 50 milliseconds End Repeat Any Suggestion ?? Quote Link to comment Share on other sites More sharing options...
paul Posted October 4, 2013 Report Share Posted October 4, 2013 Cory, I've used the below code to check the mouse pointer. It moves the pointer to the progress bar area of the application and wait till the time the app gets the focused back from the server. Once it gets the focus back it execute the next set of code. The color code 14215660 is blue color. Mouse Move: 484, 729 Relative to Current Window Get Pixel Color from Beneath the Mouse into %N[1]% Repeat Until %N[1]% Equals "14215660" Mouse Move: 484, 729 Relative to Current Window Delay: 50 milliseconds End Repeat Any Suggestion ?? Since you retrieve the pixel colour only once, your repeat statement will be executed either once only if the pixel colour is already blue, or for ever if it's not.. You need to include the Get Pixel Color command within the loop. Quote Link to comment Share on other sites More sharing options...
Cory Posted October 5, 2013 Report Share Posted October 5, 2013 Paul's right. Also I don't recommend you use the "Beneath the Mouse" method. Just get the pixel color at that position. Also I recommend a counter with a threshold in case the condition is never met. IE don't wait more than a set amount. Say 10 seconds. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.