Note:
The "early preview version" indicates that some functions of the software are implemented and previewed, and the existing functions are unstable. Major modifications may be made to later versions. You are welcome to report bugs and follow the updates.
For version updates, see the mgen haiyunguo project.
Directory
- 1. selectors-Selector
- 2. Filters-Filter
- 3. Execution progress display
- 4. Filters with multiple conditions
- 5. Inverse value and nested Filter
- 6. Software Download
Returned directory
1. selectors-Selector
For file systems, the haicuo project defines three types of operation objects: drives, folders, and files. For any operation, there must be a definition of the starting data; otherwise, any subsequent operation will be meaningless. The start data definition requires the setdata function. This function requires two parameters: Drive, Dir, and file, which correspond to the drive, folder, and file types. The second parameter is a string array that represents a specific path.
Before proceeding, let's talk about two output functions: Print and show. The print parameter is a string that is directly output to the terminal. Show will display all data. There is an optional parameter to specify whether to display only the name, of course, the default is false.
Note that setdata must be the first command; otherwise, other commands cannot be executed.
Then we will run a hello World script, select drive C, output a string, and use show to display the current data. In the haiyunguo project console, enter the following script:
Ver 1;
Setdata dir ['C: \ '];
Print 'Hello mgen! ';
Show;
After the script is run, the text is output and the current data is displayed: Drive C.
Well, this is the most basic operation. Next we will start the topic of this section: selector. With the selector, we can jump in different data types. Of course, this jump has rules. The haiyunguo project defines the following basic selector:
Vtodd // select the corresponding folder from the drive
Dtoallf // select all its sub-files from the folder
Dtoalld // select all its subfolders from the folder
Dtorootf // select its root file from the folder
Dtorootd // select its root folder from the folder
It is easy to understand. For example, we use setdata to set the initial value to two folders: Drive C and drive D (the folder can be a disk partition ). Then execute dtorootd, then the current data will become the root folder of drive C and drive D. If you run dtoallf, the current data will become all files on drive C and drive D.
Sample script (select the root folder under c: \ and D)
Ver 1;
Setdata dir ['C: \ 'd: \ '];
Dtorootd;
Show;
The running result displays all the folders in the root directory of drive C and drive D:
Note that there are no restrictions on redirection. This script:
Ver 1;
Setdata dir ['C: \ Windows'];
Dtorootd;
Dtorootd;
Dtorootf;
Show;
First, set setdata to the Windows folder on drive C, and then select the root directory of all the root directories in the Windows folder for the two dtorootd:
For example, the addins folder will not be selected because it does not have a root directory after the second dtorootd. The Programs folder in the appcompat folder will be selected.
The script also has a dtorootf, so all the root files in the selected folder will be selected.
OK, with the selector, the drive, folder, and file objects supported by the haiyungo.com project can be shuttled from left to right. But what is the purpose? After learning about the next "filter", you can combine the "selector" with "filter!
Returned directory
2. Filters-Filter
Well, the selector mentioned above is to make certain selection operations in three basic objects (drives, folders, files. Filters are used to filter data objects.
The filtering operation is related to the corresponding data type. For example, files can be filtered by file extension, but folders cannot.
Early versions of the haiyunguo project included the following basic filters:
For drive types
None
For folder types
// Name
Name: name of the file without the extension (string comparison)
Full file name (string comparison)
EXT extension (string comparison)
Exteq extension matching
// Time
Tcret creation time (time comparison)
Tmod last modification time (time comparison)
Tacc last access time (time comparison)
// Size
Size file size (file size comparison)
For file types
// Name
Name folder name (string comparison)
Tcret creation time (time comparison)
Tmod last modification time (time comparison)
Tacc last access time (time comparison)
All the filtering functions related to the above drive are in the V namespace, all the filtering functions related to folders are in the D namespace, and the file filtering function is in the f namespace. Before talking about function parameters, I think it is necessary to look at several examples first. For example, we can see the filter of the folder name: D. Name. Let's do this. Select all the root folders under drive C (using the point selector knowledge learned above), and then filter all the folders starting with P. Then, filter the folders containing pro again in all folders starting with P.
The script should be written as follows:
Ver 1;
Setdata dir ['C: \ '];
Print 'initial Selection: Start with p ';
Dtorootd;
D. name begin 'P ';
Show;
Print 'select again: Include Pro ';
D. Name contain 'pro ';
Show;
Running result:
OK. The filter is successful!
For example, in the C: \ amd folder, filter all files with the extension TXT and XML, and use the above exteq function, script:
Ver 1;
Setdata dir ['C: \ amd '];
Dtoallf;
F. exteq ['txt ''xml'];
Show yes;
Result:
Returned directory
3. Execution progress display
For time-consuming operations, the haiyunguo project provides progress display. For example, to write such a script, select all files in drive C and drive D (using the dtoallf function)
Script:
Ver 1;
Setdata dir ['C: \ 'd: \ '];
Dtoallf;
Show;
As you can see, the progress of the haiyunguo project shows the total progress at the top. Because disk C and disk D are selected, you can see that the current and total number of tasks in the first progress are 1/2. The second progress shows more detailed display of the current task, for example, the specific file of the disk C is scanned.
Of course, an error message is displayed at the bottom (for example, some folders cannot be accessed ).
Returned directory
4. Filters with multiple conditions
Filters support multiple filters. The MC (multiple condition) function and endmc are used to implement multiple filter conditions. The parameters of the MC function are of multiple filtering types: or represents the relationship between "or", and represents the relationship between "and. Or, as long as one condition is true, the entire result will be true, and the result will be true only when all sub-conditions are true.
For example, this is the content of "new folder" under my e drive:
Delete some files to save space. The rule is as follows: all files larger than 1 MB and temporary files (files with the extension of TMP) will be deleted. As you can see, the above two files a. data and data. tmp meet the conditions.
Write the script using multiple filters as follows:
Ver 1;
Setdata dir ['e: \ create folder '];
Dtorootf;
MC or;
F. Size '1mb' '200gb ';
F. exteq ['tmp '];
Endmc;
Show;
Running result:
The multiple filters with the "and" type are equivalent to executing multiple common filters successively. For example, the above one "first filters all folders starting with P. Then, in all the folders starting with P, filter the folders containing pro again. You can use multiple filters to write them as follows:
Ver 1;
Setdata dir ['C: \ '];
Dtorootd;
MC and;
D. name begin 'P ';
D. Name contain 'pro ';
Endmc;
Show;
The execution result will be the same as above.
Returned directory
5. Inverse value and nested Filter
The inverse value filter is the inverse value of the filter. For example, if the filter is "contains XXX", the meaning of its inverse value filter is "does not contain xxx ". The implementation of the anti-value filter calls the RF function before the filter.
For example, select the root directory of drive C that does not contain:
Ver 1;
Setdata dir ['C: \ '];
Dtorootd;
RF;
D. Name contain 'a ';
Show;
The "nested filter" is actually to nest another multiple filter in one multiple filter. When writing, it is to understand the block from Mc to endmc as a filter.
Now we define a condition that either a contains B or a name that does not contain C is considered qualified.
We still use the root directory of drive C for the experiment, and write the script using nested filter and inverse filter as follows:
Ver 1;
Setdata dir ['C: \ '];
Dtorootd;
MC or;
MC and;
D. Name contain 'a ';
D. Name contain 'B ';
Endmc;
RF;
D. Name contain 'C ';
Endmc;
Show;
Result:
The last anti-value filter can also be used in multiple filters. The inverse proposition "containing a and B" is "not including A or B ", you can use two RF to define these two "not included", or you can use one RF to apply them in multiple filters, that is, before writing the RF into MC, the script:
RF;
MC and;
D. Name contain 'a ';
D. Name contain 'B ';
Endmc;
Returned directory
6. Software Download
Download the current version of the program
Note: This is an archive of Microsoft SkyDrive. Please download it directly in your browser. Some download tools may not be available for download.
Example program running environment:. NET Framework 3.0 (installed by default in Windows Vista and Windows 7)