ashraful089 Posted August 28, 2022 Posted August 28, 2022 Do Local $Startech = _ImageSearch('StarTech_Image_1920\Startech.png', 1, $Startech_X, $Startech_Y, 100) If $Startech = 1 Then MouseMove($Startech_X, $Startech_Y, 2) MouseClick("left", $Startech_X, $Startech_Y, 1) sleep($SleepNormal) $Image = $Image + 1 Else ;Send("{ESC}")) sleep($SleepFast) MsgBox($MB_SYSTEMMODAL, "Title", "Exit Not Found ", 1) $Image_Dowhile_Loop_Break = $Image_Dowhile_Loop_Break + 1 If $Image_Dowhile_Loop_Break = 5 Then $Image_Dowhile_Loop_Break = 0 ;MsgBox(0, "Selection" , $Image_Dowhile_Loop_Break & @CRLF & $Image_Dowhile_Loop_Break) $Image = $Image + 1 MsgBox(0, "Selection" , $Image_Dowhile_Loop_Break & @CRLF & $Image) Else Sleep(100) EndIf EndIf Until $Startech = 1 Or $Image_Dowhile_Loop_Break =5 On top of the post the do while will break when image will not found of its 5th step. it breaks but i want to use the $Image_Dowhile_Loop_Break variable in next case. so i need to reset the value to 0, but when i am doing it is looping in the case 1. can anyone help me to get the correct one. i realized i am doing some mistake expandcollapse popup#include <AutoItConstants.au3> #include <ButtonConstants.au3> #include <ComboConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <MsgBoxConstants.au3> #include "ImageSearch.au3" AutoItSetOption('MouseCoordMode', 0) HotKeySet("/", "StarTech") HotKeySet("`", "_Terminate") Global $SleepFast = 500, $SleepNormal = 1000, $Sleepsec =1000, $Sec = 1000, $Min = 60000, $Hour = 360000 Local $Startech, $Startech_X, $Startech_Y Local $NO_ExitX, $NO_ExitY, $Image =1, $Image_Dowhile_Loop_Break =0 While 1 StarTech() WEnd Func StarTech() Switch $Image Case 1 sleep(100) Do Local $Startech = _ImageSearch('StarTech_Image_1920\Startech.png', 1, $Startech_X, $Startech_Y, 100) If $Startech = 1 Then MouseMove($Startech_X, $Startech_Y, 2) MouseClick("left", $Startech_X, $Startech_Y, 1) sleep($SleepNormal) $Image = $Image + 1 Else ;Send("{ESC}")) sleep($SleepFast) MsgBox($MB_SYSTEMMODAL, "Title", "Exit Not Found ", 1) $Image_Dowhile_Loop_Break = $Image_Dowhile_Loop_Break + 1 If $Image_Dowhile_Loop_Break = 5 Then $Image_Dowhile_Loop_Break = 0 ;MsgBox(0, "Selection" , $Image_Dowhile_Loop_Break & @CRLF & $Image_Dowhile_Loop_Break) $Image = $Image + 1 MsgBox(0, "Selection" , $Image_Dowhile_Loop_Break & @CRLF & $Image) Else Sleep(100) EndIf EndIf Until $Startech = 1 Or $Image_Dowhile_Loop_Break =5 Case 2 MsgBox($MB_SYSTEMMODAL, "Title", "Case 2 Running", 2) $Image = $Image + 1 Case 3 MsgBox($MB_SYSTEMMODAL, "Title", "Case 3 Running", 2) $Image_Dowhile_Loop_Break = $Image_Dowhile_Loop_Break + 1 If $Image_Dowhile_Loop_Break = 5 Then ;$Image_Dowhile_Loop_Break = 0 MsgBox(0, "Selection" , $Image_Dowhile_Loop_Break) Send("{`}") Else Sleep(100) MsgBox(0, "Selection" , $Image_Dowhile_Loop_Break) EndIf EndSwitch EndFunc Func _Terminate() MsgBox($MB_SYSTEMMODAL, "Info :", "Script terminated by User" & @CRLF) Exit EndFunc ;==>_Terminate
water Posted August 28, 2022 Posted August 28, 2022 Why not reset $Image_Dowhile_Loop_Break after the Do/Until loop? ashraful089 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
ashraful089 Posted August 28, 2022 Author Posted August 28, 2022 i think i got it now. i thought after increasing image value it goes to next case. many many thanks
water Posted August 28, 2022 Posted August 28, 2022 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
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