DigDeep Posted July 24, 2017 Posted July 24, 2017 (edited) Hi @ivan Your _CabExtract.au3 is great to work on. However, I am facing some issues setting up the error codes. It is not always but I found on few cases I am getting only the error as Case 2, even though the Directory, .CAB file, the extracted directory and the extracted files are all present. I never get any of the other case errors. Have I set the @Error in correctly here? #include <_CabExtract.au3> _CabExtract('Test.cab', 'C:\Temp', 'C:\Temp') Switch @error Case 1 MsgBox(0, 'Error 1', 'Object creation failure.') Exit Case 2 MsgBox(0, 'Error 2', 'Directory not found.') Exit Case 3 MsgBox(0, 'Error 3', 'File extraction directory not found.') Exit Case 4 MsgBox(0, 'Error 4', 'Cab File empty.') Exit EndSwitch I believe you have set 6 error codes. Could you please specify the 6 cases? Edited July 24, 2017 by DigDeep
water Posted July 24, 2017 Posted July 24, 2017 If you are talking about this UDF then the functions set @error to values of 1 or 2 and @extended to values of 1 to 6. 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
DigDeep Posted July 24, 2017 Author Posted July 24, 2017 thanks @water Yeah, I checked earlier and observed that the errors were extended 1 to 6 but not sure why do I get error for Case 2 sometimes... even though the path, directory, .cab file and extracted files are all created.
water Posted July 24, 2017 Posted July 24, 2017 What I understand from the above mentioned UDF: Means that the expand command returned an error. 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
DigDeep Posted July 25, 2017 Author Posted July 25, 2017 So, to check out I deleted the Switch @error and it is going smoothly now. It looks like the Case 2 was giving a false alarm even though the files and directories were existing. Who can look at the UDF for checking out the errors? We would need the error codes if the directory is not getting created, Cab files failed to extract, .CAB file failed to download, etc... If I am not wrong, below are the 6 cases expanded... Switch @error Case 1 MsgBox(0, 'Error 1', 'Object creation failure while extracting files.') ; If Not IsString($pCabPath) Then ; Exit Case 2 MsgBox(0, 'Error 2', 'Error while creating directory for extracting files.') ; If Not FileExists($pCabPath) Or Not StringInStr(FileGetAttrib($pCabPath), 'D') Then ; Exit Case 3 MsgBox(0, 'Error 3', 'Filename is not Valid.') ; If Not (_IsValidFileName($pCabFile) Or FileExists($pCabPath & '\' & $pCabFile)) Then ; Exit Case 4 MsgBox(0, 'Error 4', 'No files were found in CAB or Directory does not exist.') ; If Not FileExists($pDest) Or Not StringInStr(FileGetAttrib($pDest), 'D') Then ; Exit Case 5 ; I am not able to understand what is "$pMode" here ; If Not IsNumber($pMode) Or ($pMode < -1 And $pMode > 0) Then ; Exit Case 6 MsgBox(0, 'Error 6', 'No files were found in CAB.') ; If @error Or Not IsArray($lFileList) Then ; Exit EndSwitch
water Posted July 25, 2017 Posted July 25, 2017 Again: You are mixing @error and @extended. As I understand the code (only had a quick glance) this should be: $sTitle = "Error " & @error & ", Extended " & @extended Switch @error Case 1 Switch @extended Case 1 MsgBox(0, $sTitle, 'Object creation failure while extracting files.') Case 2 MsgBox(0, $sTitle, 'Error while creating directory for extracting files.') Case 3 MsgBox(0, $sTitle, 'Filename is not Valid.') Case 4 MsgBox(0, $sTitle, 'No files were found in CAB or Directory does not exist.') Case 5 ; I am not able to understand what is "$pMode" here ; If Not IsNumber($pMode) Or ($pMode < -1 And $pMode > 0) Then ; Exit Case 6 MsgBox(0, $sTitle, 'No files were found in CAB.') Case Else MsgBox(0, $sTitle, 'Unknown value for @extended.') EndSwitch Case 2 Switch @extended Case 1 MsgBox(0, $sTitle, '...') Case 2 MsgBox(0, $sTitle, '...') Case Else MsgBox(0, $sTitle, 'Unknown value for @extended.') EndSwitch Case Else MsgBox(0, $sTitle, 'Unknown value for @error.') EndSwitch 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