PilotPen Posted August 16, 2019 Share Posted August 16, 2019 Global $ArrayCacat[7] = [46,47,51,53,54,57,58] if $noID == $ArrayCacat Then $noID = $noID + 1 MsgBox( 64,'Check','Value of noID : ' & $noID I want to add 1 to $noID value if its contain 46,47,51,53,54,57,58. But it doesn't work. Link to comment Share on other sites More sharing options...
water Posted August 16, 2019 Share Posted August 16, 2019 (edited) AutoIt doesn't work the way you are using it == is a string comparison operator. It does a strict compare (case sensitive). You compare numbers. So you need to use =. You have to loop through an array to compare $noID with each element of the array. In your special case you have to decide how your script should deal with consecutive numbers. Should the script exit the loop after the first hit or process each element so $noID might get incremented by 1 or 2 ($noID starts with 46, adds 1 when comapred with 46 and another 1 when compared with 47). Example: Global $iArrayCacat[] = [46,47,51,53,54,57,58] For $i = o to UBound($iArrayCacat) - 1 If $noID = $iArrayCacat($i) Then $noID = $noID + 1 ExitLoop ; Stops comparison after the first hit. EndIf Next MsgBox(64,'Check','Value of noID : ' & $noID) Edited August 16, 2019 by water PilotPen 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...
FrancescoDiMuro Posted August 16, 2019 Share Posted August 16, 2019 (edited) 20 minutes ago, water said: $iArrayCacat($i) should be $iArrayCacat[$i] and For $i = o to UBound($iArrayCacat) - 1 should be For $i = 0 To UBound($iArrayCacat) - 1 Edited August 16, 2019 by FrancescoDiMuro PilotPen 1 Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette Link to comment Share on other sites More sharing options...
water Posted August 16, 2019 Share Posted August 16, 2019 Correct 👍😃 FrancescoDiMuro 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...
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