MLDirTools Plugin

From Cinemar Wiki
Jump to: navigation, search

About

Provides various file and directory-querying functions. See accompanying text file for descriptions of commands - description was too long to fit in this dialog.


Software Requirements

MLServer3

MLDirTools Plugin


Installation

MLDirTools comes within the MainLobby3 Server installation. When you install MLServer3, make sure MLDirTools is checked and it will be installed as a plugin during your MLServer3 installation. If you want to add it post MLServer3 installation, just rerun the MLServer3 installation.

Command Syntax

MLDirTools|<<command>>~<<output variable name>>~<<directory>>[~<<param1>>[~<<param2>>]]

example:

MLDirTools|Exists~Foo~C:\Windows

will set variable Foo to True if the directory C:\Windows exists, or False otherwise

example:

MLDirTools|NumFiles~Foo~C:\Program Files

will set variable Foo to the number of files in C:\Program Files


Note:


Hidden files and folders are not returned or counted.


Implemented Functions

DRIVELIST

Returns the available drive letters, delimited by |

example: MLDirTools|DriveList~Foo

result: Variable Foo is set to A|C|D|E|F in a system with drives A, C, D, E and F


EXISTS

Returns the string True if the specified directory exists, the string False otherwise

example: MLDirTools|Exists~Foo~C:\Program Files\Cinemar

result: Variable Foo is set True if the directory C:\Program Files\Cinemar exists, or False otherwise.


NUMFILES Returns the number of files in the specified directory. Returns 0 if the specified directory doesn't exist.

example: MLDirTools|NumFiles~Foo~C:\ result: Varaible Foo is set to number of files in the root of C:


NUMDIRS or NUMFOLDERS

Returns the number of subdirectories in the specified directory. Returns 0 if the specified directory doesn't exist.

example: MLDirTools|NumDirs~Foo~C:\

result: Varaible Foo is set to number of subdirectories in the root of C: (not counting the . and .. pointers)


FIND

Returns the first (or param2-th if specified) subdirectory under parent directory (param1) matching the specified directory.

The standard DOS * and ? wildcards may be used in the directory specification If no subdirectory matches, empty string is returned

example: MLDirTools|Find~Foo~Cine*~C:\Program Files

result: Variable Foo is set to Cinemar, if there is no other cine* directory before it


DIRLIST or FOLDERLIST

Returns the names of subdirectories of the specified directory, separated by |, optionally filtered by param1

The standard DOS * and ? wildcards may be used in optional param1 to filter the returned list. Optional param2 set to 1, Full or True will return the full path (ex C:\Program Files\Cinemar) instead of just the directory name (ex Cinemar) Returns empty string if the directory does not contain subdirectories

example: MLDirTools|DirList~Foo~C:\Program Files\Cinemar

result: Variable Foo is set to a list of subdirectory names in the format subdir1|subdir2|subdir3|...subdirN

In my case this returns the string BackgroundFX|images|Library|MLServer|OverlayFX|RemoteFX|screensavers|skins|support|swf DOS equivalent: DIR /B /A:D "C:\Program Files\Cinemar"

example: MLDirTools|DirList~Foo~C:\Program Files\Cinemar~*FX

result: Variable Foo is set to a list of subdirectory names matching *FX in the format subdir1|subdir2|subdir3|...subdirN

In my case this returns the string BackgroundFX|OverlayFX|RemoteFX DOS equivalent: DIR /B /A:D "C:\Program Files\Cinemar\*FX"

example: MLDirTools|DirList~Foo~C:\Program Files\Cinemar~*FX~Full

example2: MLDirTools|DirList~Foo~C:\Program Files\Cinemar~*FX~1

result: Variable Foo is set to a list of subdirectory names matching *FX in the format subdir1|subdir2|subdir3|...subdirN

In my case this returns the string C:\Program Files\Cinemar\BackgroundFX|C:\Program Files\Cinemar\OverlayFX|C:\Program Files\Cinemar\RemoteFX

DOS equivalent: n/a (non-recursive lists don't display paths)


DIRTREE or FOLDERTREE

Returns the names of all subdirectories (recursively) of the specified directory, separated by |, optionally filtered by param1

The standard DOS * and ? wildcards may be used in optional param1 to filter the returned list

Optional param2 set to 1, Full or True will return the full path (ex C:\Program Files\Cinemar) instead of just the directory name (ex Cinemar)

Optional param2 set to 2 or Relative will return the relative path (ex support\nirvis\Device Files) instead of just the directory name (ex Device Files)

Returns empty string if the directory does not contain subdirectories

example: MLDirTools|DirTree~Foo~C:\Program Files\Cinemar

result: Variable Foo is set to a list of subdirectory names in the format subdir1|subdir2|subdir3|...subdirN

In my case this returns the string Sony|Device Files|nirvis|FreeBonus|BackgroundFX|documentation|images|Library|OverlayFX|RemoteFX|screensavers|skins|support|swf DOS equivalent: n/a (recursive lists always display paths)

example: MLDirTools|DirTree~Foo~C:\Program Files\Cinemar~*s

result: Variable Foo is set to a list of subdirectory names matching *s in the format subdir1|subdir2|subdir3|...subdirN

In my case this returns the string Device Files|nirvis|FreeBonus|images|screensavers|skins DOS equivalent: n/a (recursive lists always display paths)

example: MLDirTools|DirTree~Foo~C:\Program Files\Cinemar~*s~Full

example2: MLDirTools|DirTree~Foo~C:\Program Files\Cinemar~*s~1

example3: MLDirTools|DirTree~Foo~C:\Program Files\Cinemar~*s~True

result: Variable Foo is set to a list of subdirectory names matching *s in the format subdir1|subdir2|subdir3|...subdirN

In my case this returns the string C:\Program Files\Cinemar\support\nirvis\Device Files|C:\Program Files\Cinemar\support\nirvis|C:\Program Files\Cinemar\swf\FreeBonus|C:\Program Files\Cinemar\images|C:\Program Files\Cinemar\screensavers|C:\Program Files\Cinemar\skins

DOS equivalent: DIR /B /A:D /S "C:\Program Files\Cinemar\*s"

example: MLDirTools|DirTree~Foo~C:\Program Files\Cinemar~*s~Relative

example2: MLDirTools|DirTree~Foo~C:\Program Files\Cinemar~*s~1

result: Variable Foo is set to a list of subdirectory names matching *s in the format subdir1|subdir2|subdir3|...subdirN

In my case this returns the string \support\nirvis\Device Files|\support\nirvis|\swf\FreeBonus|\images|\screensavers|\skins

DOS equivalent: n/a (recursive lists always display full paths)

Note: The provided start directory is stripped from the result, so if you provide C:\Program Files\Cinemar\ with the trailing backslash, you get the result above, but without the leading backslashes in the results.


FILELIST or LIST

Returns the names of files in the specified directory, separated by |, optionally filtered by param1

The standard DOS * and ? wildcards may be used in optional param1 to filter the returned list

Optional param2 set to 1, Full or True will return the full path (ex C:\Program Files\Cinemar) instead of just the file name (ex Cinemar)

Returns empty string if the directory is empty or does not exist

example: MLDirTools|FileList~Foo~C:\Program Files\Cinemar

result: Variable Foo is set to a list of filenames in the format file1|file2|file3|...fileN

In my case this returns a string starting with BackgroundFX_sample.mls|dvdlobby3.ini|dvdlobby3.mls|dvdlobby3.swf and a whole bunch of other files.

DOS equivalent: DIR /A:F "C:\Program Files\Cinemar"

example: MLDirTools|FileList~Foo~C:\Program Files\Cinemar~*.ini

result: Variable Foo is set to a list of filenames matching *.ini in the format file1|file2|file3|...fileN

In my case this returns the string dvdlobby3.ini|mainlobby.ini|mlserverconnect.ini

DOS equivalent: DIR /A:F "C:\Program Files\Cinemar\*.ini"

example: MLDirTools|FileList~Foo~C:\Program Files\Cinemar~*.ini~Full

example2: MLDirTools|FileList~Foo~C:\Program Files\Cinemar~*.ini~1

result: Variable Foo is set to a list of filenames matching *.ini in the format file1|file2|file3|...fileN

In my case this returns the string C:\Program Files\Cinemar\dvdlobby3.ini|C:\Program Files\Cinemar\mainlobby.ini|C:\Program Files\Cinemar\mlserverconnect.ini

DOS equivalent: n/a (non-recursive lists don't display paths)


FILETREE

Returns the names of files in the specified directory and its subdirectories (recursively), separated by |, optionally filtered by param1

The standard DOS * and ? wildcards may be used in optional param1 to filter the returned list

Optional param2 set to 1, Full or True will return the full path (ex C:\Program Files\Cinemar\mainlobby.ini) instead of just the file name (ex mainlobby.ini)

Optional param2 set to 2 or Relative will return the relative path (ex Cinemar\mainlobby.ini) instead of just the file name (ex mainlobby.ini)

Returns empty string if the directory is empty or does not exist

example: MLDirTools|FileTree~Foo~C:\Program Files\Cinemar

result: Variable Foo is set to a list of filenames in the format file1|file2|file3|...fileN

In my case this returns a string starting with 1024x768_textplate.swf|1024x768_textplate_center.swf|1024x768_textplate_centerheader.swf|1366x768_bkgdfx03.swf and a whole bunch of other files.

DOS equivalent: n/a (recursive lists always display paths)

example: MLDirTools|FileTree~Foo~C:\Program Files\Cinemar~*.ini

result: Variable Foo is set to a list of filenames matching *.ini in the format file1|file2|file3|...fileN

In my case this returns the string genericvcr.ini|dvdlobby3.ini|mainlobby.ini|mlserverconnect.ini|tvlobby.ini

DOS equivalent: n/a (recursive lists always display paths)

example: MLDirTools|FileTree~Foo~C:\Program Files\Cinemar~*.ini~Full

example2: MLDirTools|FileTree~Foo~C:\Program Files\Cinemar~*.ini~1

result: Variable Foo is set to a list of filenames matching *.ini in the format file1|file2|file3|...fileN

In my case this returns the string C:\Program Files\Cinemar\RemoteFX\genericvcr.ini|C:\Program Files\Cinemar\dvdlobby3.ini|C:\Program Files\Cinemar\mainlobby.ini|C:\Program Files\Cinemar\mlserverconnect.ini|C:\Program Files\Cinemar\tvlobby.ini

DOS equivalent: DIR /A:F /S "C:\Program Files\Cinemar\*.ini"

example: MLDirTools|FileTree~Foo~C:\Program Files\Cinemar~*.ini~Relative

example2: MLDirTools|FileTree~Foo~C:\Program Files\Cinemar~*.ini~2

result: Variable Foo is set to a list of filenames matching *.ini in the format file1|file2|file3|...fileN

In my case this returns the string \RemoteFX\genericvcr.ini|\dvdlobby3.ini|\Cinemar\mainlobby.ini|\mlserverconnect.ini|\tvlobby.ini

DOS equivalent: n/a (recursive lists always display full paths)

Note: The provided start directory is stripped from the result, so if you provide C:\Program Files\Cinemar\ with the trailing backslash, you get the result above, but without the leading backslashes in the results.


FULLLIST

Returns the names of subdirectories and files in the specified directory, separated by | (directories are listed first, followed by files), optionally filtered by param1

The standard DOS * and ? wildcards may be used in optional param1 to filter the returned list

Optional param2 set to 1, Full or True will return the full path (ex C:\Program Files\Cinemar) instead of just the directory name (ex Cinemar)

Returns empty string if the directory is empty or does not exist

example: MLDirTools|FullList~Foo~C:\Program Files\Cinemar

result: Variable Foo is set to a list of names in the format subdir1|subdir2|subdir3|..dirN|file1|file2|file3|...fileN

In my case this returns a string starting with BackgroundFX_sample.mls|dvdlobby3.ini|dvdlobby3.mls|dvdlobby3.swf and a whole bunch of other files.

example: MLDirTools|FullList~Foo~C:\Program Files\Cinemar~*.swf

result: Variable Foo is set to a list of names matching *.swf in the format subdir1|subdir2|subdir3|..dirN|file1|file2|file3|...fileN

In my case this returns the string dvdlobby3.swf|dvdlobby3_t2.swf|dvdlobby3_tv.swf|mlserverconnect.swf

example: MLDirTools|FullList~Foo~C:\Program Files\Cinemar~*.swf~Full

example2: MLDirTools|FullList~Foo~C:\Program Files\Cinemar~*.swf~1

result: Variable Foo is set to a list of names matching *.swf in the format subdir1|subdir2|subdir3|..dirN|file1|file2|file3|...fileN

In my case this returns the string C:\Program Files\Cinemar\dvdlobby3.swf|C:\Program Files\Cinemar\dvdlobby3_t2.swf|C:\Program Files\Cinemar\dvdlobby3_tv.swf|C:\Program Files\Cinemar\mlserverconnect.swf


FULLTREE

Returns the names of subdirectories and files in the specified directory and its subdirectories (recursively), separated by | (directories are listed first, followed by files), optionally filtered by param1

The standard DOS * and ? wildcards may be used in optional param1 to filter the returned list

Optional param2 set to 1, Full or True will return the full path (ex C:\Program Files\Cinemar) instead of just the name (ex Cinemar)

Optional param2 set to 2 or Relative will return the relative path (ex Cinemar\mainlobby.ini) instead of just the file name (ex mainlobby.ini)

Returns empty string if the directory is empty or does not exist

example: MLDirTools|FullTree~Foo~C:\Program Files\Cinemar

result: Variable Foo is set to a list of names in the format subdir1|subdir2|subdir3|..dirN|file1|file2|file3|...fileN

In my case this returns a string starting with Sony|Device Files|nirvis|FreeBonus|BackgroundFX|documentation|images|Library|OverlayFX|RemoteFX|screensavers|skins|support|swf|1024x768_textplate.swf|1024x768_textplate_center.swf and a whole bunch of other files.

example: MLDirTools|FullTree~Foo~C:\Program Files\Cinemar~d*

result: Variable Foo is set to a list of names matching d* in the format subdir1|subdir2|subdir3|..dirN|file1|file2|file3|...fileN

In my case this returns the string Device Files|documentation|drivewaysecurity.jpg|dvdlobby3.ini|dvdlobby3.mls|dvdlobby3.swf|dvdlobby3_t2.mls|dvdlobby3_t2.swf|dvdlobby3_tv.mls|dvdlobby3_tv.swf|dvd_spacer.jpg

example: MLDirTools|FullTree~Foo~C:\Program Files\Cinemar~d*~Full

example2: MLDirTools|FullTree~Foo~C:\Program Files\Cinemar~d*~1

result: Variable Foo is set to a list of names matching d* in the format subdir1|subdir2|subdir3|..dirN|file1|file2|file3|...fileN

In my case this returns the string C:\Program Files\Cinemar\support\nirvis\Device Files|C:\Program Files\Cinemar\documentation|C:\Program Files\Cinemar\skins\drivewaysecurity.jpg|C:\Program Files\Cinemar\dvdlobby3.ini|C:\Program Files\Cinemar\dvdlobby3.mls|C:\Program Files\Cinemar\dvdlobby3.swf|C:\Program Files\Cinemar\dvdlobby3_t2.mls|C:\Program Files\Cinemar\dvdlobby3_t2.swf|C:\Program Files\Cinemar\dvdlobby3_tv.mls|C:\Program Files\Cinemar\dvdlobby3_tv.swf|C:\Program Files\Cinemar\dvd_spacer.jpg

example: MLDirTools|FullTree~Foo~C:\Program Files\Cinemar~d*~Relative

example2: MLDirTools|FullTree~Foo~C:\Program Files\Cinemar~d*~2

result: Variable Foo is set to a list of names matching d* in the format subdir1|subdir2|subdir3|..dirN|file1|file2|file3|...fileN

In my case this returns the string \support\nirvis\Device Files|\documentation|\skins\drivewaysecurity.jpg|\dvdlobby3.ini|\dvdlobby3.mls|\dvdlobby3.swf|\dvdlobby3_t2.mls|\dvdlobby3_t2.swf|\dvdlobby3_tv.mls|\dvdlobby3_tv.swf|\dvd_spacer.jpg

Note: The provided start directory is stripped from the result, so if you provide C:\Program Files\Cinemar\ with the trailing backslash, you get the result above, but without the leading backslashes in the results.


GETDIR or GETFOLDER

Returns the name of the param1-th subdirectory of the specified directory, optionally filtered by param1

The standard DOS * and ? wildcards may be used in optional param1 to filter the returned list

example: MLDirTools|GetDir~Foo~C:\Program Files~3

result: Variable Foo is set to the name of the third subdirectory of C:\Program Files

example: MLDirTools|GetDir~Foo~C:\Program Files~3~Windows*

result: Variable Foo is set to the name of the third subdirectory of C:\Program Files starting with W which Windows Media Player for most folks


GETFILE

Returns the name of the param1-th file in the specified directory

example: MLDirTools|GetFile~Foo~C:\Program Files~3

result: Variable Foo is set to the name of the third file in C:\Program Files


The following functions use Regular Expressions as the filter/search instead of standard ? and * wildcards (the appropriate filter parameter is required for these functions)

FINDREGEX

Returns the first (or param2-th if specified) subdirectory under parent directory (param1) matching the specified directory

The directory specification should be formulated as a regular expression

If no subdirectory matches, empty string is returned

example: MLDirTools|FindRegEx~Foo~CD[0-9]~C:\Program Files

result: Variable Foo is set to the first subdirectory named CD0, CD1, CD2, CD3, ... or CD9. If no such subdirectory exists, it is empty string


DIRLISTREGEX or FOLDERLISTREGEX

Returns the names of subdirectories of the specified directory, separated by |, filtered by param1

The param1 filter should be formulated as a regular expression

Returns empty string if the directory does not contain subdirectories

Optional param2 set to 1, Full or True will return the full path (ex C:\Program Files\Cinemar) instead of just the directory name (ex Cinemar)

example: MLDirTools|DirListRegEx~Foo~C:\Program Files\Cinemar~.*FX|ML.*

result: Variable Foo is set to a list of subdirectory names that end in FX or begin with ML in the format subdir1|subdir2|subdir3|...subdirN

In my case this returns the string BackgroundFX|MLServer|OverlayFX|RemoteFX


FILELISTREGEX or LISTREGEX

Returns the names of files in the specified directory, separated by |, filtered by param1

The param1 filter should be formulated as a regular expression

Returns empty string if the directory is empty or does not exist

Optional param2 set to 1, Full or True will return the full path (ex C:\Program Files\Cinemar) instead of just the directory name (ex Cinemar)

example: MLDirTools|FileListRegEx~Foo~C:\Program Files\Cinemar~^(ML).*\.swf$|^(DVD).*\.swf$

result: Variable Foo is set to a list of .SWF files that start with ML or DVD in the format file1|file2|file3|...fileN

In my case this returns the string dvdlobby3.swf|dvdlobby3_t2.swf|dvdlobby3_tv.swf|mlserverconnect.swf


FULLLISTREGEX

Returns the names of subdirectories and files in the specified directory, separated by | (directories are listed first, followed by files), filtered by param1

The param1 filter should be formulated as a regular expression

Optional param2 set to 1, Full or True will return the full path (ex C:\Program Files\Cinemar) instead of just the directory name (ex Cinemar)

Optional param2 set to 2 or Relative will return the relative path (ex Cinemar\mainlobby.ini) instead of just the file name (ex mainlobby.ini)

Returns empty string if the directory is empty or does not exist

example: MLDirTools|FullListRegEx~Foo~C:\Program Files\Cinemar~^Remote.*|.*\.ini$

result: Variable Foo is set to a list of names that either start with Remote or have .ini extensions, in the format subdir1|subdir2|subdir3|..dirN|file1|file2|file3|...fileN

In my case this returns the string RemoteFX|dvdlobby3.ini|mainlobby.ini|mlserverconnect.ini


FULLTREEREGEX

Returns the names of subdirectories and files in the specified directory and its subdirectories (recurisvely), separated by | (directories are listed first, followed by files), filtered by param1

The param1 filter should be formulated as a regular expression

Optional param2 set to 1, Full or True will return the full path (ex C:\Program Files\Cinemar) instead of just the directory name (ex Cinemar)

Optional param2 set to 2 or Relative will return the relative path (ex Cinemar\mainlobby.ini) instead of just the file name (ex mainlobby.ini)

Returns empty string if the directory is empty or does not exist

example: MLDirTools|FullTreeRegEx~Foo~C:\Program Files\Cinemar~^Remote.*|.*\.ini$

result: Variable Foo is set to a list of names that either start with Remote or have .ini extensions, in the format subdir1|subdir2|subdir3|..dirN|file1|file2|file3|...fileN

In my case this returns the string RemoteFX|dvdlobby3.ini|mainlobby.ini|mlserverconnect.ini


GETFILEREGEX

Returns the name of the param1-th file in the specified directory, filtered by param2 as a regular expression

example: MLDirTools|GetFileRegEx~Foo~C:\Windows~3~\.exe$

result: Variable Foo is set to the name of the third file ending in .exe in C:\Windows which is normally Explorer.exe


GETDIRREGEX or GETFOLDERREGEX

Returns the name of the param1-th subdirectory of the specified directory, filtered by param2 as a regular expression

The param2 filter should be formulated as a regular expression

example: MLDirTools|GetDirRegEx~Foo~C:\Program Files~3~^Windows.*

result: Variable Foo is set to the name of the third subdirectory of C:\Program Files starting with Windows, which is Windows Media Player for most folks


Bugs

New Feature Requests