Page 1 of 2
Unpack/zip in another pane
Posted: 27 Mar 2021 10:13
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
Re: Unpack/zip in another pane
Posted: 27 Mar 2021 12:17
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";
Re: Unpack/zip in another pane
Posted: 27 Mar 2021 12:38
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;
Re: Unpack/zip in another pane
Posted: 27 Mar 2021 13:21
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.
Re: Unpack/zip in another pane
Posted: 27 Mar 2021 13:29
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
Re: Unpack/zip in another pane
Posted: 27 Mar 2021 13:45
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""";
}
Re: Unpack/zip in another pane
Posted: 27 Mar 2021 13:51
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 ?
Re: Unpack/zip in another pane
Posted: 27 Mar 2021 14:25
by txnoodles@gmail.com
Correct.I would like, if possible, to be able to unpack one or more files at the same time.
Re: Unpack/zip in another pane
Posted: 27 Mar 2021 14:33
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.
Re: Unpack/zip in another pane
Posted: 27 Mar 2021 14:38
by highend
What? It extracts what you application can extract. And 7zG extracts .rar just fine...
Re: Unpack/zip in another pane
Posted: 27 Mar 2021 15:04
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.
Re: Unpack/zip in another pane
Posted: 27 Mar 2021 15:19
by highend
And you you have dual pane open? The end statement works fine here...
Re: Unpack/zip in another pane
Posted: 27 Mar 2021 16:32
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.
Re: Unpack/zip in another pane
Posted: 27 Mar 2021 17:10
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""";
}
Re: Unpack/zip in another pane
Posted: 27 Mar 2021 17:21
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