Borje Posted March 17, 2018 Share Posted March 17, 2018 (edited) Hello everybody I need som ehlp with this script to have the arrayinfo in to a variable what I want is to have $aArray[$1] in to $till and I have not this to work perhaps anybody here cold help me what i must do. Local $aArray = DriveGetDrive("ALL") For $i = 1 To $aArray[0] If DriveSpaceTotal(StringUpper($aArray[$i])) < "65000" And DriveSpaceTotal(StringUpper($aArray[$i])) > "0" Then MsgBox(4096, "", "Drive " & StringUpper($aArray[$i]) & " is my thumb drive.") EndIf Next Edited March 18, 2018 by Borje Link to comment Share on other sites More sharing options...
water Posted March 17, 2018 Share Posted March 17, 2018 Local $aArray = DriveGetDrive("ALL") If @error Then Exit MsgBox(0, "Error", "DriveGetDrive returned an error!") For $i = 1 To $aArray[0] $sDriveUpper = StringUpper($aArray[$i]) $iDriveSpaceTotal = DriveSpaceTotal($sDriveUpper) If @error Then Exit MsgBox(0, "Error", "DriveSpaceTotal for " & $sDriveUpper & " returned an error!") If $iDriveSpaceTotal < 65000 And $iDriveSpaceTotal > 0 Then MsgBox(4096, "", "Drive " & $sDriveUpper & " is my thumb drive.") EndIf Next Untested, but we would at least get some error information. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
Borje Posted March 17, 2018 Author Share Posted March 17, 2018 Thanks water but that not works what I want is the info from the array into in this example $till, example if i have e: i want to have this in $till Link to comment Share on other sites More sharing options...
water Posted March 17, 2018 Share Posted March 17, 2018 $Till = StringUpper($aArray[$i]) I hope I correctly understand what you need My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
Borje Posted March 17, 2018 Author Share Posted March 17, 2018 Yes you have understand me correctly i have tested this before and I have this error: Array variable has incorrect number of subscripts or subscript dimension range exceeded.: $Till = StringUpper($aArray[$i]) $Till = StringUpper(^ ERROR So I dont know how to do to have this to works. Link to comment Share on other sites More sharing options...
water Posted March 17, 2018 Share Posted March 17, 2018 This means that $i is invalid for this array. You try to access a non existing elment. Did you post the whole script you run? My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
Borje Posted March 17, 2018 Author Share Posted March 17, 2018 Yes this is the whole script in the first post and I have same error. Link to comment Share on other sites More sharing options...
Subz Posted March 17, 2018 Share Posted March 17, 2018 (edited) You need to do this within the For <> Next loop, for example: Local $aArray = DriveGetDrive("ALL") For $i = 1 To $aArray[0] If DriveSpaceTotal(StringUpper($aArray[$i])) < "65000" And DriveSpaceTotal(StringUpper($aArray[$i])) > "0" Then $Till = StringUpper($aArray[$i]) ExitLoop EndIf Next MsgBox(4096, "", "Drive " & $Till & " is my thumb drive.") Edited March 17, 2018 by Subz Link to comment Share on other sites More sharing options...
Borje Posted March 17, 2018 Author Share Posted March 17, 2018 Thank you very much Subz i test this and it worked i have to learn from your example thanks again. Link to comment Share on other sites More sharing options...
water Posted March 17, 2018 Share Posted March 17, 2018 (edited) That's why I asked for the whole code You never used $i outside the loop in the psoted code or code snippet. Lessons learned: ALWAYS post the full code that raises the error! Edited March 17, 2018 by water My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - 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