Trixie Posted February 19, 2013 Share Posted February 19, 2013 (edited) Here is my code, I'll try and explain it. I have 3 different windows that can come up. One with none of the variables listed. Another with all of them listed. And another with all of them but one listed. It's with them all listed but one i'm having a problem with. The macro repeasts the action over and over. Please don't flame me because i'm a complete noob. But i am learning and would love any help given. Thank you $Variable1 = PixelSearch(269,673,272,673, 0x224045) $Variable2 = PixelSearch(269,732,272,732, 0xDD7C36) $Variable3 = PixelSearch(434,673,436,673, 0xC59A49) $Variable4 = PixelSearch(434,732,436,732, 0xC9919A) $Var = PixelSearch(500,307,500,307, 0xAFF200) ;To explain All Variables even Var appear when i want the macro to work. At all other times the variable colors are not on the screen. But $Var is the wild card. Sometimes it's there and sometimes it's not. So i want to click the screen in a certain way when its there. And when it's not i want the screen clicked another way to get rid of the window. My problem is that the last function ( If IsArray($Var) = False And IsArray($Variable1) = True Then) Doesn't work. It just repeats over and over once it works once. HotkeySet ("{F2}", "Stop") HotkeySet ("{F1}", "Start") Func Start () $i=1 While $i<3600001 If IsArray($Variable1) And IsArray($Variable2) And IsArray($Variable3) And IsArray($Variable4) = True Then ;In this when my variables are all seen it sends a space Send("{SPACE}") EndIf If IsArray($Var) And IsArray($Variable1) = True Then ;When var and variable 1 are seen it clicks the screen Sleep(800) MouseClick("left", 272, 732, 10) Sleep(800) MouseClick("left", 266, 640, 10) Sleep(800) MouseClick("left", 266, 640, 10) EndIf If IsArray($Var) = False And IsArray($Variable1) = True Then ;When Var isn't there but variable1 is then it clicks the screen in a different place. (This is my problem) Sleep(800) MouseClick("left", 436, 732, 10) Sleep(800) WEnd EndFunc While (1) Sleep (1) WEnd Edited February 19, 2013 by Namm Link to comment Share on other sites More sharing options...
Trixie Posted February 20, 2013 Author Share Posted February 20, 2013 *Bump* Can someone please help it's for a class project. I have to interact with a VB window that has no user id, and not a lot of info under control when i use the window info tool. So i was using pixelsearch because every button has a color. My problem is like i said If IsArray($Var) = False And IsArray($Variable1) = True Then Link to comment Share on other sites More sharing options...
BrewManNH Posted February 20, 2013 Share Posted February 20, 2013 You're only doing the PixelSearch once, before it enters the Function, so the values never change. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator 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