Teslf Posted March 13, 2021 Share Posted March 13, 2021 (edited) Func imagecheck() _OpenCV_Startup() ;loads opencv DLLs Local $sCoords3[4] = [661, 963, 751,1053] $Match25 = _MatchPicture("O:\Users\NAME\Downloads\OpenCV_Match\Snapshot-Tool\Match\32.png", 0.90, $sCoords3, 1, 0) ;Try to find the match picture on the screen. Number of tries: 10, Sleep between each try: 500ms. If Not @error Then Global $aCoord1 = $Match25[0] Global $aCoord2 = $Match25[1] GUICtrlSetData($var,"Number HERE") update() sleep(250) Do update() _MatchPicture("O:\Users\NAME\Downloads\OpenCV_Match\Snapshot-Tool\Match\32.png", 0.90, $sCoords3, 1, 0) Until @error EndIf Would you it be possible to set a Do Until Error Do update() _MatchPicture("O:\Users\NAME\Downloads\OpenCV_Match\Snapshot-Tool\Match\32.png", 0.90, $sCoords3, 1, 0) Until @error Basically this whole scripts works well but I cant leave _MatchPicture in the do until It slows down the update() basically what I want to do is this Do update() Until _MatchPicture("O:\Users\NAME\Downloads\OpenCV_Match\Snapshot-Tool\Match\32.png", 0.90, $sCoords3, 1, 0) = @error Would something like this be possible ? Edited March 13, 2021 by Teslf NAME Link to comment Share on other sites More sharing options...
Musashi Posted March 13, 2021 Share Posted March 13, 2021 8 minutes ago, Teslf said: Would something like this be possible ? Basically yes. It depends on what the _MatchPicture function returns. Provide an executable test script (and a picture) that contains the respective functions. "In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move." Link to comment Share on other sites More sharing options...
Developers Jos Posted March 13, 2021 Developers Share Posted March 13, 2021 (edited) I do not see nor understand the difference between the last and original logic you posted as they are the same and not solve anything. Also the last example doesn't make sense to me as both are returned by the UDF, so it would make much more sense to me when that UDF returns 1 or 0 and you use that in the loop statement. Jos Edited March 13, 2021 by Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Teslf Posted March 13, 2021 Author Share Posted March 13, 2021 Do update() Until _MatchPicture("O:\Users\NAME\Downloads\OpenCV_Match\Snapshot-Tool\Match\32.png", 0.90, $sCoords3, 1, 0) = @error This one above doesn't work ^. Do update() _MatchPicture("O:\Users\NAME\Downloads\OpenCV_Match\Snapshot-Tool\Match\32.png", 0.90, $sCoords3, 1, 0) Until @error This one does work correctly. I understand why but basically it gives an @error when the picture isnt found. I need it to work this way because when the image is not found It moves on but when It is found it does the function update(). All I would like to know is how would I get the top one working... without including it in the Do part. Using the @error for this function is perfect. I just don't want to include it in the Do part just for it to be the last function ran so the @error would work..... Link to comment Share on other sites More sharing options...
Developers Jos Posted March 13, 2021 Developers Share Posted March 13, 2021 (edited) Again: Why? ...what is the difference between the 2? ... And I did give the answer already: modify that UDF not to return an error. Edited March 13, 2021 by Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Teslf Posted March 13, 2021 Author Share Posted March 13, 2021 The _MatchPicture returns Mouse postions.... I need it to give an error code so when the picture isnt found in those mouse postions, It continues the script but when it does find the picture it runs update() until it doesn't find it..... I'm pretty new to all of this. I can't modify a udf right now. I would just like to know If settings this code up properly would work how I would like it to.. Do update() Until _MatchPicture("O:\Users\Taylor\Downloads\OpenCV_Match\Snapshot-Tool\Match\32.png", 0.90, $sCoords3, 1, 0) = @error This is how I would like it setup but when it can't find the image it doesn't work ^ Link to comment Share on other sites More sharing options...
Developers Jos Posted March 13, 2021 Developers Share Posted March 13, 2021 (edited) Fine, so what about the other question that you now have left unanswered for the second time? Edited March 13, 2021 by Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Teslf Posted March 13, 2021 Author Share Posted March 13, 2021 The difference between the 2?? I am not sure that's what I am kind of asking as well. I understand why one works but I don't understand why the other one doesn't. I am guessing there is a certain way it needs to be setup for it to work and that's why I am here asking Link to comment Share on other sites More sharing options...
Developers Jos Posted March 13, 2021 Developers Share Posted March 13, 2021 What is the difference between these 2 cases as you want the second one ?: ;case 1 Do _MatchPicture("O:\Users\NAME\Downloads\OpenCV_Match\Snapshot-Tool\Match\32.png", 0.90, $sCoords3, 1, 0) Until @error ;case 2 ( whgich obviously doesn;t work Do Until _MatchPicture("O:\Users\NAME\Downloads\OpenCV_Match\Snapshot-Tool\Match\32.png", 0.90, $sCoords3, 1, 0) = @error There is NO difference in case that second one would work, so explain why you need to change the working case 1? SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Teslf Posted March 13, 2021 Author Share Posted March 13, 2021 Your right! It's just not going to work how I wanted nvm! It seemed like it wasn't working at first. Sorry for wasting your time! 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