Prestige Posted June 19, 2013 Share Posted June 19, 2013 (edited) Fine, I admit it, i'm a noob :3 Many people have been talking about Pixelsearch, Mousemove, and GUIs, so I have a few questions Heres a little code: $coord1 = PixelSearch(250,150,550,450,0xE8041F [,5[,2]]) $coord2 = PixelSearch(250,150,550,450,0xE41800 [,5[,2]]) $coord3 = PixelSearch(250,150,550,450,0x8B0625 [,5[,2]]) $coord4 = PixelSearch(250,150,550,450,0xE31A22 [,5[,2]]) Can i just say Mousemove($coord1,$coord1 [, 1]) Mousemove($coord2,$coord2 [, 1]) Mousemove($coord3,$coord3 [, 1]) Mousemove($coord4,$coord4 [, 1]) And it would work? o_O I'll Do GUIs laterz Edited June 19, 2013 by Marvens01 Link to comment Share on other sites More sharing options...
Xandy Posted June 19, 2013 Share Posted June 19, 2013 (edited) PixelSearch() Returns a two-element array of pixel's coordinates. (Array[0] = x, Array[1] = y). That means $coord1 has 2 parts after you make it equal PixelSearch(). $coord1[0]; x $coord1[1]; y ; x , y mousemove($coord1[0], $coord1[1]) Edited June 19, 2013 by Xandy Human Male Programmer (-_-) Xandy About (^o^) Discord - Xandy Programmer MapIt (Tile world editor, Image Tile Extractor, and Game Maker) Link to comment Share on other sites More sharing options...
Prestige Posted June 19, 2013 Author Share Posted June 19, 2013 Mousemove($coord1[0],$coord1[1] [, 1]) Mousemove($coord2[0],$coord2[1] [, 1]) Mousemove($coord3[0],$coord3[1] [, 1]) Mousemove($coord4[0],$coord4[1] [, 1]) $coord1 = PixelSearch(@DesktopWidth/2-150,@DesktopHeight/2+150,@DesktopWidth-100,@DesktopHeight-100,0xE8041F [,5[,2]]) $coord2 = PixelSearch(@DesktopWidth/2-150,@DesktopHeight/2+150,@DesktopWidth-100,@DesktopHeight-100,0xE41800 [,5[,2]]) $coord3 = PixelSearch(@DesktopWidth/2-150,@DesktopHeight/2+150,@DesktopWidth-100,@DesktopHeight-100,0x8B0625 [,5[,2]]) $coord4 = PixelSearch(@DesktopWidth/2-150,@DesktopHeight/2+150,@DesktopWidth-100,@DesktopHeight-100,0xE31A22 [,5[,2]]) So that would work? o_O Link to comment Share on other sites More sharing options...
BrewManNH Posted June 19, 2013 Share Posted June 19, 2013 First PixelSearch returns an array. Second, the bracket around the parameters in a function example are only there to show you that they're optional parameters, do NOT use the brackets. 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...
Prestige Posted June 19, 2013 Author Share Posted June 19, 2013 Cool Mousemove($coord1[0],$coord1[1] , 1) Mousemove($coord2[0],$coord2[1] , 1) Mousemove($coord3[0],$coord3[1] , 1) Mousemove($coord4[0],$coord4[1] , 1) $coord1 = PixelSearch(@DesktopWidth/2-150,@DesktopHeight/2+150,@DesktopWidth-100,@DesktopHeight-100,0xE8041F ,5,2) $coord2 = PixelSearch(@DesktopWidth/2-150,@DesktopHeight/2+150,@DesktopWidth-100,@DesktopHeight-100,0xE41800 ,5,2) $coord3 = PixelSearch(@DesktopWidth/2-150,@DesktopHeight/2+150,@DesktopWidth-100,@DesktopHeight-100,0x8B0625 ,5,2) $coord4 = PixelSearch(@DesktopWidth/2-150,@DesktopHeight/2+150,@DesktopWidth-100,@DesktopHeight-100,0xE31A22 ,5,2) This? Link to comment Share on other sites More sharing options...
BrewManNH Posted June 19, 2013 Share Posted June 19, 2013 I personally would do it like this, mainly because each of your PixelSearch commands are using the same parameters except for the color being looked for. #include <Constants.au3> Global $aColors[5] = [4, 0xE8041F, 0xE41800, 0x8B0625, 0xE31A22] For $Loop = 1 to $aColors[0] $coord = PixelSearch(@DesktopWidth / 2 - 150, @DesktopHeight / 2 + 150, @DesktopWidth - 100, @DesktopHeight - 100, $aColors[$Loop], 5, 2) If Not @error Then MouseMove($coord[0], $coord[1], 1) MsgBox($MB_SYSTEMMODAL, "Found", "Found the color") EndIf Next 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...
Prestige Posted June 19, 2013 Author Share Posted June 19, 2013 I personally would do it like this, mainly because each of your PixelSearch commands are using the same parameters except for the color being looked for. #include <Constants.au3> Global $aColors[5] = [4, 0xE8041F, 0xE41800, 0x8B0625, 0xE31A22] For $Loop = 1 to $aColors[0] $coord = PixelSearch(@DesktopWidth / 2 - 150, @DesktopHeight / 2 + 150, @DesktopWidth - 100, @DesktopHeight - 100, $aColors[$Loop], 5, 2) If Not @error Then MouseMove($coord[0], $coord[1], 1) MsgBox($MB_SYSTEMMODAL, "Found", "Found the color") EndIf Next Look Like I just got lost >.< Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted June 19, 2013 Moderators Share Posted June 19, 2013 Marvens01, did you try the code BrewManNH suggested? Are you getting an error? We need a little more, such as where you are getting lost "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...
Blue_Drache Posted June 19, 2013 Share Posted June 19, 2013 JLogan: I think I know what he's getting lost on, having experienced it before. Following the code. Perhaps a basic understanding of programming and logic flow would be in order? Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache Link to comment Share on other sites More sharing options...
Prestige Posted June 19, 2013 Author Share Posted June 19, 2013 I don't want a code, I want to learn TO code, and explanation. Link to comment Share on other sites More sharing options...
BrewManNH Posted June 19, 2013 Share Posted June 19, 2013 I don't want a code, I want to learn TO code, and explanation. Here's the same script, with comments as to what is going on. #include <Constants.au3> Global $aColors[5] = [4, 0xE8041F, 0xE41800, 0x8B0625, 0xE31A22] ; assign the 4 different colors you're looking for to an array For $Loop = 1 to $aColors[0] ; loop through the array ;Search for the color using pixel search, the color being looked for is the color code in the array $aColors{$Loop] element $coord = PixelSearch(@DesktopWidth / 2 - 150, @DesktopHeight / 2 + 150, @DesktopWidth - 100, @DesktopHeight - 100, $aColors[$Loop], 5, 2) If Not @error Then ; if the pixelsearch returns without an error, that means it found the color being looked for MouseMove($coord[0], $coord[1], 1) ; move the mouse to the coordinates that the color was found at MsgBox($MB_SYSTEMMODAL, "Found", "Found the color") ; for informational purposes only EndIf Next ; repeat the loop until we've searched for every colorIf you're having trouble understanding the whole array thing, I'd suggest this Array tutorial. 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...
Prestige Posted June 19, 2013 Author Share Posted June 19, 2013 What happens if you want to loop this without the messagebox? I really wanna learn Loop Link to comment Share on other sites More sharing options...
BrewManNH Posted June 19, 2013 Share Posted June 19, 2013 What have you tried? 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...
Prestige Posted June 19, 2013 Author Share Posted June 19, 2013 IDK loop :/ Do I just add Loop at the end??? Link to comment Share on other sites More sharing options...
BrewManNH Posted June 19, 2013 Share Posted June 19, 2013 IDK loop :/ Do I just add Loop at the end???I'd suggest opening the help file and start doing some reading on the basics.Specifically, While/Do loops or For...Next loops. 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...
Prestige Posted June 19, 2013 Author Share Posted June 19, 2013 I'd suggest opening the help file and start doing some reading on the basics. Specifically, While/Do loops or For...Next loops. O_O What? Link to comment Share on other sites More sharing options...
guinness Posted June 19, 2013 Share Posted June 19, 2013 They're the fundamentals to any programming language. Do you know about the help file? Hit F1 and search while. UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
Prestige Posted June 19, 2013 Author Share Posted June 19, 2013 Thanks Link to comment Share on other sites More sharing options...
Xandy Posted June 24, 2013 Share Posted June 24, 2013 (edited) Loops, by Joshua Songer. All loops have two parts. A beginning and an end. Some loops have a condition to exit, and some loops have an increment variable; possibly increment amount (step). example 1: while 1; 1 is true so this just loops until a exitloop is encountered by the script. ;stuff in loop wend;return to while 1 statement example 2:;count that's 9 iterations of this here loop for $i= 0 to 8 ;stuff in loop next;return to for $i statement example 3: #include <GUIConstants.au3>;defines $gui_event_close $hgui= guicreate("Window Title", 320, 200);create gui window return reference to $hgui guisetstate();this shows the damn gui do;loop begining $msg= guigetmsg();pull gui event until $msg= $gui_event_close;test for gui close event else return to do statement I hope you enjoy your programming experience. Edited June 24, 2013 by Xandy Human Male Programmer (-_-) Xandy About (^o^) Discord - Xandy Programmer MapIt (Tile world editor, Image Tile Extractor, and Game Maker) Link to comment Share on other sites More sharing options...
FireFox Posted June 24, 2013 Share Posted June 24, 2013 Hey you Xandy 1 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