Centrally Posted January 24, 2013 Share Posted January 24, 2013 As I stumbled upon one system I wanted to automatize AutoIt sounded perfect for doing so but now I stumbled upon several problems and along with that I have several questions so here it is.This is code I wrote so far before I went into problems and had many questions.Run ( "Masked for privacy" ) $i = 0 While $i <= 10 $coord = PixelSearch(906, 579, 1067, 666, 0xA86A21) If Not @error Then MouseClick("primary", $coord[0], $coord[1], 1, 0) EndIf $i = $i + 1 Sleep(3000) WEnd $i1 = 0 While $i1 <= 10 $coord1 = PixelSearch(86, 658, 160, 706, 0xEE2E24) If Not @error Then $coord2 = (458, 311) MouseClick("primary", $coord2[0], $coord2[1], 2, 1) EndIf $i1 = $i1 + 1 Sleep(3000) WEnd Now basically when 2nd screen appear and 2nd while loop is executed it doesn't detect given pixel nor it move&click mouse to selected place after it detect that pixel. After leaving script to run for some time it gives error "NO RIGHT BRACKET".Next questions:If first while loop here find pixel in first execution (or any before 10th run) does it stop running or does it still keep looping. If it keep looping how can I stop it if pixel is found.Will 2nd while loop start executing if 1st one is not done. I mean if question before had answer that it doesn't stop looping it means 2nd script would start after 30 seconds.Is it possible to read from window bigger part than only pixel? Something like part of picture an so on, if so could you point me to such formatHow to read something from outside file (I would like to make configuration file) and save it in variable. Lets say I have .txt file with accountName:password and now I want to take only accountName out of it and save it in variable, same this with password.Can I use variables declared in other loops, I mean in this my code I used coord1 in 2nd while loop, is coord from first loop accessible by 2nd loop?__________________________________________________________________________________________________________Parts of my questions are covered in tutorials and questions already asked, but I questioned them here in way I haven't been able to understand them from Internet found references.Thanks for your time reading my topic and taking time answering my noobish questions. Link to comment Share on other sites More sharing options...
stormbreaker Posted January 24, 2013 Share Posted January 24, 2013 (edited) Now basically when 2nd screen appear and 2nd while loop is executed it doesn't detect given pixel nor it move&click mouse to selected place after it detect that pixel. After leaving script to run for some time it gives error "NO RIGHT BRACKET".Because you provide no room to get out of it... something called ExitLoopRegarding reading something from outside files, checkout help file for FileRead, FileWrite, IniRead examples etc.You can use variables declared in other loops, use Global declarations... Edited January 24, 2013 by MKISH Centrally 1 ---------------------------------------- :bye: Hey there, was I helpful? ---------------------------------------- My Current OS: Win8 PRO (64-bit); Current AutoIt Version: v3.3.8.1 Link to comment Share on other sites More sharing options...
Centrally Posted January 24, 2013 Author Share Posted January 24, 2013 I added ExitLoop [1] and now I'm getting error in expression, any more ideas? Link to comment Share on other sites More sharing options...
BrewManNH Posted January 24, 2013 Share Posted January 24, 2013 The brackets shown in the help file are to tell you that that parameter is optional, don't actually use the brackets when using the function. Plus, ExitLoop defaults to 1 so that is also unnecessary. 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...
kylomas Posted January 24, 2013 Share Posted January 24, 2013 Centrally, This stmt is wrong $coord2 = (458, 311). You probably want a pixelsearch here. kylomas Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill Link to comment Share on other sites More sharing options...
Centrally Posted January 24, 2013 Author Share Posted January 24, 2013 (edited) Centrally, This stmt is wrong $coord2 = (458, 311). You probably want a pixelsearch here. kylomas it's not wrong, I used pixelsearch just to verify correct window is open and after that I wanted to select one text field with this coordinated mouse double click. @BrewManNH I already tried it without bracket since I saw it's optimal and about it's default value but same thing over again. So my current code looks like this: Run ( "masked" ) $i = 0 While $i <= 10 $coord = PixelSearch(906, 579, 1067, 666, 0xA86A21) If Not @error Then MouseClick("primary", $coord[0], $coord[1], 1, 0) ExitLoop EndIf $i = $i + 1 Sleep(3000) WEnd $i1 = 0 While $i1 <= 10 PixelSearch(86, 658, 160, 706, 0xEE2E24) If Not @error Then $coord2 = (458, 311) MouseClick("primary", $coord2[0], $coord2[1], 2, 1) ExitLoop EndIf $i1 = $i1 + 1 Sleep(3000) WEnd And still receiving error about missing right bracked, any more ideas? Edited January 24, 2013 by Centrally Link to comment Share on other sites More sharing options...
kylomas Posted January 24, 2013 Share Posted January 24, 2013 Centrally,Are you using the full editor? The stmt I pointed out is syntactically wrong. Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 24, 2013 Moderators Share Posted January 24, 2013 Centrally,I have lifted your "New Member" 5 post restriction - you are now able to continue the discussion as long as necessary. M23 Centrally 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...
Centrally Posted January 24, 2013 Author Share Posted January 24, 2013 (edited) Centrally,Are you using the full editor? The stmt I pointed out is syntactically wrong.I see what you implying I never went over editor tut, since I saw SciTE as being basic text editor with syntax highlighting. After checking this out I found really much functions on it and after doing function called beta run it pointed me to a syntax error in line you mentioned, however I seem really hard time finding syntax for saving coordinates in variable, and I don't want to use them directly inside mouse syntax (will change entire process probably so I need var for this), thanks for answering.@Melba23Thanks for that, I was really getting afraid of running out of posts I could do Edited January 24, 2013 by Centrally Link to comment Share on other sites More sharing options...
kylomas Posted January 24, 2013 Share Posted January 24, 2013 Centrally, One possible solution Run("Masked for privacy") $i = 0 While $i <= 10 $coord = PixelSearch(906, 579, 1067, 666, 0xA86A21) If Not @error Then MouseClick("primary", $coord[0], $coord[1], 1, 0) EndIf $i = $i + 1 Sleep(3000) WEnd $i1 = 0 local $x = 458, $y = 311 While $i1 <= 10 $coord1 = PixelSearch(86, 658, 160, 706, 0xEE2E24) If Not @error Then ;$coord2 = (458, 311) MouseClick("primary", $x, $y, 2, 1) EndIf $i1 = $i1 + 1 Sleep(3000) WEnd kylomas Centrally 1 Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill Link to comment Share on other sites More sharing options...
Centrally Posted January 24, 2013 Author Share Posted January 24, 2013 Centrally, One possible solution Run("Masked for privacy") $i = 0 While $i <= 10 $coord = PixelSearch(906, 579, 1067, 666, 0xA86A21) If Not @error Then MouseClick("primary", $coord[0], $coord[1], 1, 0) EndIf $i = $i + 1 Sleep(3000) WEnd $i1 = 0 local $x = 458, $y = 311 While $i1 <= 10 $coord1 = PixelSearch(86, 658, 160, 706, 0xEE2E24) If Not @error Then ;$coord2 = (458, 311) MouseClick("primary", $x, $y, 2, 1) EndIf $i1 = $i1 + 1 Sleep(3000) WEnd kylomas We seams found solution at same time, mine is bit different and I will prolly repharse it to use array instead of var in future code. My solution is here if anyone stumble on same problem. $coordx = "458" $coordy = "311" MouseClick("primary", $coordx, $coordy, 2, 1) I want to thank you everyone for your time and assistance in resolving my problem. 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