Filesystem-Commands

<< Click to Display Table of Contents >>

Navigation:  3. Script Language > Filesystem-Commands >

Filesystem-Commands

GFT. - Get-File-Token

Previous Top Next


MiniRobotLanguage (MRL)

 

GFT. Command

Get File Token

 

NTFS-Direct

Intention

 

GFT. evaluates a file-path. It returns a requested part of the file-name/path.

The functionality is strictly one of  parsing alone.  No attempt is made to find the file on disk.

 

Here is an example:

 

$$FIL=c:\Folder\Filename.pdf

GFT.+hi|$$FIL|$$RET

' $$RET will return: "c:\Folder\Filename"

' Result will be placed in Clipboard

CLP.$$RET

END.

 

 

 

 

Syntax

 

 

GFT.P1|P2[|P3]...[|PX]

 

 

Parameter Explanation

 

P1:  - Prototypes

 

   We use $$FIL=c:\Folder\Filename.pdf as example for every option.

 

a - Root-Drive -> "c:\"

b - ALB -> "Filename.pdf"

c - BLB -> "c:\Folder"

d - File-Extension without "." -> "pdf"

e - Filename without Extension -> "Filename"

f - complete Path/filename without Root-Drive -> "Folder\Filename.pdf"

g - returns all without extension. -> "c:\Folder\Filename"

h - Returns the path portion of the path/file name. -> "c:\Folder\"
    That is the text up to and including the last backslash (\) or colon (:).

  i - Return the name portion of the path/file name. That is the text to the right of the last backslash (\) or colon (:),
      ending just before the last period (.). -> "Filename"

  j - Returns the extension portion of the path/file name. 

      That is the last period (.) in the string plus the text to the right of it. -> ".pdf"

k - filename.extension -> "Filename.pdf"

l - If specified, the first letter of the Parts of the filename will be   Uppercased (MCase-Processing).

m - remove "\" from right side of P2 before processing

    e.g. C:\file\ -> c:\file

+ - If the "+" Sign is specified in prototypes, the result will be concatenated and all be placed in P3.

    Example:

    $$FIL=c:\Folder\Filename.pdf

    GFT.+hi|$$FIL|$$RET

    ' $$RET will return: "c:\Folder\Filename"

- - If the "-" Sign is specified as a prototype, any "\\?\" that prefixes the filename will be removed.

   Otherwise the "\\?\" will be treated as a part of the root-drive.

 

 

P2  - Filepath: Path which shall be split into parts. Must be given.

 

P3 .. Px - (optional) Variables which will be filled with the Parts according to the prototypes

 

 

 

Example

 

'***********************************

' GFT.-Demo

'***********************************

VAR.§§MYP=?pfad\Myexe.dll

GFT.abcdef|§§MYP|§§AAA|§§BBB|§§CCC|§§DDD|§§EEE|§§FFF

PRT.--------------------------------------------

PRT.Full-Path is: §§MYP$crlf$GFT. makes:

PRT.Parameter a: §§AAA

PRT.Parameter b: §§BBB

PRT.Parameter c: §§CCC

PRT.Parameter d: §§DDD

PRT.Parameter e: §§EEE

PRT.Parameter f: §§FFF

PRT.--------------------------------------------

:enx

MBX.!

END.

 

 

 

Remarks

 

-

 

 

Limitations:

 

-

 

 

 

See also:

 

 

  1.5.2 Working with Text-Strings

  URL. - Split URL

  ALB - After last Backslah

  BLB - Before last Backslash

  GSS. - GetSplitString

  GFS. - Get-Filtered-String