Functional Overview
This Button enables the user to extract selected archives, with the option to delete the archives after extraction. Thereby it will create a target subfolder if the archive contains not only a single folder on the first level.
- It supports all the archive types that DOPUS supports.
- The button remains disabled unless the user select at least one archive file.
- The button will create target subfolders for the cases where the archive contains more than one folder on the first level.
- The user can choose in dual display mode if the archive(s) shall be extracted to the source or destination pane, with options for deleting the original archive(s) and handling the case where the target folder already exists.
- In single display mode the Button automatically renames an existing target folder and prompts the user to keep or delete the original archive after extraction.
- The button script checks if an archive is encrypted or the extraction failed and will not automatically delete such archives although the "delete all archives" or "Yes for all" option was chosen in the dialog boxes.
- Limitation: The script will not recognize the failed extraction if you skip/cancel a password dialog box or enter the wrong password.
- Accordingly the text file mentioned in the next bullet point will not list encrypted archives where the extraction failed.
- When at least one target folder did already exist or the user selected also non-archive items or the extraction of at least one archive failed or at least one archive was encrypted, but not deleted (although "delete all archives" or "yes for all" was chosen) a text file with information about that is created in a temporary folder and opened automatically. This text file will be deleted after 10 minutes (earliest).
Explanation regarding subfolder creation
If the archive file contains only one folder on the first level
Root
└─ archive.zip
    └─ single folder
the button script will extract the archive directly under the root folder:
Root
├─ single folder
└─ archive.zip
    └─ single folder
But if the archive file contains several items on the first level
Root
└─ archive.zip
    ├─ folder 1
    ├─ folder 2
    └─ readme.txt
the Button script will create a new folder named after the archive and extract the archive into this new folder:
Root
├─ archive
 |    ├─ folder 1
 |    ├─ folder 2
 |    └─ readme.txt
└─ archive.zip
    ├─ folder 1
    ├─ folder 2
    └─ readme.txt
Included language overlays
- English
- German
- French
How to Install
-
Simply drag and drop the dcf file onto an appropriate toolbar. See also How to use buttons and scripts from this forum
-
If your display language is not set to English: Open the customize mode and edit the button. Change in the scriptcode tab in the first line the file type name “Archives” to the display name of this file type group of your display language. Additionally, you can rename the Button like you want.
How to change the default behavior
-
If you want to change the default setting (pre-selection) for dual display mode and the case, that a target folder already exist you have to change the numerical value in the script line
Dlg.Control("combo1").SelectItem(0);
(currently row 57) to one of the values mentioned above this line. -
If you want to change the default setting (pre-selection) of the archive-deletion for dual display mode you must change this via the dialog editor for the dialog “destination” (or directly in the code).
-
The default setting regarding handling of existing target folders for single display mode can only be changed directly in the code via rewriting/copy the wanted behavior from the dual display section.
How to Use
Available options for the case that a target folder already exists (only dual display mode)
-
Rename the old folder (default / pre-selected)
The existing folder will be renamed and afterwards the archive will be extracted into a new created folder -
Replace the old folder
The existing folder will be deleted to the recycle bin (at least if you did not change the global setting that the recycle bin will not be used) and afterwards the archive will be extracted into a new created folder -
Skip the archive
The archive that has the same name as an already existing folder will be skipped. This archive will not be deleted no matter which delete-option was chosen in any dialog. -
Skip same-named files
The archive will be extracted into the already existing folder and when there is a conflict due to same-named files the old file will be kept. -
Replace same-named files
The archive will be extracted into the already existing folder and when there is a conflict due to same-named files the old file will be overwritten.
-
Choose the archives you want to have extracted
-
Dual display mode:
- Choose an option for the case where a target folder already exists
- Choose a delete option (the default selection is “delete all archives”)
- Choose to extract the archives to the source or destination pane.
Single display mode:
The script directly extracts the archives to the source pane. If a target folder already exists it will rename the existing folder before extraction.
-
When you have chosen in dual display mode “Delete-prompt for each archive” or you are using the single display mode a dialog box will be displayed which offers the option to delete the currently processed archive:
-
If you have selected not only archives, but also non-archive items, a target folder did already exist, the extraction of at least one archive failed or/and at least one archive was encrypted, but not deleted (although "delete all archives" or "yes for all" was chosen) a text file with information about that is created and opened. (This text file will be deleted after 10 minutes (earliest).)
Credits
I adapted this Button from freds “Smart Archive Extraction”. See Smart archive extraction
A big thank you to @fred.
Based on a user request for a function that the archive are deleted after extraction I started to change the script and then developed it further. So I created a new topic after alignment with fred.
Thanks to @onedot3 for testing the button script a lot.
Thanks to @khalidhosain for the hint regarding the deletion of archives although the extraction failed or the archives are encrypted (but not successfully extracted).
Further Development
Please share any problems or ideas that could improve this Button.
Button Download
Warning : Only for DOpus v12.22 and higher.
V1.0.223
Extract.dcf (37.4 KB)
V1.0.224
Extract.dcf (37.2 KB)
- Corrections for the French localisation
V1.0.525b (not fully tested, but should work correctly)
Extract.dcf (39.8 KB)
- Encrypted archives and archives were the extraction fails will never be deleted
V1.1.531
Extract.dcf (44.5 KB)
- The script checks if the archive is encrypted
- The script checks if the encryption was successfull (but will not recognize the failed extraction if a password dialog box is skipped/canceled.)
- Archives which are encrypted or where the extraction failed will not be deleted if "delete all archives" or "yes for all" in the dialog boxes were chosen.
- The last dialog box, which informed about changed folders or skipped items is replaced by a txt file, which is created in a temporary folder and automatically deleted after 10 minutes (earliest).
- This text file is only created when an item was not an archive, existing target folders were changed, an extraction failed or an archive was encrypted, but not deleted (and "delete all" was chosen).