Skip to content

Commit 496c8f7

Browse files
committed
* Fixed issue #90: New property for detecting empty directories.
* Fixed issue #100: Visibility/Validity attribute istrue and isfalse for validation against boolean properties.
1 parent a5c49ff commit 496c8f7

File tree

10 files changed

+512
-33
lines changed

10 files changed

+512
-33
lines changed

CHANGES

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,14 @@ Changes for 0.7.0
44
* Using [File for Windows](https://github.com/Cirn09/file-windows) v5.38 with minimal changes.
55
* Using [PCRE2](http://www.pcre.org/) version 10.30
66
* Deprecated support for 32-bit Windows.
7-
* Fixed issue #59: Implement a new type of separator for creating a menu with multiple columns.
8-
* Fixed issue #91: String encoding in source code.
9-
* Fixed issue #92: New property for detecting file type based on content.
10-
* Fixed issue #96: Problems with Files > 2Gb
11-
* Fixed issue #97: Files and folders together do not start MENU.
12-
* Fixed issue #98: Show only one log warning message about missing icon for a file extension.
7+
* Fixed issue #59: Implement a new type of separator for creating a menu with multiple columns.
8+
* Fixed issue #90: New property for detecting empty directories.
9+
* Fixed issue #91: String encoding in source code.
10+
* Fixed issue #92: New property for detecting file type based on content.
11+
* Fixed issue #96: Problems with Files > 2Gb
12+
* Fixed issue #97: Files and folders together do not start MENU.
13+
* Fixed issue #98: Show only one log warning message about missing icon for a file extension.
14+
* Fixed issue #100: Visibility/Validity attribute istrue and isfalse for validation against boolean properties.
1315

1416

1517
Changes for 0.6.1

UserManual.md

Lines changed: 75 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ This manual includes a description of the system functionalities and capabilitie
1919
* [exists attribute](#exists-attribute)
2020
* [properties attribute](#properties-attribute)
2121
* [exprtk attribute](#exprtk-attribute)
22+
* [istrue attribute](#istrue-attribute)
23+
* [isfalse attribute](#isfalse-attribute)
2224
* [inverse attribute](#inverse-attribute)
2325
* [Combining multiple <visibility> and <validity> elements](#combining-multiple-visibility-and-validity-elements)
2426
* [Icons](#icons)
@@ -445,6 +447,46 @@ The `exprtk` attribute uses the *exprtk library* to parse the expression. For mo
445447

446448

447449

450+
### istrue attribute: ###
451+
452+
The `istrue` attribute validates a menu if the specified value evaluates to *true*.
453+
454+
If `istrue` attribute is set, the application will evaluate the given value. If the value evaluates to *true*, the validation is successful. To specify multiple values, one must separate each value with the `;` character. If multiple values are specified, **all values** must evaluates to *true* for the validation to be successful.
455+
456+
If `istrue` attribute is not specified, then the validation is successful.
457+
458+
For example, the following set a menu visible only when the property `initialized` evaluates to *true*:
459+
```xml
460+
<visibility istrue="${initialized}" />
461+
```
462+
463+
The following values evaluates to *true* : `true`, `yes`, `ok`, `on` and `1`. The evaluation is case insensitive. All other values **does not** evaluates to true and will fail the validation.
464+
465+
For systems that are not configured in English, your system may use another value for *true*. For such system, ShellAnything has defined property `system.true` which allows one to set the property to the same value as `Yes` but in your system native language.
466+
For example, you can set property `system.true` to `是的`, ``, `हां`, `sim`, `да`, `はい`, `oui` or `ja`.
467+
468+
469+
470+
### isfalse attribute: ###
471+
472+
The `isfalse` attribute validates a menu if the specified value evaluates to *false*.
473+
474+
If `isfalse` attribute is set, the application will evaluate the given value. If the value evaluates to *false*, the validation is successful. To specify multiple values, one must separate each value with the `;` character. If multiple values are specified, **all values** must evaluates to *false* for the validation to be successful.
475+
476+
If `isfalse` attribute is not specified, then the validation is successful.
477+
478+
For example, the following set a menu visible only when the property `initialized` evaluates to *false*:
479+
```xml
480+
<visibility isfalse="${initialized}" />
481+
```
482+
483+
The following values evaluates to *false* : `false`, `no`, `fail`, `off` and `0`. The evaluation is case insensitive. All other values **does not** evaluates to false and will fail the validation.
484+
485+
For systems that are not configured in English, your system may use another value for *false*. For such system, ShellAnything has defined property `system.false` which allows one to set the property to the same value as `No` but in your system native language.
486+
For example, you can set property `system.false` to ``, `नहीं`, `não`, `нет`, `いいえ`, `non` or `Nein`.
487+
488+
489+
448490
### inverse attribute: ###
449491

450492
The `inverse` attribute inverts the logic of one or multiple attributes. For example, to inverse the meaning of the `maxfiles` attribute, set `inverse` attribute to the value `maxfiles`.
@@ -464,6 +506,9 @@ The meaning of each inversed attribute in explained in the following table:
464506
| pattern | Validates a menu if the selected file or directory **does not** match the wildcard pattern matching algorithm.<br>If multiple patterns are specified, **no pattern** must match the selected files for the validation to be successful. |
465507
| exists | Validates a menu if the selected file or directory **does not** exists.<br>If multiple files/directories are specified, **all values** must _not exists_ on the system for the validation to be successful. |
466508
| properties | Validates a menu if the specified property is **empty** or **not defined**.<br>If multiple properties are specified, **all properties** must be _empty_ or _not defined_ for the validation to be successful. |
509+
| exprtk | Validates a menu if the given string expression **does not** evaluates to logical _true_.<br>If multiple expressions are specified, **no expression** must evaluate to logical _true_ for the validation to be successful. |
510+
| istrue | Validates a menu if the given value **does not** evaluates to logical _true_.<br>If multiple values are specified, **no value** must evaluate to logical _true_ for the validation to be successful. |
511+
| isfalse | Validates a menu if the given value **does not** evaluates to logical _false_.<br>If multiple values are specified, **no value** must evaluate to logical _false_ for the validation to be successful. |
467512

468513
Typical use case of the `inverse` attribute is about filtering out known file extensions.
469514

@@ -512,7 +557,7 @@ The validity element should look like this:
512557

513558
Multiple &lt;visibility&gt; or &lt;validity&gt; elements can be added under a &lt;menu&gt; element. The logical `or` operator is used with each element of the same type. In other words, &lt;visibility&gt; elements are evaluated together and so are &lt;validity&gt; elements. This feature allows combining elements to achieve more complex validation.
514559

515-
For example, the following set a menu visible of if only a single file is selected ***or*** if only a single directory is selected:
560+
For example, the following set a menu visible if only a single file is selected ***or*** if only a single directory is selected:
516561
```xml
517562
<visibility maxfiles="1" maxfolders="0" />
518563
<visibility maxfiles="0" maxfolders="1" />
@@ -1070,26 +1115,36 @@ The application provides a list of dynamic properties. The values of these prope
10701115

10711116
The following table defines the list of dynamic properties and their utility:
10721117

1073-
| Property | Description |
1074-
|------------------------------|-------------------------------------------------------------------------------------------------------------------|
1075-
| selection.path | Matches the full path of the clicked element. |
1076-
| selection.dir | Matches the directory of the clicked element. |
1077-
| selection.filename | Matches the filename of the clicked element. |
1078-
| selection.filename.noext | Matches the filename of the clicked element without the file extension. |
1079-
| selection.parent.path | Matches the full path of the parent element. |
1080-
| selection.parent.filename | Matches the filename of the parent element. |
1081-
| selection.filename.extension | Matches the file extension of the clicked element. |
1082-
| selection.drive.letter | Matches the drive letter of the clicked element. For example 'C'. |
1083-
| selection.drive.path | Matches the drive path of the clicked element. For example 'C:\'. |
1084-
| selection.count | Matches the number of clicked elements (files and directories). |
1085-
| selection.files.count | Matches the number of clicked files. |
1086-
| selection.directories.count | Matches the number of clicked directories. |
1087-
| selection.mimetype | Matches the [MIME type](https://en.wikipedia.org/wiki/Media_type) of the selected file. See below for examples. |
1088-
| selection.description | Matches a general description of the file's content. See below for examples. |
1089-
| selection.charset | Matches the [Character Set](https://www.w3schools.com/html/html_charset.asp) of the file. See below for examples. |
1118+
| Property | Description |
1119+
|------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
1120+
| selection.path | Matches the full path of the clicked element. |
1121+
| selection.dir | Matches the directory of the clicked element. When selecting a file, matches the directory of the clicked element. When selecting a directory, matches the path of the clicked element. |
1122+
| selection.dir.count | Matches the number of files and directories in directory `selection.dir`. |
1123+
| selection.dir.empty | Set to `true` when directory `selection.dir` is empty. Set to `false` otherwise. |
1124+
| selection.filename | Matches the filename of the clicked element. |
1125+
| selection.filename.noext | Matches the filename of the clicked element without the file extension. |
1126+
| selection.parent.path | Matches the full path of the parent element. |
1127+
| selection.parent.filename | Matches the filename of the parent element. |
1128+
| selection.filename.extension | Matches the file extension of the clicked element. |
1129+
| selection.drive.letter | Matches the drive letter of the clicked element. For example `C`. |
1130+
| selection.drive.path | Matches the drive path of the clicked element. For example `C:\`. |
1131+
| selection.count | Matches the number of clicked elements (files and directories). |
1132+
| selection.files.count | Matches the number of clicked files. |
1133+
| selection.directories.count | Matches the number of clicked directories. |
1134+
| selection.mimetype | Matches the [MIME type](https://en.wikipedia.org/wiki/Media_type) of the selected file. [See below](#mime-types-general-description-and-charset) for examples. |
1135+
| selection.description | Matches a general description of the file's content. See below for examples. |
1136+
| selection.charset | Matches the [Character Set](https://www.w3schools.com/html/html_charset.asp) of the file. [See below](#mime-types-general-description-and-charset) for examples. |
10901137

10911138
Selection-based properties are encoded in utf-8.
10921139

1140+
**Notes:**
1141+
Properties `selection.drive.letter` and `selection.drive.path` are empty when user select files from a network share.
1142+
1143+
Properties `selection.dir.count` and `selection.dir.empty` are empty when multiple elements are selected.
1144+
1145+
The properties `selection.mimetype`, `selection.description` and `selection.mimetype` are based on the content of the selected file. The properties are provided by the *File* and *Libmagic* libraries to extract information about selected files. For more details, see the documentation at [github.com/Cirn09/file-windows](https://github.com/Cirn09/file-windows), [github.com/file/file](https://github.com/file/file) or the [official file documentation](http://www.darwinsys.com/file/).
1146+
1147+
10931148
### MIME types, general description and charset: ###
10941149

10951150
A MIME type is a label used to identify a type of data. It is used so software can know how to handle the data. It serves the same purpose on the Internet that file extensions do on Microsoft Windows. A MIME type is calculated from the actual content in a file.
@@ -1131,12 +1186,6 @@ Another option is to create your own *Configuration* and add the following menu
11311186
Press `CTRL+C` when the message is shown to copy the values to the clipboard.
11321187

11331188

1134-
**Notes:**
1135-
Properties `selection.drive.letter` and `selection.drive.path` are empty when user select files from a network share.
1136-
1137-
The properties `selection.mimetype`, `selection.description` and `selection.mimetype` are based on the content of the selected file. The properties are provided by the *File* and *Libmagic* libraries to extract information about selected files. For more details, see the documentation at [github.com/Cirn09/file-windows](https://github.com/Cirn09/file-windows), [github.com/file/file](https://github.com/file/file) or the [official file documentation](http://www.darwinsys.com/file/).
1138-
1139-
11401189

11411190
## Multi-selection-based properties ##
11421191

@@ -1160,8 +1209,9 @@ The system will generates the following property values (note the `\r\n` charact
11601209
| selection.drive.letter | C`\r\n`C`\r\n`C |
11611210
| selection.drive.path | C:\\`\r\n`C:\\`\r\n`C:\\ |
11621211

1163-
Notes:
1212+
**Notes:**
11641213
* Properties `selection.drive.letter` and `selection.drive.path` are empty when all selected files are from a network share.
1214+
* Properties `selection.dir.count` and `selection.dir.empty` are empty when multiple files are selected.
11651215
* Properties `selection.count`, `selection.files.count` and `selection.directories.count` are not multi-selection-based properties. They are defined as a single value whether a single or multiple elements are selected.
11661216

11671217

0 commit comments

Comments
 (0)