Unpack/zip in another pane

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
txnoodles@gmail.com
Posts: 5
Joined: 27 Mar 2021 10:10

Unpack/zip in another pane

Post by txnoodles@gmail.com »

Hi,

would it be possible to unpack a file from one pane into the other ? I did run a search on site but I'm none the wiser.

Thanks

Horst
Posts: 1085
Joined: 24 Jan 2021 12:27
Location: Germany

Re: Unpack/zip in another pane

Post by Horst »

txnoodles@gmail.com wrote: 27 Mar 2021 10:13 Hi,

would it be possible to unpack a file from one pane into the other ? I did run a search on site but I'm none the wiser.

Thanks
I do it with this script on a button, it uses 7zip.
Edited to also extract more than one selected archives.

Code: Select all

// Extracts the selected archive(s) to the inactive pane using 7-Zip.

// Check if there's at least one (archive) file selected
   $selected = <get SelectedItemsPathNames <crlf>>;
   end (gettoken($selected, "count", <crlf>) == 0), "No (archive) file(s) selected, aborted!";

   focus "PI";

   foreach($item, $selected, <crlf>, "e") {
        if (exists($item) == 2) { continue; }

    Run("""C:\Program Files\7-Zip\7zG.exe"" x ""$item"" -o""<curpath>""");
    };

    Focus "PI";
Last edited by Horst on 27 Mar 2021 16:52, edited 1 time in total.
Windows 11 Home x64 Version 23H2 (OS Build 22631.3374)
Portable XYplorer (actual version, including betas)
Everything 1.5.0.1371a (x64), Everything Toolbar 1.3.2, Listary Pro 6.3.0.69

highend
Posts: 13274
Joined: 06 Feb 2011 00:33

Re: Unpack/zip in another pane

Post by highend »

Maybe a bit better...

Code: Select all

// Extracts the selected archive to the inactive pane using 7-Zip
    $app = "C:\Program Files\7-Zip\7zG.exe";
    end (exists($app) != 1), "Application not found, aborted!";

// Only proceed if a second pane is open...
    if (get("#800") != 1) {
        status "No dual pane active, aborted!", "8B4513", "stop"; end true;
    }


// Check if there's an (archive) file selected
    end (get("CountSelected") != 1 || exists(<curitem>) != 1), "No single (archive) file selected, aborted!";


// Extract to inactive pane
    $base = gpc(<curitem>, "base");
    $dst  = get("path", "i") . "\" . $base;
    run """$app"" x ""<curitem>"" -o""$dst""";
    focus "PI";
    selectitems $dst;
One of my scripts helped you out? Please donate via Paypal

Horst
Posts: 1085
Joined: 24 Jan 2021 12:27
Location: Germany

Re: Unpack/zip in another pane

Post by Horst »

highend wrote: 27 Mar 2021 12:38 Maybe a bit better...

Code: Select all

// Extracts the selected archive to the inactive pane using 7-Zip
    $app = "C:\Program Files\7-Zip\7zG.exe";
    end (exists($app) != 1), "Application not found, aborted!";

// Only proceed if a second pane is open...
    if (get("#800") != 1) {
        status "No dual pane active, aborted!", "8B4513", "stop"; end true;
    }


// Check if there's an (archive) file selected
    end (get("CountSelected") != 1 || exists(<curitem>) != 1), "No single (archive) file selected, aborted!";


// Extract to inactive pane
    $base = gpc(<curitem>, "base");
    $dst  = get("path", "i") . "\" . $base;
    run """$app"" x ""<curitem>"" -o""$dst""";
    focus "PI";
    selectitems $dst;
No, thats not what I want and also (at least for me) not the expected behaviour for a dual-pane archive extract.
Your version creates a sub-dir in the inactive pane and extracts the content of the archive into this sub-dir.
If the archive contains sub-dirs they are then sub-dirs of the newly created sub-dir and not of the inactive pane.
Also it sets the focus into the inactive pane which prevents to continue with unpack more archive from the active pane.
My version extracts the content of the archive into the dir of the inactive pane
and stays in the active pane.
Windows 11 Home x64 Version 23H2 (OS Build 22631.3374)
Portable XYplorer (actual version, including betas)
Everything 1.5.0.1371a (x64), Everything Toolbar 1.3.2, Listary Pro 6.3.0.69

txnoodles@gmail.com
Posts: 5
Joined: 27 Mar 2021 10:10

Re: Unpack/zip in another pane

Post by txnoodles@gmail.com »

Thanks a lot for the script.Would it be possible to make it so that I can unzip multiple files at once ? As is now I can only un pack 1 file at a time.Thanks

highend
Posts: 13274
Joined: 06 Feb 2011 00:33

Re: Unpack/zip in another pane

Post by highend »

Code: Select all

// Extracts the selected archive(s) to a subfolder of the inactive pane using 7-Zip
    $app = "C:\Program Files\7-Zip\7zG.exe";
    end (exists($app) != 1), "Application not found, aborted!";

// Only proceed if a second pane is open...
    if (get("#800") != 1) {
        status "No dual pane active, aborted!", "8B4513", "stop"; end true;
    }

// Check if there's at least one (archive) file selected
    $selected = <get SelectedItemsPathNames <crlf>>;
    end (gettoken($selected, "count", <crlf>) == 0), "No (archive) file(s) selected, aborted!";


// Extract to inactive pane
    $iAPPath = get("path", "i");

    foreach($item, $selected, <crlf>, "e") {
        if (exists($item) == 2) { continue; }
        $base = gpc($item, "base");
        $dst  = $iAPPath . "\" . $base;
        run """$app"" x ""$item"" -o""$dst""";
    }
One of my scripts helped you out? Please donate via Paypal

Horst
Posts: 1085
Joined: 24 Jan 2021 12:27
Location: Germany

Re: Unpack/zip in another pane

Post by Horst »

txnoodles@gmail.com wrote: 27 Mar 2021 13:29 Thanks a lot for the script.Would it be possible to make it so that I can unzip multiple files at once ? As is now I can only un pack 1 file at a time.Thanks
Its not clear what script you prefer ?
Should all selected archives be extracted into the dir of the inactive pane ?
Windows 11 Home x64 Version 23H2 (OS Build 22631.3374)
Portable XYplorer (actual version, including betas)
Everything 1.5.0.1371a (x64), Everything Toolbar 1.3.2, Listary Pro 6.3.0.69

txnoodles@gmail.com
Posts: 5
Joined: 27 Mar 2021 10:10

Re: Unpack/zip in another pane

Post by txnoodles@gmail.com »

Correct.I would like, if possible, to be able to unpack one or more files at the same time.

txnoodles@gmail.com
Posts: 5
Joined: 27 Mar 2021 10:10

Re: Unpack/zip in another pane

Post by txnoodles@gmail.com »

Horst wrote: 27 Mar 2021 13:51
txnoodles@gmail.com wrote: 27 Mar 2021 13:29 Thanks a lot for the script.Would it be possible to make it so that I can unzip multiple files at once ? As is now I can only un pack 1 file at a time.Thanks
Its not clear what script you prefer ?
Should all selected archives be extracted into the dir of the inactive pane ?


Thanks a ton this works great.One more thing can this script also unpack other files like *rar and things ? It would be great.

highend
Posts: 13274
Joined: 06 Feb 2011 00:33

Re: Unpack/zip in another pane

Post by highend »

What? It extracts what you application can extract. And 7zG extracts .rar just fine...
One of my scripts helped you out? Please donate via Paypal

txnoodles@gmail.com
Posts: 5
Joined: 27 Mar 2021 10:10

Re: Unpack/zip in another pane

Post by txnoodles@gmail.com »

highend wrote: 27 Mar 2021 14:38 What? It extracts what you application can extract. And 7zG extracts .rar just fine...

Oops.Thanks a ton.

highend
Posts: 13274
Joined: 06 Feb 2011 00:33

Re: Unpack/zip in another pane

Post by highend »

And you you have dual pane open? The end statement works fine here...
One of my scripts helped you out? Please donate via Paypal

Horst
Posts: 1085
Joined: 24 Jan 2021 12:27
Location: Germany

Re: Unpack/zip in another pane

Post by Horst »

highend wrote: 27 Mar 2021 15:19 And you you have dual pane open? The end statement works fine here...
I always have dual pane.
There comes no message if a dir is selected which of course doesn't make sense but can happen.
It would be nice if there would be a message if no file but anything else is selected.
Windows 11 Home x64 Version 23H2 (OS Build 22631.3374)
Portable XYplorer (actual version, including betas)
Everything 1.5.0.1371a (x64), Everything Toolbar 1.3.2, Listary Pro 6.3.0.69

highend
Posts: 13274
Joined: 06 Feb 2011 00:33

Re: Unpack/zip in another pane

Post by highend »

You mean something like this?

Code: Select all

// Extracts the selected archive(s) to a subfolder of the inactive pane using 7-Zip
    $app = "C:\Program Files\7-Zip\7zG.exe";
    end (exists($app) != 1), "Application not found, aborted!";

// Only proceed if a second pane is open...
    if (get("#800") != 1) {
        status "No dual pane active, aborted!", "8B4513", "stop"; end true;
    }

// Check if there's at least one (archive) file selected
    $selected    = <get SelectedItemsPathNamesSlashed>;
    $cntSelected = gettoken($selected, "count", <crlf>);
    end ($cntSelected == 0), "No (archive) file(s) selected, aborted!";

    $cntFiles = gettoken(formatlist($selected, "f", <crlf>, "!*\"), "count", <crlf>);
    end ($cntSelected != $cntFiles), "Folder(s) can't be selected, aborted!";

// Extract to inactive pane
    $iAPPath = get("path", "i");

    foreach($item, $selected, <crlf>, "e") {
        $base = gpc($item, "base");
        $dst  = $iAPPath . "\" . $base;
        run """$app"" x ""$item"" -o""$dst""";
    }
One of my scripts helped you out? Please donate via Paypal

Horst
Posts: 1085
Joined: 24 Jan 2021 12:27
Location: Germany

Re: Unpack/zip in another pane

Post by Horst »

highend wrote: 27 Mar 2021 17:10 You mean something like this?

Code: Select all

// Extracts the selected archive(s) to a subfolder of the inactive pane using 7-Zip
    $app = "C:\Program Files\7-Zip\7zG.exe";
    end (exists($app) != 1), "Application not found, aborted!";

// Only proceed if a second pane is open...
    if (get("#800") != 1) {
        status "No dual pane active, aborted!", "8B4513", "stop"; end true;
    }

// Check if there's at least one (archive) file selected
    $selected    = <get SelectedItemsPathNamesSlashed>;
    $cntSelected = gettoken($selected, "count", <crlf>);
    end ($cntSelected == 0), "No (archive) file(s) selected, aborted!";

    $cntFiles = gettoken(formatlist($selected, "f", <crlf>, "!*\"), "count", <crlf>);
    end ($cntSelected != $cntFiles), "Folder(s) can't be selected, aborted!";
    end true;

// Extract to inactive pane
    $iAPPath = get("path", "i");

    foreach($item, $selected, <crlf>, "e") {
        $base = gpc($item, "base");
        $dst  = $iAPPath . "\" . $base;
        run """$app"" x ""$item"" -o""$dst""";
    }
That gives "Folder(s) can't be selected, aborted" message even when only file(s) are selected
Windows 11 Home x64 Version 23H2 (OS Build 22631.3374)
Portable XYplorer (actual version, including betas)
Everything 1.5.0.1371a (x64), Everything Toolbar 1.3.2, Listary Pro 6.3.0.69

Post Reply