Smart archive extraction

The first version is available for testing. It seems to work fine, but I tried only dual-lister right now.
But this is the simple one which ask for each archive if it should be deleted.
I want to improve this further.

Changes compared to original script:

  • Removed check and message for the case, that nothing is selected at all
  • Added the function that the button is disabled as long as no archive file is selected
  • Fixed the issue that the warning "Some selected files were not archives." did not appear (relevant if you select more then one file)
  • Added a dialog which asks for each archive if it should be deleted. The dialog shows the archive name
  • Added German translation (the new delete-dialog does not have Frensh translation until version v2022.02.12b)

v2022.02.12a
Extract V2.dcf (13.3 KB)

v2022.02.12b
Extract V2.dcf (13.5 KB)

  • Fix: Warning regarding selected files is shown up now.

v2022.02.14a
Extract V2.dcf (17.4 KB)

  • Added possibility to choose "yes for all" and "no for all" in the delete-dialog (so the delete-dialog will only show up once when multiple files are selected for extracting)
  • Added Frensh translation for the delete-dialog (via google translate :crazy_face: )

v2022.02.14b
Extract V2.dcf (21.1 KB)

  • added in the target lister dialog (only for dual display mode) radio buttons to choose between "delete all archives"; " delete-query for each Archive" and "delete no archive". Standard setting is "delete all archives" - can be changed via dialog editor.
    Targetlister
  • separate delete dialog is only displayed now in single display mode or when you chose "delete-query for each archive" in the target lister dialog.

.
.
Important: The @disablenosel command is language sensitive. (Would be nice if this will be fixed). So the user has to adapt the first line of the script to the display language for the Archives file group.
e.g.:
English: @disablenosel:type=grp:Archives
German: @disablenosel:type=grp:Archive

@Mosed
Have just tried out V2 tried dual and single lister both work OK for everything
Except

  • Fixed the issue that the warning "Some selected files were not archives." did not appear (relevant if you select more then one file)
    Which only displays the Some selected files were not archives when the Cancel button is pressed

@onedot3: You are right. Thank you. The warning does not appear at all according my testing now.

But I do not know why. I have a similar variant with the primary difference, that I use "Dlg.show" instead of "Dlg.RunDlg.
Do I have to add something due to Dlg.RunDlg?
The relevant variable has the value "true" directly before the dialog code, so the dialog should appear.

This button works as written regarding the warning, but does not display the item name in the delete dialog:
Extract V2a.dcf (12.9 KB)

Left the V2a, right the V2. That is the only difference in the code.

EDIT: ok, its related to the Dlg.RunDlg.

For the warning I used Dlg.Show, but I have to use also Dlg.RunDlg there.

So instead of

			if (selWarning) {
				Dlg.window = tab;
				Dlg.icon = "warning";
				Dlg.top = true;
				Dlg.template = "warning";
				Dlg.Show;
			}

It must be:

			if (selWarning) {
				Dlg.window = tab;
				Dlg.icon = "warning";
				Dlg.top = true;
				Dlg.template = "warning";
				Dlg.Create();
				var x = Dlg.RunDlg;
			}

But why? The Dlg.Create(); from the delete dialog seems to "break" Dlg.Show for the subsequent script.
EDIT: ok, the "var x =" is not necessary before the "Dlg.RunDlg".

Mit geändertem Code:
Extract V2.dcf (13.5 KB)

@Mosed That was quick
Tried V2a Just seen your edit
New V2 better

Noticed
If extracting Dual Lister to Destination and I delete then the only files left selected are the non archive so do not really need the "Some selected files were not archives". Without delete all files are left Selected
If extracting Dual Lister to Source with or without delete then all files a deselected straight away, also Single Lister they are all deselected, if only it worked the same as Dual Lister to Destination.
This is the same as V2

As I always work from Right Source to Left Destination
Having the Source button on the left and the Destination button on the right feels all wrong to me.
Just before you posted V2 was trying to work out how to swap them but could not get it to work.
Would it be easy to show me what to change

I think the warning is more an information that a non-archive file was selected, but it was ignored.

You can easily change it. Choose customize for the button. Choose the ressource-tab. Choose from the menu the dialog "destination" and change the button position.

@Mosed I'd been trying to change button position by opening Extract V2.dcf in note pad. As others have said you learn something new everyday, that was a lot easier.
Thanks

@onedot3: I added a new version. See Smart archive extraction - #10 by Mosed

Perhaps you want to test the improvement. :slight_smile:

Edit: And I also added my target solution. If you use dual display you can choose in the target lister dialog if the Archives shall be deleted via radio buttons with a standard setting. So in general you only have to choose the target lister and only if necessary you have to choose another delete-setting. :slight_smile:

But would be nice if someone would look over the code and says if improvements are necessary. :slight_smile:

@Mosed Have downloaded V2022.02.14b have tested every combination I think as there are a lot.
The only thing is if you don't delete the archive and then extract the same archive and if just files in the archive, there is no warning and the files are extracted into the folder and (2) added at end, if there is a folder it brings up the Confirrn Folder Merge

ok. thank you.

But this behavior is identical to the original button I think. But I can check if this can be improved. (Its my first button / script change I do, so also for me it is learning by doing).

EDIT: @onedot3 In a first step you can replace the "rename" (2x) in the script with one of the parameters available here for "whenexists" if you like to have another behavior: http://127.0.0.1:36787/v12.26/index.html#!Documents/Copy.htm

I'm thinking about adding an option to choose this also in the destination dialog.

@Mosed Have been testing with changing whenexists to ask , skip etc which do work.
But would it be better if when creating the folder it checked if there was already a folder maybe easier to say than do.

I do not understand this sentence. What do you want to say? :slight_smile:

@Mosed I was thinking you could do a whenexists when creating the folder but I don't think it is possible. So the 2 changes are possibly the best

Ah ok. In general this seems to be possible. I have to check if it works also for this script.

But as first step I added a new version where you can choose the "whenexists" value in the destination dialog. For single display there is no dialog, but the default value can be changed in the script (for both).

@Mosed If archive has a folder inside it does not matter which of the "Ask what to do" you pick you always get asked to rename the Folder.

Yes. I recognized now that it does not work when you have an archive with a folder inside. At least for the subfolders Opus ask to skip or replace.
But that behavior is identical to the original button. There you get also the prompt that the subfolder already exists.

I removed the new version. Has to be corrected somehow. I think it makes more sense to check if the root folder exist and to decide then to skip or overwrite everything or to rename the root folder.

@onedot3: I changed a lot now and added additional functions. According to my tests everything works, but I would say the button is in "beta" phase. I have to do some more tests to be sure.
Perhaps you want to test and give some suggestions or similar...

When a folder already exists only replace or skip works (together with "merge"). Thats the reason why there was a message when using rename for "whenexists".

Exctract V2.dcf (39.0 KB)

  • added a check if a folder with the archive name already exist (either in source or destination depening on users choise)
  • when using dual display the user can choose in the destination dialog for the case that a target folder already exist between "replace the folder, rename the existing folder, skip the archive, replace same-named files or skip same-named files.
    "replace the folder" means that the existing folder is deleted and then the archive is extracted / "rename the existing folder" means that the existing folder is renamed with a suffix (_old_date_time) and then the archive is extracted
  • when a target folder did exist the user gets at the end an overview which folders were affected by a change or which archive were skipped and the info if some selected files were not archives.
  • the message that some selected files are not archives does only appear when using single display mode or dual display mode, but the overview-message was not shown.
  • in single display mode the setting "rename existing folder" is the default behavior and cannot be changed via dialog (only by changing the code)

@Mosed You have called the .dcf Exctract an extra c after the x
It might be a good idea to add ss to the time HHmmss line 125 and 128
Because I was trying the same file quickly it failed because there was a old folder
Testz_old_220220_2130
Have a lot more test to try every option but looking good
When selecting ask to delete and the archive name is larger than the space in the dialogue message then some of the file name is missing. I made it double height so all the name shows.

ok. Yes - very long names are an issue also for the overview dialog. For the delete-dialog your proposal solves it.
I think I will replace the old warning dialog completely by the overview dialog. So if some existing folders were changed, an Archive was skipped or a non-archive file was chosen the overview dialog will be shown with the relevant information.

@fred I changed now more then only adding a delete promt. Shall I create an own topic with a link/reference to your button as basis for mine or do we want to give all users a choise between two different versions of smart exctraction button in this topic?

Your button script needs two updates in my opinion:

  • one curly bracket has to be moved from row 93 to row 84 to fix the issue, that the warning message does not appear. See also: Smart archive extraction - #8 by Mosed
  • WHENEXISTS=rename does not work for archives with subfolders (you get a warning from Opus that the subfolder already exist and you can choose between skip and replace). You can use WHENEXISTS=replace, merge or WHENEXISTS=skip, merge.

I collected my currently existing versions in this answer: Smart archive extraction - #10 by Mosed

Create your own thread and I will add a link to it in the first post and call my button as obsolete. I will partake in dev on your own solution regarding dialog location in french.

ok. I created a new topic. :slight_smile: