How to Convert a .zip to a .7z in a Single Button

I am trying to convert a .zip to a .7z.

It works if the process is in three separate buttons.

It does not work when all the same code is in a single button.

First select the zip folder, then...

Button 1 = create a temp folder and extract the zip file to it
Set Focus=Toggle
Createfolder "TempFolder"
Go TempFolder
Set FOCUS=Toggle
Set FOCUS=Toggle

Button 2 = create a .7z in the temp folder -- answer OK to the .7z creation

Button 3 = select the .7z, move it to the original folder with the zip and delete the temp folder -- answer OK to the select
Select ADVANCED="Archive files"
Copy Move
Delete . Quiet

Any ideas why it doesn't work when all the same code is in a single button?

Any help appreciated.

Opus updates certain parameters only after a button has finished. The next button will then use these values.

To force Opus to feed updated values to the next stage, try turning the three buttons into three User Commands and execute them from a single button.

The best approach for the task would be a script. I'd recommend putting in the effort to learn scripting. Using regular command buttons can become frustrating rather quickly.

In this particular case, a standard button can still do the job:


Copy FILE="{file}" EXTRACT=sub HERE CREATEFOLDER="temp{file|noext}xyz"
Copy FILE="{sourcepath}temp{file|noext}xyz\*" ARCHIVE=.7z TO="{sourcepath}"
Delete FILE="temp*xyz" QUIET

Thank you very much for this code. First because I convert to 7Zip frequently and second because I now have working code that lets me see how all the pieces in the manual - commands, external control codes, arguments and the sequencing of commands, such as, "FILE ... EXTRACT ... CREATEFOLDER" - go together to produce a useful outcome.

The arguments' order is in most cases irrelevant, line'em up any way you want :slight_smile: