Kjello Posted March 10, 2009 Share Posted March 10, 2009 (edited) When i take the other while thing off, the other one will work and vice versa, but when i put them both there like this: While 1 If PixelGetColor(492,16) = 0xF7EFBD Then $bot = 0 sleep (50) Else $bot = 1 sleep (50) EndIf Wend while $bot = 1 sleep(5) $coord = PixelSearch(0, 84, 800, 500, 0xFFFFFF) If @error Then Else sleep(5) MouseMove($coord[0],$coord[1],0) MouseClick("left",$coord[0],$coord[1],1) EndIf wend then, neither of them will work at all. No errors, the script runs but does nothing. Is this just a basic thing what should i do? :S (it's first time i write a script) Edited March 10, 2009 by Kjello Link to comment Share on other sites More sharing options...
FireFox Posted March 10, 2009 Share Posted March 10, 2009 (edited) @kjello Welcome to AutoIt forums Create a function to call when needed While 1 If Not PixelGetColor(492,16) = 0xF7EFBD Then _Bot() sleep(50) Wend Func _Bot() sleep(10) $coord = PixelSearch(0, 84, 800, 500, 0xFFFFFF) If Not @error Then sleep(10) MouseMove($coord[0],$coord[1],0) MouseClick("left",$coord[0],$coord[1],1) EndIf EndFunc Not also that sleeping lower than 10milisec will be different and not preferable to be used Cheers, FireFox. Edited March 10, 2009 by FireFox Link to comment Share on other sites More sharing options...
Kjello Posted March 10, 2009 Author Share Posted March 10, 2009 Thank you, but it still doesn't work! :S Here's the full script HotKeySet ( "{ESC}", "Terminate" ) sleep (5000) While 1 If Not PixelGetColor(492,16) = 0xF7EFBD Then _Bot() sleep(50) Wend Func _Bot() sleep(10) $coord = PixelSearch(0, 84, 800, 500, 0xFFFFFF) If Not @error Then sleep(10) MouseMove($coord[0],$coord[1],0) MouseClick("left",$coord[0],$coord[1],1) EndIf EndFunc Func Terminate () Exit 0 EndFunc Seriously WTF i even tested this with message boxes and nothing pops up. The pixel color and position is fine though. If this is some kind of a bug, tell me does autoit do this often?? Link to comment Share on other sites More sharing options...
spudw2k Posted March 10, 2009 Share Posted March 10, 2009 If this is some kind of a bug, tell me does autoit do this often??I seriously doubt it's a bug. Make sure you're logic IS correct.if pixelgetcolor at x,y does not equal a light yellow color then search for whitespace, move to it and click. Is that what you're trying to accomplish in layman's terms? Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX BuilderMisc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retreive SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose ArrayProjects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalcCool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF Link to comment Share on other sites More sharing options...
Kjello Posted March 10, 2009 Author Share Posted March 10, 2009 (edited) I seriously doubt it's a bug. Make sure you're logic IS correct. if pixelgetcolor at x,y does not equal a light yellow color then search for whitespace, move to it and click. Is that what you're trying to accomplish in layman's terms?Yes. :S And when it DOES equal that light yellow colour, don't do anything. I figured out even this doesn't work While 1 If Not PixelGetColor(492,16) = 0xF7EFBD Then _Bot() sleep(50) Wend Func _Bot () MsgBox (10, "asd", "asd") EndFunc I get no message box. Even though i'm 100% sure the pixel isn't that colour at the moment. Ty for fast answers now i need more answers.. btw this is incredibly annoying... -.- Could someone try this on their own? You don't even need the yellow pixel cause it's If Not. Just run this and look if u get message boxes. Edited March 10, 2009 by Kjello Link to comment Share on other sites More sharing options...
Kjello Posted March 10, 2009 Author Share Posted March 10, 2009 Ok now i tested it with other computer as exe (didn't work), i think i'll report this bug. This is fucking strange i thought this was not beta... Link to comment Share on other sites More sharing options...
SpookMeister Posted March 10, 2009 Share Posted March 10, 2009 (edited) Test your values with something like this: HotKeySet("{ESC}", "_Terminate") HotKeySet("{Pause}", "_Pause") While 1 Sleep(100) ; usually a good idea to put this in so you dont max your cpu $var = PixelGetColor(492, 16) ToolTip("The hex color at 492,16 is" & Hex($var, 6)) WEnd Func _Terminate() Exit 0 EndFunc ;==>_Terminate Func _Pause() If Not IsDeclared("isPaused") Then Global $isPaused = False $isPaused = Not $isPaused While $isPaused Sleep(100) WEnd EndFunc ;==>_Pause edit - typo in code Edited March 10, 2009 by SpookMeister [u]Helpful tips:[/u]If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.[u]Useful links:[/u]BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE[quote]<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers[/quote] Link to comment Share on other sites More sharing options...
Kjello Posted March 10, 2009 Author Share Posted March 10, 2009 (edited) Test your values with something like this: HotKeySet("{ESC}", "_Terminate") HotKeySet("{Pause}", "_Pause") While 1 Sleep(100) ; usually a good idea to put this in so you dont max your cpu $var = PixelGetColor(492, 16) ToolTip("The hex color at 492,16 is" & Hex($var, 6)) WEnd Func _Terminate() Exit 0 EndFunc ;==>_Terminate Func _Pause() If Not IsDeclared("isPaused") Then Global $isPaused = False $isPaused = Not $isPaused While $isPaused Sleep(100) WEnd EndFunc ;==>_Pause edit - typo in codeIs this code supposed to do anything? Cause for me it doesn't Something must be totally wrong. Edit: Oh sorry lol it does work. No the value was NOT F7EFBD, so the code SHOULD work because my code is supposed to check if the color is not F7EFBD. So this must be a bug an di already reported it. Tell me when this gets fixed and then i will start working on my bot again Edited March 10, 2009 by Kjello Link to comment Share on other sites More sharing options...
SpookMeister Posted March 10, 2009 Share Posted March 10, 2009 The tooltip should be showing you the color value that you want to base your IF statement on. (if you tried with a copy of the code before I fixed it you might want to try again. [u]Helpful tips:[/u]If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.[u]Useful links:[/u]BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE[quote]<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers[/quote] Link to comment Share on other sites More sharing options...
spudw2k Posted March 10, 2009 Share Posted March 10, 2009 (edited) Try the Not Equal operator instead. If PixelGetColor(492,16) <> 0xF7EFBD Then _Bot() Edited March 10, 2009 by spudw2k Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX BuilderMisc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retreive SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose ArrayProjects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalcCool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF Link to comment Share on other sites More sharing options...
Kjello Posted March 11, 2009 Author Share Posted March 11, 2009 Try the Not Equal operator instead. If PixelGetColor(492,16) <> 0xF7EFBD Then _Bot()Not working This is the answer from bug track system: No bug, just bad coding. Use the forum for coding support. Jos And WTF is wrong with the code?? Does AutoHotkey have pixel functions? Or any other macro program? I need this! Fuck AutoIt... Link to comment Share on other sites More sharing options...
trancexx Posted March 11, 2009 Share Posted March 11, 2009 Ignorance is a blessing ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
Kjello Posted March 11, 2009 Author Share Posted March 11, 2009 Ignorance is a blessingI must not be very ignorant because no one else has been able to solve this yet either. Not even you! Link to comment Share on other sites More sharing options...
Bert Posted March 11, 2009 Share Posted March 11, 2009 You are not doing this right. You have to have the mindset that computers are stupid. They only do what you tell them. First, CALM DOWN. Your life will not end just because you haven't figured out the issue. Coding is an art. And a dark art at that. Second, you have not spelled out what window you want to check for the pixel. Do you want to search the window, client, or screen? I will assume the screen. Third, your logic was not correct. I fixed it and tested the thing. Works fine for me. In my testing, I put in my color value for $color and values for $x and $y. I checked to see if I could get the mouse to move when the pixel was not there, and the script worked as expected. Now, I changed it so it will now work for you as you asked for it. Opt("PixelCoordMode", 1) ;screen Opt("MouseCoordMode", 1) ;screen HotKeySet ( "{ESC}", "Terminate" ) sleep (5000) ;why is this here? could you use WinWaitActive instead? $x = 492 $v = 16 $color = 0xF7EFBD While 1 $getcolor = PixelGetColor($x,$v) If $getcolor <> $color Then _Bot() else sleep(50) endif Wend Func _Bot() $left = 0 $top = 84 $right = 800 $bottom = 500 $color1 = 0xFFFFFF $coord = PixelSearch($left, $top, $right, $bottom, $color) If Not @error Then MouseMove($coord[0],$coord[1],0) sleep(100) MouseClick("left",$coord[0],$coord[1],1) EndIf EndFunc Func Terminate() Exit 0 EndFunc The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
Bert Posted March 11, 2009 Share Posted March 11, 2009 I must not be very ignorant because no one else has been able to solve this yet either. Not even you!Now for your attitude - you need to dial it back a bit. Acting like a ungrateful jerk when others are trying to help will get you into trouble with the moderator. CHILL. The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
TerarinK Posted March 11, 2009 Share Posted March 11, 2009 I must not be very ignorant because no one else has been able to solve this yet either. Not even you! Now, what I see is a person that just comes onto the forum for the first time trying to explain what he is doing, but you fail to explain what is it for first off. Your trying to find a color if found set the bot to false else set to true. Now, problem number one comes up you have no exit from the loop and you should have a NOT in there only declaring one which would be true because that is the only thing your looking for. The second while is if the bot is true then search a grid for FFFFFF. This is problematic due to the Else and in there onto top of the @error. This to can be rememdy by the NOT If Not @error ThenoÝ÷ Ø òÁ¬¬Ê£ºËgyçm Ê.±à¥ÉºÛh«"·¥j/zØ^¬zÚ-éhq«b¢|¨¹×ªÞv)ñjwrjëh×6While 1 If Not PixelGetColor(492, 16) = 0xF7EFBD Then _Bot Sleep(100) WEnd Func _Bot() While 1 $aCoord = PixelSearch(0, 84, 800, 500, 0xFFFFFF) If Not @error Then MouseClick("left", $aCoord[0], $aCoord[1]) ExitLoop EndIf WEnd EndFunc ;==>_Bot Now as what do you want out of this? I'm using your script from the beginning and thats it any error would not be because of us, but you as you had place a NOT in the wrong position, if you have any problems, you should try to remove a NOT and testing it. I would like to know the name of the process so I can put that into the equation because I believe you are setting it to execute right off from the start and you expect it to complete in another window. 0x576520616C6C206469652C206C697665206C69666520617320696620796F75207765726520696E20746865206C617374207365636F6E642E Link to comment Share on other sites More sharing options...
spudw2k Posted March 11, 2009 Share Posted March 11, 2009 Now for your attitude - you need to dial it back a bit. Acting like a ungrateful jerk when others are trying to help will get you into trouble with the moderator. CHILL.Seriously, as if it couldn't possibly be the coder's fault. It must be the language. That's just silly. I blame user error. Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX BuilderMisc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retreive SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose ArrayProjects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalcCool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF Link to comment Share on other sites More sharing options...
Kjello Posted March 12, 2009 Author Share Posted March 12, 2009 (edited) You are not doing this right. You have to have the mindset that computers are stupid. They only do what you tell them. First, CALM DOWN. Your life will not end just because you haven't figured out the issue. Coding is an art. And a dark art at that. Second, you have not spelled out what window you want to check for the pixel. Do you want to search the window, client, or screen? I will assume the screen. Third, your logic was not correct. I fixed it and tested the thing. Works fine for me. In my testing, I put in my color value for $color and values for $x and $y. I checked to see if I could get the mouse to move when the pixel was not there, and the script worked as expected. Now, I changed it so it will now work for you as you asked for it. Opt("PixelCoordMode", 1) ;screen Opt("MouseCoordMode", 1) ;screen HotKeySet ( "{ESC}", "Terminate" ) sleep (5000) ;why is this here? could you use WinWaitActive instead? $x = 492 $v = 16 $color = 0xF7EFBD While 1 $getcolor = PixelGetColor($x,$v) If $getcolor <> $color Then _Bot() else sleep(50) endif Wend Func _Bot() $left = 0 $top = 84 $right = 800 $bottom = 500 $color1 = 0xFFFFFF $coord = PixelSearch($left, $top, $right, $bottom, $color) If Not @error Then MouseMove($coord[0],$coord[1],0) sleep(100) MouseClick("left",$coord[0],$coord[1],1) EndIf EndFunc Func Terminate() Exit 0 EndFuncƒoÝŠ÷ Ûú®¢×ªº‹^©ž Now as what do you want out of this? I'm using your script from the beginning and thats it any error would not be because of us, but you as you had place a NOT in the wrong position, if you have any problems, you should try to remove a NOT and testing it. I would like to know the name of the process so I can put that into the equation because I believe you are setting it to execute right off from the start and you expect it to complete in another window.But not even this works for me :S Just nothing happens... Here's what i want to do: In a full screen 800x600 window ("SRO_Client"), click on white pixels when the pixel 492, 16 is not #F7EFBD Edit: Ok it works now u just frogot to put $color1 in the _Bot function (it was only $color) so it kept searching yellow pixels instead of white. Thank you Edited March 12, 2009 by Kjello 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