Marzupilami Posted November 7, 2014 Share Posted November 7, 2014 Is there any way I can program in AutoIT so that it can detect what color a certain area of the screen has and use that in code, for example, "If", "When", and "Do"-commands? Link to comment Share on other sites More sharing options...
Celtic88 Posted November 7, 2014 Share Posted November 7, 2014 https://www.autoitscript.com/autoit3/docs/functions/PixelGetColor.htm Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted November 7, 2014 Moderators Share Posted November 7, 2014 Marzupilami, can you explain more about what you're trying to accomplish, or what kind of window you're trying to manipulate? As FinishHim points out, there are options under PixelGetColor, but these are flaky at best. Most applications support using Control commands to send commands to the window, and this will provide you with a much more stable script. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
Marzupilami Posted November 9, 2014 Author Share Posted November 9, 2014 Ok, how do I make it wait until a certain pixel has a certain color? Link to comment Share on other sites More sharing options...
water Posted November 9, 2014 Share Posted November 9, 2014 Would you please be so kind to answer the question posted by JLogan3o13? When we know which program you try to auomate we can provide the most reliable solution. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
TheSaint Posted November 9, 2014 Share Posted November 9, 2014 Perhaps, if you share a little of your code thus far, it might become clear about what you are working with, as many windows have different requirements etc. Perhaps even knock up a little If When Do scenario, which we can correct for you if need be. Window positioning and size may need to be taken into account. Make sure brain is in gear before opening mouth! Remember, what is not said, can be just as important as what is said. Spoiler What is the Secret Key? Life is like a Donut If I put effort into communication, I expect you to read properly & fully, or just not comment. Ignoring those who try to divert conversation with irrelevancies. If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it. I'm only big and bad, to those who have an over-active imagination. I may have the Artistic Liesense to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage) Link to comment Share on other sites More sharing options...
Bert Posted November 10, 2014 Share Posted November 10, 2014 Ok, how do I make it wait until a certain pixel has a certain color? Seeing you are new, you may have not have the pleasure of reading our forum rules. Just to keep things on the up and up. I say this for what you are asking for is 99% of the time for a game and we do not allow for that here. I have no idea if that is your intent or not however no point in wasting our time if it is. Otherwise, it be great if you shared your code so far so we can see how we can help. Thanks. The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
Marzupilami Posted November 14, 2014 Author Share Posted November 14, 2014 Hi! Ok, here's the background: I often search the same travel on the local public transport company Västtrafik's webpage, in their route planner: http://reseplanerare.vasttrafik.se/bin/query.exe/sn Because it would be easier, and because I'm a little interested in code, I thougt I'd make a program in AutoIT that automatically opens Chrome and searches the travel for me. But the page does not load as fast every time, and if the program is going to be fast I cannot just put a long delay in the beginning to be sure. So my code this far is just: ShellExecute ("chrome.exe", "http://reseplanerare.vasttrafik.se/bin/query.exe/sn") Then I thougt something that could detect when a certain pixel on the screen changed color (the page loaded) could solve the problem. Of course if there is a better solution I would really appreciate that as well. (PS. I'm really new to AutoIT, and any type of code. I only know like "ShellExecute, "Sleep", and "Winkill" ) Link to comment Share on other sites More sharing options...
jdelaney Posted November 14, 2014 Share Posted November 14, 2014 (edited) Use IE, or Firefox, and you can easily hook into the DOM object, and wait for it to load...IE comes packaged with autoit: Here is one of them: _IELoadWait If the page loads, and still has elements being built, then you can loop for your specific element to be present. That will be ooddles easier than pixel searching...not to mention more reliable also. Edited November 14, 2014 by jdelaney IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window. 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