WDXcontains content plugin.

Discuss and announce Total Commander plugins, addons and other useful tools here, both their usage and their development.

Moderators: white, Hacker, petermad, Stefan2

User avatar
fenix_productions
Power Member
Power Member
Posts: 1979
Joined: 2005-08-07, 13:23 UTC
Location: Poland
Contact:

WDXcontains content plugin.

Post by *fenix_productions »

WDXcontains plugin checks if specified file exists in directory and gives an information about it.

Displayed fields are:
- Line - content of the line specified in INI file,
- Contains - boolean value showing does directory contains the file,
- RegExpResult - regular expression result (see below).

Usage

Install this plugin and copy "wdxcontains.ini" file into TC's directory.
wdxcontains.ini wrote:[Options]
FileName=readme.txt
LineNumber=1
UseRegEx=false
Expression=(\d{2}[.]\d{2}[.]\d{2})[ ]
Options description:
- FileName - name of the file to be looked for (default: readme.txt);
- LineNumber - number of the line to be read and returned for "Line" field (default: 1);
- UseRegEx - boolean value telling should plugin use regular expressions for finding text string inside file; all lines are checked; first match returns value for "RegExpResult" field;
- Expression - regular expression to be checked;

Note, that by default plugin looks for brackets in expression and tries to return $1. In the case of no brackets whole expression is given.

Example 1
readme.txt wrote:this is sparta
sialala 12.35.44 bumcykcyk
date: 12.11.07
komibnerki sialala
wdxcontains.ini wrote:[Options]
FileName=readme.txt
LineNumber=1
UseRegEx=true
Expression=date: (\d{2}[.]\d{2}[.]\d{2})
Results wrote:Line=this is sparta
Contains=Yes
RegExpResult=12.11.07
Example 2
readme.txt wrote:this is sparta
sialala 12.35.44 bumcykcyk
date: 12.11.07
komibnerki sialala
wdxcontains.ini wrote:[Options]
FileName=readme.txt
LineNumber=4
UseRegEx=true
Expression=date: \d{2}[.]\d{2}[.]\d{2}
Results wrote:Line=komibnerki sialala
Contains=Yes
RegExpResult=date: 12.11.07
You can give a try and download this here:
http://cid-e12762cbdafb3c47.skydrive.live.com/self.aspx/TC/WDXcontains7.zip

Edit: 9th of September, 2008

Two new fields are available now:
- FilesRegExpResult - file's name regular expression result,
- ContainsFile - boolean value which informs does a folder contain searched file.

They can be configured using additional "wdxcontains.ini" parameters:
- ParseFileNames - should plugin parse folder's files names list (default: false),
- ParseWithDirs - include folders names (default: true),
- IncludeHidden - include hidden resources (default: false),
- FileNamesExpression - file's name expression to be looked for (default: "").

FileNamesExpression is handled the same way as Expression: plugin looks for brackets in expression and tries to return $1. In the case of no brackets whole expression is given.

Note
If "ParseFileNames" is set to true, plugin will create "wdxcontains" folder in %TEMP% path with "list.txt" file inside. This file contains all file names from searched folder. Mentioned temporary dir should be deleted automatically after returning needed value.


Special thanks to:

- chrizoo - for help with testing,
- m^2 - for help with VirtualQuery(),
- icfu - for reminding about INF.
Last edited by fenix_productions on 2008-09-09, 13:26 UTC, edited 2 times in total.
"When we created the poke, we thought it would be cool to have a feature without any specific purpose." Facebook...

#128099
icfu
Power Member
Power Member
Posts: 6052
Joined: 2003-09-10, 18:33 UTC

Post by *icfu »

The plugin is interesting, thanks, but being forced to put INI file in TC directory isn't really a good idea. You seem to use this approach in all of your plugins.

What about using the plugin's own directory by default and optionally (due to rights management) the wincmd.ini directory?

Icfu
This account is for sale
User avatar
fenix_productions
Power Member
Power Member
Posts: 1979
Joined: 2005-08-07, 13:23 UTC
Location: Poland
Contact:

Post by *fenix_productions »

This version should work with "wdxcontains.ini" in plugins folder:
http://cid-e12762cbdafb3c47.skydrive.live.com/self.aspx/TC/WDXcontains6.zip

Thanks to m^2 for help with VirtualQuery ;)
"When we created the poke, we thought it would be cool to have a feature without any specific purpose." Facebook...

#128099
icfu
Power Member
Power Member
Posts: 6052
Joined: 2003-09-10, 18:33 UTC

Post by *icfu »

Thanks, here is a suitable pluginst.inf. ;)

Code: Select all

[plugininstall]
description=WDXcontains - content plugin which checks if a specified file exists in a directory and returns information about it
descriptionDEU=WDXcontains - Inhaltsplugin, das überprüft, ob eine angegebene Datei in einem Verzeichnis existiert und Informationen darüber zurückgibt
type=wdx
file=WDXcontains.wdx
defaultdir=WDXcontains
Icfu
This account is for sale
User avatar
fenix_productions
Power Member
Power Member
Posts: 1979
Joined: 2005-08-07, 13:23 UTC
Location: Poland
Contact:

Post by *fenix_productions »

2icfu
Thanks. Archive updated.

Honestly: I've never thought that someone (except chrizoo) will use it often enough to need more features (like INF file) ;)

It's really nice to read You like it.
"When we created the poke, we thought it would be cool to have a feature without any specific purpose." Facebook...

#128099
icfu
Power Member
Power Member
Posts: 6052
Joined: 2003-09-10, 18:33 UTC

Post by *icfu »

Honestly: I've never thought that someone (except chrizoo) will use it often enough to need more features (like INF file)
The feature is unique until now according to my knowledge, so it will definetely be used by more than just two people, if you upload it to totalcmd.net and en.totalcmd.pl. ;)

Icfu
This account is for sale
User avatar
fenix_productions
Power Member
Power Member
Posts: 1979
Joined: 2005-08-07, 13:23 UTC
Location: Poland
Contact:

Post by *fenix_productions »

2icfu
Placing on totalcmd.pl depends on djk IIRC.
I know nothing about totalcmd.net. I've sent a couple of "account request" e-mails there in the past and I've never get any reply.

BTW I will change firts post a little bit later. Currently I am working on two additional fields. One of them is already available (since v.5).

Plugin will look for a file name matching the RegExp.
"When we created the poke, we thought it would be cool to have a feature without any specific purpose." Facebook...

#128099
icfu
Power Member
Power Member
Posts: 6052
Joined: 2003-09-10, 18:33 UTC

Post by *icfu »

You can reach Ergo from totalcmd.net by ICQ: 249932
Unfortunately he isn't online too often and offline messages he either ignores or doesn't receive.

djk is on ICQ as well: 13151345
If you point him to the plugins, he will list them. If they appear on totalcmd.net he will catch them too afaik.

Icfu
This account is for sale
User avatar
fenix_productions
Power Member
Power Member
Posts: 1979
Joined: 2005-08-07, 13:23 UTC
Location: Poland
Contact:

Post by *fenix_productions »

2icfu
I've already had djk's ICQ but thanks for all.
"When we created the poke, we thought it would be cool to have a feature without any specific purpose." Facebook...

#128099
User avatar
DrShark
Power Member
Power Member
Posts: 1872
Joined: 2006-11-03, 22:26 UTC
Location: Kyiv, 68/262
Contact:

Post by *DrShark »

Hi!

I hope I write to right topic now...

I want to do move dirs with programs, wich don't have uninstallers, to another drive.
That's what I have to do:
1) set 1 level deep for search in TC;
2) set 'Directory' on attriputes tab;

For third step I need content plugin to set value - file mask or name, for example *unins* because I need dirs without such files.

Step 4: 'Feed to listbox' them and move...

Your plugin, I guess, can be used to find dirs with some file, but I need an opposite task.
obsolete question wrote:fenix_productions, can you add such possibility (value !containsfile or any other for filename search) to your plugin?
EDIT:
Looks like I found how to use your plugin for it:
wdxcontains.ini wrote:[Options]
FileName=unins000.exe
and search template:
wincmd.ini wrote:uninst_SearchFor=*.*
uninst_SearchIn=C:\Program Files\
uninst_SearchText=
uninst_SearchFlags=0|000000000000||||||||00001|0000|0
uninst_plugin="wdxcontains.Contains = 0"
Looks like FileName doesnt support vales like *unins*
Is there a some workaround for it?
Donate for Ukraine to help stop Russian invasion!
Ukraine's National Bank special bank account:
UA843000010000000047330992708
User avatar
fenix_productions
Power Member
Power Member
Posts: 1979
Joined: 2005-08-07, 13:23 UTC
Location: Poland
Contact:

Post by *fenix_productions »

2DrShark
It looks like I will have to cleanup this plugin a little bit...

FileName parameter accepts the name of the file to be parsed in searching for specific text occurrences and it does not support neither wild-cards nor RegExp.

The thing you need is the last field which tells you is the file specified in "FileNamesExpression" available. Try to make regular expression for this parameter.

I haven't tested but it might work for:
wdxcontains.ini wrote:ParseFileNames=true
ParseWithDirs=true
IncludeHidden=true
FileNamesExpression=.*(unins).*
If you need to find a dir without such files then set Plugins tab for:
Find files wrote:Plugin: wdxcontains
Property: ContainsFile
OP: =
Value: No
PS. FileNamesExpression=(.*unins.*) might be a better choice because that way you should see matching name in FilesRegExpResult field.
"When we created the poke, we thought it would be cool to have a feature without any specific purpose." Facebook...

#128099
User avatar
DrShark
Power Member
Power Member
Posts: 1872
Joined: 2006-11-03, 22:26 UTC
Location: Kyiv, 68/262
Contact:

Post by *DrShark »

fenix_productions wrote:... FileNamesExpression=(.*unins.*) might be a better choice because that way you should see matching name in FilesRegExpResult field.
It works, thanks!
However, it works case sensitive: finds "unintall.exe" but doesnt find "Uninstall.exe". To handle both cases it should be changed to:
wdxcontains.ini wrote:FileNamesExpression=(?i)(.*unins.*)(?i)
Donate for Ukraine to help stop Russian invasion!
Ukraine's National Bank special bank account:
UA843000010000000047330992708
User avatar
fenix_productions
Power Member
Power Member
Posts: 1979
Joined: 2005-08-07, 13:23 UTC
Location: Poland
Contact:

Post by *fenix_productions »

2DrShark
Or overkill:

Code: Select all

(.*[uU][nN][iI][nN][sS].*)
"When we created the poke, we thought it would be cool to have a feature without any specific purpose." Facebook...

#128099
User avatar
DrShark
Power Member
Power Member
Posts: 1872
Joined: 2006-11-03, 22:26 UTC
Location: Kyiv, 68/262
Contact:

Post by *DrShark »

Is it possible to configure FileNamesExpression to find several expressions, e.g. my (?i)(.*unins.*)(?i) and unwise.exe at once?
Donate for Ukraine to help stop Russian invasion!
Ukraine's National Bank special bank account:
UA843000010000000047330992708
User avatar
fenix_productions
Power Member
Power Member
Posts: 1979
Joined: 2005-08-07, 13:23 UTC
Location: Poland
Contact:

Post by *fenix_productions »

DrShark wrote:Is it possible to configure FileNamesExpression to find several expressions, e.g. my (?i)(.*unins.*)(?i) and unwise.exe at once?
This will find (?i)(.*unins.*)(?i) or unwise.exe:

Code: Select all

FileNamesExpression=(?i)((.*unins.*)|(unwise[.]exe))(?i)
"When we created the poke, we thought it would be cool to have a feature without any specific purpose." Facebook...

#128099
Post Reply