Introduction
It has 4 patterns to help selecting files easily; Beside standard zip files, ZEX can also create self-expanding console programs, and the console programs are programmable - you can use javascript or vbscript to manipulate the zip contents. Of course, ZEX can also decompress ZIP files.
Specifications
- Program Type: Console (command line)
- Program File Size: About 235 KB
- Operating System: Windows XP, Windows Server 2003, Windows 7
- .Net Framework required: None
- Setup: Not required.
Compressing Function - Command Line Arguments Explained
Syntax: zex +z input1;input2...inputN output [/password:text] [/comments:text] [/companyName:text] [/fileDescription:text]
| SN | Value | Notes |
| 1 | +z | +z means compressing files into a zip file. |
| 2 | Input1;Input2;...;InputN |
ZEX has 4 Input Patterns:
Exra Filter
@ Field
|
| 3 | Output |
A .zip file or or .exe file. For .zip file, a standard zip file is created. For .exe file, a self-expanding console program file is created. |
| 4 | /password:actual password |
Optional, only for .zip output. |
| 5 | /Comments:text |
Optional, only for .exe output. |
| 6 | /CompanyName:text |
Optional, only for .exe output. |
| 7 | /FileDescription:text |
Optional, only for .exe output. |
Decompressing Function - Command Line Arguments Explained
Syntax: zex -z zip-file-name output-folder [/password:text]
| SN | Value | Notes |
| 1 | -z | -z means decompressing a zip file. |
| 2 | ZIP file name | The name of the zip file to be decompressed. |
| 3 | Output Folder | The name of the folder where the decompressed files to be written to. |
| 4 | /password:actual password |
Optional, only when the zip file has been compressed with a password |
Usage Examples:
- zex +z "a.doc;b.xls;d:\myppts\c.ppt" abc.zip
Input are 3 files: a.doc, b.xls, c.ppt (a.doc and b.xls are in the current folder, while c.ppt is in folder d:\myppts). The output is abc.zip. - zex +z "d:\myppts\*.ppt/-@d/" ppts.zip
Input are all .ppt files in folder d:\myppts. Sub-folders in d:\myppts are excluded. The output is ppts.zip. - zex +z "d:\myppts\*.ppt/+@t2011-1-1/" ppts.zip
Input are .ppt files in folder d:\myppts and its sub-foders. Only the .ppt files that are modified since 2011-1-1 are included. Sub-folders in d:\myppts are excluded. The output is ppts.zip.
Self-Expanding Console Program
To create a self-expanding console program is similar to creating a zip file, the difference is to set the output to a .exe file. When the self-expanding console program is started with no command line arguments, it says:
This a self-expanding-zip program created with XUEBROTHERS ZEX To expand the ZIP contents to the current directory, type: "ProgramName ." To expand the ZIP contents to a different directory, type: "ProgramName directoryName"
ProgramName is the actual output file name.
Programming the Self-Expanding Console Program
If one of the input files is 'autozex.js' or 'autozex.vbs', the self-expanding program just executes the script. For a quick understanding, lets make a simple self-expanding console program with 2 files: 'autozex.js' and a 'demo.jpg'. The content of 'autozex.js' is:
var zip=zex.GetZIP(); //get the zip contents. zex is a built-in object var dir=zex.GetCurrentProgramDirectory(); //the directory where the self-expanding program is if(zip.UnZipItem("demo.jpg", dir, false)) //expanding demo.jpg { var demoPath=dir + "\\demo.jpg"; //the full path of the demo.jpg zex.Print("Open " + demoPath + "\n"); //displaying some message zex.system("start " + demoPath); //open the expanded demo.jpg zex.SetAppReturnValue(0); //set the program's return value to 0 } else { zex.SetAppReturnValue(1); zex.Print("Error.\n"); }
As described above, when making a self-expanding program, 3 extra command argumens can be specified, they are:
- Comments
- CopanyName
- FileDescription
These are standard version info items of a program file. Also a fourth item, 'SpecialBuild', is automatically set by ZEX. It's value is set to the date and time (formated like '2011-01-02 12:23:34') when the self-expanding program is created.
What the use of these version info items? There are times when the self-expanding program is for other programs to run, instead of to be run by human beings manually. For example, the self-expanding program may be a upgrading program for a web site, and the web site program may need to check if the self-expanding program is the right program by reading its version info. Below are some sample C# codes that may be used in a ASPX web site's upgrading page:
FileVersionInfo fvi = FileVersionInfo.GetVersionInfo(uploadedFilePath);
if (fvi == null ? true : (fvi.FileDescription == null ? true : fvi.FileDescription != "ABC Web Site Upgrade Module"))
{
Status.Text = "What you uploaded is not a upgrade program file.";
return;
}
if (fvi == null ? true : (fvi.SpecialBuild == null ? true : fvi.SpecialBuild.CompareTo(prevUpgradBuild)<0))
{
Status.Text = "What you uploaded is older version.";
return;
}
Programming Interfaces of the Self-Expanding Console Program
Methods of ZEX
- Print(text) Display text on the console. Example: zex.Print("helo");
- SetAppReturnValue(number) Set the return value of the self-expanding program. Example: zex.SetAppReturnValue(0);
- Input() Wait for the user to input some text and return that text. Example:
var txt=zex.Input();
zex.Print("You typed: " + txt + "\n"); - GetZIP() Returns the zip object.
- GetCommandLineArgumentCount() Returns the number of command line arguments.
- GetCommandLineArgument(index-number) Returns the command line argument. Index is 0 based. The first one is always the program name.
- Sleep(number-microseconds) Pause the program for the time specified.
- system(command) This has the same effect as typing a command at the console prompt and strike [Return]. Example (start IIS):
zex.system("net start w3svc"); - GetProgramFilesDirectory() Returns the 'Program Files' directory. Usually this is "c:\program files'.
- GetCurrentProgramDirectory() Returns the directory where the current self-expanding program file is.
- GetCurrentProgramFileName() Returns the file name of the current self-expanding program.
- GetCurrentDirectory() Returns the current (default) directory of the current self-expanding program.
- GetComputerName() Returns the computer name.
- GetUserName() Returns the name of the current user.
- IsCurrentProcessUserMode() Returns true if the self-expanding program is started by a human being user.
- GetVIBuildTime() Returns the date and time when the self-expanding program is made. This value is stored in 'SpecialBuild' field of Version Info. The format looks like '2011-01-02 03:04:05'
- GetVIComments() Returns the value of the 'Comments' field of Version Info.
- GetVICompanyName() Returns the value of the 'CompanyName' field of Version Info.
- GetVIFileDescription() Returns the value of the 'FileDescription' field of Version Info.
Methods of ZIP
- GetItemCount() Returns the number of items in the ZIP content.
- GetItemName(number-index) Returns the name a zip content item. It is eighter a file name or a folder name. Index is 0 based.
- UnZipItem(itemName, output-folder-name, expanding-subfolder-if-any) Expand a zip item to a folder. Returns true if succesful. Since a zip item (a file or a folder) may has sub-folder information, if the third argument is true, the sub-foder will be created, otherwise simply expand the item to the output folder.
- UnZipAll(output-folder-name) Expand all zip items to a folder. Returns the number items successfully expaned. Since the script item ('autozex.js' or 'autozex.vbs') is protected and not expaneded, the value returned by this method is always less than the value returned by GetItemCount().
Buy ZEX
The price is USD 35.00. Please read our policy first:
- We don't give a refund for whatever the reason may be.
- If you have any doubts before you buy, write your questions support@xuebrothers.net. You will get our reply within 24 hours.
- If you find bugs in our product after you buy, report to support@xuebrothers.net. We will re-send you a copy after the bugs fixed. This usually takes less than 3 days.
Please click the PayPal link below ti make the payment
The product will be delivered via email within 36 hours afeter PayPal has confirmed your payments. The email will have a download link to the product.