Commands & Syntax > Commands > File Mainpulation >

www.perfectkeyboard.com

 

ENUMERATE - < file_enum >() ... [Pro]

 

File ENUMERATE
<file_enum>("Folder",Option,Variable array for enumerated items,Variable array size)
Available in: Professional edition

This command enumerates files/folders from the given folder using a defined mask (wildcards).

 

#

Parameter name

Parameter description

1

Folder

File/folder selection pattern containing wildcards. Example: "c:\windows\a*.?if" or "c:\windows\sys*".

2

Option

1 - only subfolders are enumerated
2 - only files are enumerated
3 - both subfolders and files are enumerated

3

Variable array for enumerated items

Variable (array) that receives files/folders from the Folder that match the mask.

4

Variable array size

Variable that receives the number of files/folders saved in the VarFiles.

 

Example (Macro Steps):

 

1

<#> <#> This macro shows how to use 'file_enum' command.

2

Macro execution: ONLY COMMANDS

3

File ENUMERATE "Files only" of "Folder=%_vFolder_Temp%\*.tmp" (Variable array for enumerated items=vFiles, Variable array size=vNumOfFiles)

4

Message SHOW "" : "There are %vNumOfFiles% TMP files in "%_vFolder_Temp%" directory." (other parameters: x = -100, y = -100, Window title = Message, Buttons = OK, Timeout (seconds) = , Always on top = ).

5

Variable SET "vMsg=_vStrEmpty", Message text=""

6

Loop BEGIN Repeat = vNumOfFiles

7

Variable OPERATION "STR_APPEND" (Variable for result = vMsg, Input text/variable = %vMsg%, Parameter 1 = %_vKeyReturn%%vFiles[_vLoopCounter0]%, Parameter 2 = , Parameter 3 = 0)

8

Loop END

9

Message SHOW "" : "vMsg" (other parameters: x = -100, y = -100, Window title = Message, Buttons = OK, Timeout (seconds) = , Always on top = ).

Example (Plain Text):

 

<#> This macro shows how to use 'file_enum' command.

<#>

<cmds>

<file_enum>("%_vFolder_Temp%\*.tmp",2,vFiles,vNumOfFiles)

<msg>(-100,-100,"There are %vNumOfFiles% TMP files in %_vQuoteChar%%_vFolder_Temp%%_vQuoteChar% directory.","Message",1)

<varset>("vMsg=_vStrEmpty","")

<begloop>(vNumOfFiles)

   <var_oper>(vMsg,"%vMsg%",STR_APPEND,"%_vKeyReturn%%vFiles[_vLoopCounter0]%","", "0")

<endloop>

 

<msg>(-100,-100,"vMsg","Message",1)