Jekuto Posted January 20, 2014 Share Posted January 20, 2014 Hi I am currently working on a script and am still fairly new to Auto-it. I have only been using Auto-it for about a month and a half, and what I am trying to do is create a check system that depending on what is displayed on the screen will determine which of X amount of things it does... i will give an example to the best of my ability and any help at all would be insanely appreciated. -------------------------------- continuously watch coordinates (X1,Y1) (X2,Y2) (X3,Y3) (X4,Y4) (X5,Y5) (X6,Y6) (X7,Y7) (X8,Y8) (X9,Y9) (X10,Y10) (X11,Y11) (X12,Y12) (X13,Y13) (X14,Y14) (X15,Y15) and (X16,Y16) for their colors... CHECK 1 So If the pixel colors at (X1,Y1) (X2,Y2) (X3,Y3) (X4,Y4) are the same color for more then idk...... lets go with 30 seconds then it would perform (TASK 1) ;; by that i mean not the 4 coordinates being the same color as eachother but if (X1,Y1) is the same color for 30 seconds and (X2,Y2) is the same color for 30 seconds and (X3,Y3) is the same color for 30 seconds and (X4,Y4) is the same color for 30 seconds. ;;;; TASK 1 being a series of clicks and mouse cursor movement to refresh the state... I already have the "task" completed... im not sure which term to use so i am using the term task... CHECK 2 If Coordinates (X5,Y5) and (X6,Y6) or (X7,Y7) and (X8,Y8) ever become color (pink) then watch to make sure that this doesn't stay that way for more than 30 seconds.... if it does stay that color then perform (TASK 2) but keep in mind that the specific pixels wont stay pink because its a rotating half circle... so possibly just remove this error check completely? or perhaps have it instead looking at a box location for alot of pink and if there is atleast a certain amount of pink in that area for 30 seconds then perform TASK 2? ;;;; TASK 2 again being a different series of clicks and cursor movements but not a refresh instead closing the application then reopening. (I have clicks created) CHECK 3 If Coordinates (X9,Y9) and (X10,Y10) and (X11,Y11) and (X12,Y12) become (white) then Perform (TASK 3) ;;;; TASK 3 is simply relogging into the program under a usename and password so that it can track the progress and monitor checks under this account serverside. CHECK 4 If Coordinates (X13,Y13) and (X14,Y14) and (X15,Y15) are (white) and (X16,Y16) is (black) then Perform (TASK 4) ;;;; TASK 4 is closing the application reopening the application using a different application to run it... (i already have task created) ;;;; Now at this point when it has performed CHECK 4 and it has completed its if then.... the second time this happens i need it to perform a separate TASK then before or it will end up in an infinite loop. Lets call that TASK 4v2. Basically I need it to alternate between Task 4 and TASK 4v2. Also once TASK 4 has completed its first IF THEN i will need TASKS 1 2 and 3 to be slightly altered... basically once TASK 4 has done its first IF THEN i will need CHECKS 1 2 and 3 to perform a TASK 1v2 2v2 and 3v2. CHECK 5 ;;;;Check 5 is simply waiting for CHECK 4 to complete both TASK 4 and TASK 4v2... When TASK 4 and TASK 4v2 have been done and the if thens have been met for both close out everything and start over... using a login different then the first time... lets go with i have 3 seperate login ins... it will use account username and pass for the first run through until CHECK 5 has been met... then it will use login 2 until CHECK 5 has been met again then it will use login 3... and it will not use the same login twice... ;;;; this will OBVIOUSLY affect CHECK 3 for the simple fact that the username and Password it pulls and uses to login will change each time CHECK 5 is completed.... Again any help would be insanely appreciated. Thank you for your time for anyone willing to help me. and whoever can help me solve this you are my HERO. Link to comment Share on other sites More sharing options...
Richard Robertson Posted January 20, 2014 Share Posted January 20, 2014 The things you are trying to do sound like game automation. It also sounds like it could be a business based computer monitoring software. If it is the first, that is against the rules for the forums. If it is the second, there is probably a much easier way to do what you're trying to do via other automation techniques. As far as the code, it's a bit complex to explain and would really just be served better by my writing it for you. I'll wait to hear what this code is actually for before I do that. Link to comment Share on other sites More sharing options...
Jekuto Posted January 20, 2014 Author Share Posted January 20, 2014 oh no it has nothing to do with any games at all... If you have to cheat at a game to win then you shouldn't play it IMO lol. I do not intend on using this code to abuse any systems whether it be games or well anything that i guess would break any terms and conditions of anything at all... I simply am just trying to learn how to create tasks or functions to run without them all being in while infinite loops and sleep times screwing with other things... and i am just not familiar enough with Auto-it to do so... I can assure you i have nothing but honest intent and do not wish to exploit anything. Link to comment Share on other sites More sharing options...
JohnOne Posted January 20, 2014 Share Posted January 20, 2014 I can tell you this... you are going to need an endless while loop. What you are describing is mostly just PixelGetColor() and keyword logic (if, then, else, and, or) etc... AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Jekuto Posted January 20, 2014 Author Share Posted January 20, 2014 (edited) Sorry Universalist... I just reread what you had posted and you had asked for what this script was specifically for... In this case I am currently trying to simulate users login into a website that a partner of mine Keith is creating to find break points in it and to see how often they happen which will be recorded server-side by Kevin. Hes our server guy... The checks will be running in the background ofcourse and unfortuanately i cant give exact X and Y coordinates for all the checks yet but i can simply adjust those as each website is generated, and the colors in which to look for as well. And between the checks i will be going through the website trying to load videos add user content basically everything that we will offer to our users in hopes to find the breaking points. But I still wish to learn how to do things like this on my own eventually so that when we are looking at creating it for android and other mobile platforms we can test the break points on those as well. The websites we are creating well he is creating are still a work in progress otherwise id just give you the URLs. Edited January 20, 2014 by Jekuto Link to comment Share on other sites More sharing options...
Richard Robertson Posted January 20, 2014 Share Posted January 20, 2014 So you are automating a webpage? It would probably behoove you to look at the Internet Explorer automation tools which can be used with AutoIt. They make it lots easier than relying on checking colors. Link to comment Share on other sites More sharing options...
Jekuto Posted January 20, 2014 Author Share Posted January 20, 2014 (edited) Well we will be testing it on IE Chrome Mozilla Firefox and Opera... and i will alter the coordinates for each of them. I only have 7 posts left until the 21st fyi... But regardless I can tear apart the code if someone were to build it for me so that i may learn from it and be able to create similar codes on my own. So Im not sure the internet explorer set covers those I mean it might in which case i would still most likely have half a dozen or so questions... Like i said im new to Auto-It.... creating apps i can do ive been creating apps for almost a year now. I learn fast i just need some guidance along the way. If you are willing to create the code for me like you said might be easier then i would greatly appreciate it. If not then i understand but any help is appreciated either way. Edited January 20, 2014 by Jekuto Link to comment Share on other sites More sharing options...
JohnOne Posted January 20, 2014 Share Posted January 20, 2014 Can we clear something up? You've been using scripts for 6 weeks, have you tried absolutely anything at all regarding this project, and if so, please show it? AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Jekuto Posted January 20, 2014 Author Share Posted January 20, 2014 (edited) This is the closest ive gotten on my own so far.let me know if i need to Edit this post and Comment on a line. expandcollapse popupHotKeySet("^!x", "MyExit") ; Use When Leaving Computer Idle Exit Command is [Ctrl]+[Alt]+[X] While 1 ;;;If PixelGetColor(390, 237) and PixelGetColor(1031, 351) and PixelGetColor(450, 671) and PixelGetColor(848, 535) and PixelGetColor(1031, 351) are all same for 30 seconds Then ;;;Send({F11}) ;;;Sleep(1500) ;;;MouseClick("Left", 1194, 754, 1 , 1) ;;;Sleep(1500) ;;;MouseClick("Left", 1224, 620, 1 , 1) ;;;Sleep(1500) ;;;MouseClick("Left", 1115, 469, 1 , 1) ;;;End If PixelGetColor(862, 107) = "0x868686" And PixelGetColor(896, 107) = "0x343434" And PixelGetColor(932, 107) = "0xF5F5F5" Then MouseClick("Left", 896, 107, 1, 1) Sleep(2000) MouseClick("Left", 408, 304, 1, 1) Send("MyEmail@gmail.com") Sleep(2000) MouseClick("Left", 412, 361, 1, 1) Send("Warhammer1") Sleep(2000) MouseClick("Left", 461, 410, 1, 1) Sleep(2000) MouseClick("Left", 702, 465, 1, 1) Sleep(2000) EndIf If PixelGetColor(50, 75) = "0xFFFFFF" And PixelGetColor(975, 75) = "0xFFFFFF" And PixelGetColor(50, 555) = "0xFFFFFF" And PixelGetColor(975, 555) = "0xFFFFFF" Then MouseClick("Left", 60, 620 ,1 , 1) Sleep(5000) EndIf If PixelGetColor(1008, 109) = "0xFFFFFF" And PixelGetColor(1008, 132) = "0x000000" Then MouseClick("Left", 1008, 109, 1 , 1) Sleep(5000) EndIf WEnd Func MyExit() Exit EndFunc Edited January 20, 2014 by Melba23 Email address redacted and code tags added Link to comment Share on other sites More sharing options...
jchd Posted January 20, 2014 Share Posted January 20, 2014 Masquerade the mail address... This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt) Link to comment Share on other sites More sharing options...
Jekuto Posted January 22, 2014 Author Share Posted January 22, 2014 Heck if anyone could just write a script for me that will tell me when 5 x,y locations have had the same pixel for 30 seconds and then perform a series of clicks then that would be great... Like i said any help would be helpful Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 22, 2014 Moderators Share Posted January 22, 2014 Jekuto, if anyone could just write a script for meWe do not work like that here - we help you get your scripts running correctly. Think of the old saying: "Give a man a fish, you feed him for a day; give a man a net and you feed him forever". We try to be net makers and repairers, not fishmongers. M23 mLipok 1 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Jekuto Posted January 22, 2014 Author Share Posted January 22, 2014 Well i asked for help and one guy offered to help then bailed and said its too complicated to explain then another was just simply acting like a jack ass... i mean seriously the only reason i turn to forums is because I always like to give forums a try... 9-10 times tho so called developers and moderaters are more likely to help my grandmother open a pickle jar then what i ask on a related forum.... so if thats how you operate to then thats fine but dont for a second try to get onto me when i wasnt the one who said he would write a script for me. So how bout before you get onto the new guy you do your job better and get onto the guy that posted it first in a forum... or get a new job. Basically what it boils down to is if youre going to comment make yourself useful. dont be a jackass. Link to comment Share on other sites More sharing options...
michaelslamet Posted January 22, 2014 Share Posted January 22, 2014 Well i asked for help and one guy offered to help then bailed and said its too complicated to explain then another was just simply acting like a jack ass... i mean seriously the only reason i turn to forums is because I always like to give forums a try... 9-10 times tho so called developers and moderaters are more likely to help my grandmother open a pickle jar then what i ask on a related forum.... so if thats how you operate to then thats fine but dont for a second try to get onto me when i wasnt the one who said he would write a script for me. So how bout before you get onto the new guy you do your job better and get onto the guy that posted it first in a forum... or get a new job. Basically what it boils down to is if youre going to comment make yourself useful. dont be a jackass. I'm sorry to hear your experience here. Fortunetely, this is not most new members feel, including me. Me myself have been helped a lot by moderator and senior members here and now I'm trying (with my limited knowledge and experience) to help new members as much as I can. I think one of the most important thing is attitude. So behave. Anyway, I wonder who actually need who? Jekuto 1 Link to comment Share on other sites More sharing options...
JohnOne Posted January 22, 2014 Share Posted January 22, 2014 Forgot about this after asking you to post your efforts, sorry. Something like this you're after, look at what's going on and it will make sense then for you to adapt. expandcollapse popup$Timer = TimerInit() $ConditionColourMet = 0 $ConditionTimerOneMet = 0 While 1 ;Other stuff in your main loop If _ArePixelTheRightColour() Then $ConditionColourMet = 1 Else $ConditionColourMet = 0 $Timer = TimerInit() EndIf If $ConditionColourMet And TimerDiff($Timer) > (30 * 1000) Then _Do_Whatever() EndIf WEnd Func _ArePixelTheRightColour() If PixelGetColor(10, 10) <> 0xFFFFFF Then Return 0 EndIf If PixelGetColor(10, 10) <> 0xFFFFFF Then Return 0 EndIf If PixelGetColor(10, 10) <> 0xFFFFFF Then Return 0 EndIf If PixelGetColor(10, 10) <> 0xFFFFFF Then Return 0 EndIf If PixelGetColor(10, 10) <> 0xFFFFFF Then Return 0 EndIf If PixelGetColor(10, 10) <> 0xFFFFFF Then Return 0 EndIf Return 1 ; I'm sure you can add coordinates and colours EndFunc ;==>_ArePixelTheRightColour Func _Do_Whatever() MsgBox(0, 0, "Doing Whatever") ;reset timer if needed EndFunc ;==>_Do_Whatever AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Jekuto Posted January 22, 2014 Author Share Posted January 22, 2014 TYVM ill figure out what it all means and how to use it... like i said a little help is insanely appreciated. Link to comment Share on other sites More sharing options...
JohnOne Posted January 22, 2014 Share Posted January 22, 2014 By the way, which one was I? the bailer or the jackass? AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
michaelslamet Posted January 22, 2014 Share Posted January 22, 2014 Jekuto, JohnOne usually doesn't post code. This must be your lucky day Link to comment Share on other sites More sharing options...
michaelslamet Posted January 22, 2014 Share Posted January 22, 2014 By the way, which one was I? the bailer or the jackass? You're the both Link to comment Share on other sites More sharing options...
JohnOne Posted January 22, 2014 Share Posted January 22, 2014 (edited) Jekuto,JohnOne usually doesn't post code. This must be your lucky day How very very dare you I have my protocols for when I post example code, and this good fellow met it, I just plain forgot, lol.EDIT:You're the both tru dat! Edited January 22, 2014 by JohnOne AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Recommended Posts