I've been extending your most excellent script for my own nefarious purposes and I thought this might be of interest to <del>everyone</del> no one!
Vanilla 1.1.10 - 2009-11-23
Downloaded from http://vanillaforums.org/download/
http://vanillaforums.org/uploads/4IAUJPV5PVRW.zip
Code: Select all
Name Size
--------------------------------- --------
vanilla-1.1.10 1,735 KB <-- Uncompressed Directory
vanilla-1.1.10.zip 560 KB <-- Original Download
vanilla-1.1.10.RIGHT.CLICK.zip 550 KB
vanilla-1.1.10.DEFLATE.zip 545 KB
vanilla-1.1.10.BZip2.Ultra.GUI.7z 323 KB
vanilla-1.1.10.RIGHT.CLICK.7z 315 KB
vanilla-1.1.10.LZMA2.7z 312 KB
vanilla-1.1.10.Ultra.GUI.7z 312 KB
vanilla-1.1.10.LZMA.7z 311 KB
vanilla-1.1.10.PPMd.7z 273 KB
XYplorer 8.70.0100 - 2009-12-08
Downloaded from http://xyplorer.com/download.htm
http://xyplorer.com/download/xyplorer_f ... nstall.zip
http://xyplorer.com/download/xyplorer_f ... nstall.rar
Code: Select all
Name Size
----------------------------------------------------- --------
xyplorer_full_8.70.0100_noinstall 4,366 KB <-- Uncompressed Directory
xyplorer_full_8.70.0100_noinstall.zip 1,855 KB <-- Original Download
xyplorer_full_8.70.0100_noinstall.RIGHT.CLICK.zip 1,800 KB
xyplorer_full_8.70.0100_noinstall.DEFLATE.zip 1,787 KB
xyplorer_full_8.70.0100_noinstall.rar 1,626 KB <-- Original Download
xyplorer_full_8.70.0100_noinstall.BZip2.Ultra.GUI.7z 1,607 KB
xyplorer_full_8.70.0100_noinstall.RIGHT.CLICK.7z 1,500 KB
xyplorer_full_8.70.0100_noinstall.PPMd.7z 1,496 KB
xyplorer_full_8.70.0100_noinstall.Ultra.GUI.7z 1,475 KB
xyplorer_full_8.70.0100_noinstall.LZMA.7z 1,474 KB
xyplorer_full_8.70.0100_noinstall.LZMA2.7z 1,471 KB
And then, just for shits and giggles I thought I'd UPX compress XYplrer.exe using "upx *.* --brute --nrv2d" with UPX 3.04w
http://upx.sourceforge.net/
Code: Select all
Name Size
---------------------------------------------------------- --------
xyplorer_full_8.70.0100_noinstall_UPX.PPMd.7z 1,534 KB
xyplorer_full_8.70.0100_noinstall_UPX 1,534 KB <-- UPX Compressed Directory
xyplorer_full_8.70.0100_noinstall_UPX.Ultra.GUI.7z 1,507 KB
xyplorer_full_8.70.0100_noinstall_UPX.LZMA.7z 1,507 KB
xyplorer_full_8.70.0100_noinstall_UPX.RIGHT.CLICK.7z 1,507 KB
xyplorer_full_8.70.0100_noinstall_UPX.BZip2.Ultra.GUI.7z 1,497 KB
xyplorer_full_8.70.0100_noinstall_UPX.RIGHT.CLICK.zip 1,494 KB
xyplorer_full_8.70.0100_noinstall_UPX.DEFLATE.zip 1,493 KB <-- Zip DEFLATE beating PPMd, BZip2 and LZMA!
xyplorer_full_8.70.0100_noinstall_UPX.LZMA2.7z 1,490 KB
Code: Select all
Name Size
------------------- --------
XYplorer.exe 3,896 KB <-- Original Executable
XYplorer.exe 1,064 KB <-- UPX Compressed Executable
Here's the script in full, most people will still want the original and not this

There are probably some horrible bits f code in there that may quite possibly break anything and everything since I am a cut'n'paste coder
Code: Select all
/* Title: Another 7-Zip Script
* Author: Plastic - http://www.xyplorer.com/xyfc/memberlist.php?mode=viewprofile&u=778
* URL: http://www.xyplorer.com/xyfc/viewtopic.php?f=7&t=3487
*
* Modified by: Luke Scammell - http://www.xyplorer.com/xyfc/memberlist.php?mode=viewprofile&u=273
* URL: http://www.xyplorer.com/xyfc/viewtopic.php?f=7&t=3487&p=40715#p40715
*/
/** CONFIG **/
// 7zip executable
"_get_config"
global $g_exec, $g_filelist_path, $g_delete_filelist, $g_options_global_add;
//$g_exec = "C:\Program Files\7-Zip\7z.exe";
$g_exec = "<xypath>\..\7-ZipPortable\App\7-Zip64\7z.exe";
$g_filelist_path = "<xypath>\Scripts\7zip.filelist";
// Set to 1 to force deletion of the filelist after completion.
// WARNING: This render the script modal
$g_delete_filelist = 0;
// Options that are added to all compression methods
// -xr! is used to exclude (x) recursively (r) these file types
// nppBackup is an optional directory created by Notepad++ that stores a version of the file you're editing every time you save
$g_options_global_add = "-ssc -ssw -xr!nppBackup -xr!Thumbs.db -xr!ehthumbs_vista.db -xr!.DS_Store -xr!._* -xr!.Trashes -xr!__MACOSX"
// 7zip option by format
/************* 7z Default LZMA compression, good for general use *************/
"_get_7z_LZMA_add_options"
global $g_options;
$g_options = "-m0=LZMA:mc=256:fb=128 -mx -ms -mmt";
"_get_7z_extract_options"
global $g_options;
$g_options = "";
/************* 7z LZMA2 compression, faster and better for large files *************/
"_get_7z_LZMA2_add_options"
global $g_options;
$g_options = "-m0=LZMA2 -mx=8 -ms -mmt";
"_get_7z_LZMA2_extract_options"
global $g_options;
$g_options = "";
/************* 7z PPMD compression, better for text *************/
"_get_7z_PPMd_add_options"
global $g_options;
$g_options = "-m0=PPMd:o32:mem192m";
"_get_7z_PPMd_extract_options"
global $g_options;
$g_options = "";
/************* Zip Default DEFLATE compression, most compatible *************/
"_get_zip_DEFLATE_add_options"
global $g_options;
$g_options = "-mx=9 -mm=Deflate";
"_get_zip_DEFLATE_extract_options"
global $g_options;
$g_options = "";
/************* Tar Archive, needed in order to use Gzip and Bzip2 *************/
"_get_tar__add_options"
global $g_options;
$g_options = "";
"_get_tar__extract_options"
global $g_options;
$g_options = "";
/************* gzip compression, old Linux/*nix standard *************/
"_get_gzip__add_options"
global $g_options;
$g_options = "-mx=9";
"_get_gzip__extract_options"
global $g_options;
$g_options = "";
/************* Bzip2 compression, current Linux/*nix standard *************/
"_get_bzip2__add_options"
global $g_options;
$g_options = "-mx=9";
"_get_bzip2__extract_options"
global $g_options;
$g_options = "";
/************* xz compression, new Linux/*nix standard *************/
"_get_xz__add_options"
global $g_options;
$g_options = "-mx=9";
"_get_xz__extract_options"
global $g_options;
$g_options = "";
/** MENU **/
"Zi&p max compatible item(s) : zip"
sub "_init";
global $g_archive_type, $g_compression_method;
$g_archive_type = "zip";
$g_compression_method = "DEFLATE";
sub "_do_compress_1archive"
"Zip max compatible items (1 archive/item) : mzip"
sub "_init";
global $g_archive_type, $g_compression_method;
$g_archive_type = "zip";
$g_compression_method = "DEFLATE";
sub "_do_compress_Narchives"
-
"7&z general item(s) : 7z"
sub "_init";
global $g_archive_type, $g_compression_method;
$g_archive_type = "7z";
$g_compression_method = "LZMA";
sub "_do_compress_1archive"
"7z general items (1 archive/item) : m7z"
sub "_init";
global $g_archive_type, $g_compression_method;
$g_archive_type = "7z";
$g_compression_method = "LZMA";
sub "_do_compress_Narchives"
-
"7z la&rge item(s) : 7zLZMA2"
sub "_init";
global $g_archive_type, $g_compression_method;
$g_archive_type = "7z";
$g_compression_method = "LZMA2";
sub "_do_compress_1archive"
"7z large items (1 archive/item) : m7zLZMA2"
sub "_init";
global $g_archive_type, $g_compression_method;
$g_archive_type = "7z";
$g_compression_method = "LZMA2";
sub "_do_compress_Narchives"
-
"7z &text item(s) : 7zppmd"
sub "_init";
global $g_archive_type, $g_compression_method;
$g_archive_type = "7z";
$g_compression_method = "PPMd";
sub "_do_compress_1archive"
"7z text items (1 archive/item) : m7zppmd"
sub "_init";
global $g_archive_type, $g_compression_method;
$g_archive_type = "7z";
$g_compression_method = "PPMd";
sub "_do_compress_Narchives"
-
"Tar item(s) : tar"
sub "_init";
global $g_archive_type, $g_compression_method;
$g_archive_type = "tar";
$g_compression_method = "";
sub "_do_compress_1archive"
-
"gzip items (1 archive/item - no folders) : gzip"
sub "_init";
global $g_archive_type, $g_compression_method;
$g_archive_type = "gzip";
$g_compression_method = "";
sub "_do_compress_Narchives"
-
"bzip2 items (1 archive/item - no folders) : bzip2"
sub "_init";
global $g_archive_type, $g_compression_method;
$g_archive_type = "bzip2";
$g_compression_method = "";
sub "_do_compress_Narchives"
-
"xz items (1 archive/item - no folders) : xz"
sub "_init";
global $g_archive_type, $g_compression_method;
$g_archive_type = "xz";
$g_compression_method = "";
sub "_do_compress_Narchives"
-
"Extract &here : extract"
sub "_init";
global $g_list_items, $g_list_length, $g_env_curpath;
global $param_extract_path, $param_item;
global $param_item_path, $out_item_name;
$i = 1;
while ($i <= $g_list_length) {
$item_path = gettoken($g_list_items, $i, "|");
$param_extract_path = "$g_env_curpath";
$param_item = $item_path;
sub "_do_extract";
$i = $i + 1;
}
"E&xtract in <subfolder> : extract_subfolder"
sub "_init";
global $g_list_items, $g_list_length, $g_env_curpath;
global $param_extract_path, $param_item;
global $param_item_path, $out_item_name;
$i = 1;
while ($i <= $g_list_length) {
$item_path = gettoken($g_list_items, $i, "|");
$param_item_path = $item_path;
sub "_get_item_basename";
// Return $out_item_name
$param_extract_path = "$g_env_curpath\$out_item_name";
$param_item = $item_path;
sub "_do_extract";
$i = $i + 1;
}
-
"Edit script : edit"
self $scriptFile, file;
Open $scriptFile;
-
"Cancel"
/** PRIVATE **/
"_init"
sub "_get_config";
sub "_get_list";
sub "_get_env";
sub "_check";
"_get_list"
// Get selected list items
global $g_list_items, $g_list_length;
$g_list_items = getinfo("SelectedItemsPathNames", "|") . "|";
$g_list_length = getinfo("CountSelected");
$i = 1;
while ($i <= $g_list_length) {
$item_path = gettoken($g_list_items, $i, "|");
if (exists($item_path) == 2) { // Folder -> Add "\" to work on folder content
replace $g_list_items, $g_list_items, "$item_path|", "$item_path\|";
}
$i = $i + 1;
}
substr $g_list_items, $g_list_items, 0, -1; // Delete last separator
"_get_env"
// Get useful environment variables
global $g_env_curpath, $g_env_curfolder, $g_env_curbase;
$g_env_curpath = <curpath>;
$g_env_curfolder = <curfolder>;
"_check"
// Check if parameters are ok
global $g_list_length;
end $g_list_length <= 0;
"_get_item_basename"
// Get a full path in $param_item_path, and returne base in $out_item_name
// ex: c:\dir1\dir2\base.ext => base
// c:\dir1\dir2\ => dir2
global $param_item_path;
global $out_item_name;
$out_item_name = $param_item_path;
// Detect folder path. Folder path ends with "\" so we have to find if the path ends with a "\"
// No reverse find for now, so we add a special character to do the trick
$out_item_name = $out_item_name . "{";
strpos $is_folder, $out_item_name, "\{";
if ($is_folder >= 0) {
$is_folder = 1;
// Remove special char with last "\"
replace $out_item_name, $out_item_name, "\{";
}
else {
$is_folder = 0;
// Remove special char
replace $out_item_name, $out_item_name, "{";
}
strpos $last_slash_index, $out_item_name, "\";
$last = $last_slash_index;
while ($last_slash_index >= 0 && $last_slash_index < strlen($out_item_name)) {
strpos $last_slash_index, $out_item_name, "\", $last_slash_index + 1;
if ($last_slash_index != -1) {
$last = $last_slash_index;
}
}
$last_slash_index = $last;
if ($last_slash_index != -1) {
substr $out_item_name, $out_item_name, $last_slash_index + 1;
}
if ($is_folder == 0) {
// Folder -> Do nothings
// File -> Remove extension
strpos $last_dot_index, $out_item_name, ".";
$last = $last_dot_index;
while ($last_dot_index >= 0 && $last_dot_index < strlen($out_item_name)) {
strpos $last_dot_index, $out_item_name, ".", $last_dot_index + 1;
if ($last_dot_index != -1) {
$last = $last_dot_index;
}
}
$last_dot_index = $last;
if ($last_dot_index > 0) {
strlen $length, $out_item_name;
$last_dot_right = $last_dot_index - $length;
substr $out_item_name, $out_item_name, 0, $last_dot_right;
}
}
"_do_compress_1archive"
// 1 archive for all items
global $g_list_items, $g_list_length, $g_env_curpath, $g_env_curfolder;
global $g_filelist_path;
global $param_items, $param_archive_path, $param_archive_name, $param_use_filelist;
$param_archive_path = $g_env_curpath;
if ($g_list_length == 1) {
// 1 item -> archive name = item name
global $param_item_path, $out_item_name;
$param_item_path = $g_list_items;
sub "_get_item_basename";
$param_archive_name = $out_item_name;
}
else {
// N items -> archive name = folder name
$param_archive_name = $g_env_curfolder;
}
// Use file list g_list_items is too big
if (strlen($g_list_items) > 1000) {
replace $listfile_data, $g_list_items, "|", chr(10);
if (writefile($g_filelist_path, $listfile_data) != 0) {
$param_use_filelist = 1;
sub "_do_compress";
}
} else {
$g_filelist_path = "";
replace $param_items, $g_list_items, "|", '" "';
sub "_do_compress";
}
"_do_compress_Narchives"
// N archives : 1 archive per item
global $g_list_items, $g_list_length, $g_env_curpath;
global $param_items, $param_archive_path, $param_archive_name;
global $param_item_path, $out_item_name;
$param_archive_path = $g_env_curpath;
$i = 1;
while ($i <= $g_list_length) {
$item_path = gettoken($g_list_items, $i, "|");
$param_item_path = $item_path;
sub "_get_item_basename";
// Return $out_item_name
$param_archive_name = $out_item_name;
$param_items = $item_path;
sub "_do_compress";
$i = $i + 1;
}
// ** Simple actions **
"_do_compress"
global $g_exec, $g_archive_type, $g_compression_method, $g_options, $g_options_global_add;
global $param_items, $param_archive_path, $param_archive_name, $param_use_filelist;
global $g_filelist_path, $g_delete_filelist;
sub "_get_" . $g_archive_type . "_" . $g_compression_method . "_add_options";
if ($param_use_filelist == 1 and $g_filelist_path != "") {
if ($g_delete_filelist == 1) {
// Using file list parameter, we should wait for the command to end in order to delete the file
run """$g_exec"" a -t$g_archive_type ""$param_archive_path\$param_archive_name.$g_compression_method.$g_archive_type"" $g_options $g_options_global_add @""$g_filelist_path""", , 1;
delete 1,0,$g_filelist_path;
}
else {
run """$g_exec"" a -t$g_archive_type ""$param_archive_path\$param_archive_name.$g_compression_method.$g_archive_type"" $g_options $g_options_global_add @""$g_filelist_path""", , 0;
}
}
else {
run """$g_exec"" a -t$g_archive_type ""$param_archive_path\$param_archive_name.$g_compression_method.$g_archive_type"" $g_options $g_options_global_add ""$param_items""", , 0;
}
"_do_extract"
global $g_exec, $g_options;
global $param_extract_path, $param_item;
// TODO Detect archive type
$g_archive_type = "7z";
sub "_get_" . $g_archive_type . "_extract_options";
run """$g_exec"" x -o""$param_extract_path"" $g_options ""$param_item""", , 0;
Edit:
fixed show-stopper bug that new scripting functionality brought in recently.
Used to update to the latest beta every day. Now I have children instead…
Windows 10 Pro x64 (everywhere except phone…)