EmyJaneAlovera Posted June 4, 2021 Share Posted June 4, 2021 Hi there my name is Emy , I'm a newbie autoit user. With the help of the documentation I successfully made few scripts . Now im trying to learn more by optimizing them, I want to add timers to my loops so that if the pixel is not found within 10 seconds then exit the script. Again with the help of the documentation i came up with this below , however it does not give me any error but the timer doesn't work it will stay in the pixelsearch loop for ever. Im kinda stuck there , i tried several other things but no success either. Any help would be greatly appreciate #include <MsgBoxConstants.au3> $start = TimerInit() Do PixelSearch(971,636,977,638,0xFFFFFF) Until Not @error Or TimerDiff($start) = 10000 If TimerDiff($start) = 10000 Then MsgBox($MB_OK,"ERROR","TIMEOUT!!!",0) Exit ElseIf Not @error then EndIf MouseClick("left", Random(800,1100), Random(580,666),5,0) Link to comment Share on other sites More sharing options...
water Posted June 4, 2021 Share Posted June 4, 2021 Welcome to AutoIt and the forum! How high is the probability that TimerDiff returns exactly the value 10000? EmyJaneAlovera 1 My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
EmyJaneAlovera Posted June 4, 2021 Author Share Posted June 4, 2021 hello, and thank you for your response. i did in fact tried >= and no success either. Link to comment Share on other sites More sharing options...
JockoDundee Posted June 4, 2021 Share Posted June 4, 2021 7 minutes ago, water said: How high is the probability that TimerDiff returns exactly the value 10000? Just a little higher than the probability that it returns exactly 10000 twice, in succeeding statements Until Not @error Or TimerDiff($start) = 10000 If TimerDiff($start) = 10000 Then SkysLastChance and EmyJaneAlovera 1 1 Code hard, but don’t hard code... Link to comment Share on other sites More sharing options...
SkysLastChance Posted June 4, 2021 Share Posted June 4, 2021 I am betting you only changed one. You need to change both of them. #include <MsgBoxConstants.au3> $start = TimerInit() Do PixelSearch(971,636,977,638,0xFFFFFF) Until Not @error Or TimerDiff($start) >= 10000 If TimerDiff($start) >= 10000 Then MsgBox($MB_OK,"ERROR","TIMEOUT!!!",0) Exit ElseIf Not @error then EndIf EmyJaneAlovera 1 You miss 100% of the shots you don't take. -Wayne Gretzky -Michael Scott Link to comment Share on other sites More sharing options...
EmyJaneAlovera Posted June 4, 2021 Author Share Posted June 4, 2021 omg so simple thx you guys , good call water! 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