end2endzone / ShellAnything

ShellAnything is a C++ open-source software which allow one to easily customize and add new options to *Windows Explorer* context menu. Define specific actions when a user right-click on a file or a directory.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Set a property value from the content of a file

end2endzone opened this issue · comments

Is your feature request related to a problem? Please describe.
It would be useful to be able to set a property from the content of a file.

Describe the solution you'd like

<property name="content" file="C:\foo\bar\baz.txt" />

Describe alternatives you've considered
There is no alternative for this feature.

Additional context
This feature would allow people to do advanced property manipulation such as

<menu name="Copy file content">
  <visibility maxfiles="1" maxfolders="0" />
  <actions>
    <property name="selection.file.content" file="${selection.path}" />
  </actions>
</menu>

or to copy the result of an <exec> element as a property with something such as

<menu name="Capture exec output">
  <actions>
    <exec path="cmd.exe" arguments="/C dir /b &quot;%USERPROFILE%\Documents&quot;> &quot;${temp}\command_output.txt&quot;" />
    <property name="filenames" file="${temp}\command_output.txt" />
  </actions>
</menu>

The feature does also require an optional filesize attribute. The attribute should be used to define how much of a file (in bytes) can be loaded as a property value. This attribute would prevent loading a huge file in memory by mistake. By default the filesize value should be set to 4096 bytes. If you want to load a file that is bigger than the default, then one has to manually specify a filesize value.

For example, to read the first 10 kb of a file :

<property name="selection.file.content" file="${selection.path}" filesize="10240" />

A special value of 0 would tell the application to load the whole file. For example :

<property name="selection.file.content" file="${selection.path}" filesize="0" />