Navigation:  Macroses >

Files and directories

Previous pageReturn to chapter overviewNext page
Show/Hide Hidden Text

 

Take a line from the file

This macro allows you to take one or several strings from the existing file specifying the file path and string numbers. It is possible to parse a separate text with the help of a regular expression. If the path starts with (/), it means that this is a directory for the launched program folder.

 

Example 1

 

The path to the file

\Resources\test.txt

Line numbers

random

Delete rows

false

Regular expression

\w{3}

Number of coincidence

1

 

Macro

{-File.GetString-|-\Resources\test.txt-|-random-|-false-|-\w{3}-|-1-}

 

Result

abc

 

Example 2

 

The path to the file

F:\test.txt

Line numbers

0, 4-end

Delete rows

true

Regular expression

Not specified

Number of coincidence

Not specified

 

Macro

{-File.GetString-|-F:\test.txt-|-0, 4-end-|-true-}

 

Result

abc

123

qwer

 

Get text block from the file

The existing file must contain a text written through a divider. This macro allows you to take text blocks specifying comparison numbers and divider symbol. Block can be taken with deletion and without it (true or false).

 

Example

 

The path to the file

F:\test.txt

Separator character

:

Number of coincidence

random

Remove blocks

false

 

Macro

{-File.GetBlock-|-F: \ test.txt-|-:-|- random-|-false-}

 

Result

qwerty abc

abcdef

12345 123

 

Append line(s) to a file

This macro allows you to save received data in a file specifying the file path and data that must be saved (for example, the result of login and password generation macros execution).

 

Example

 

The path to the file, which will store the results

F:\test.txt

Line

stored_row

Write newline at end of file

true

 

Macro

{-File.AppendString-|-F:\test.txt-|-stored_row-|-true-}

 

Result

On the drive F:\test.txt file will appear with the saved data

 

The number of strings actually contained in the file

This macro can determine the number of strings in a file specifying its path.

 

Example

 

The path to the file

\Resources\test.txt

 

Macro

{-File.CountOfStrings-|-\Resources\test.txt-}

 

Result

106

 

Determine whether the specified file exists

This macro allows you to check the file presence in the specified directory.

 

Example

 

The path to the file

\Resources\test.txt

 

Macro

{-File.Exists-|-\Resources\test.txt-}

 

Result

true 

 

Copy the existing files to the new location

This macro allows you to copy the specified file, indicating the path to the file and directory where it must be copied to.

 

The path to the file

\Resources\test.txt

Directory path

F:\Test_directory

 

Macro

{-File.Copy-|-\Resources\test.txt-|-F:\Test_directory-}

 

Result

Test.txt file copied to the "Test_directory" on drive F:\

 

The number of files actually contained in the directory

This macro allows you to determine the number of files in the specified directory.

 

Example

 

The path to the file

\Resources\

 

Macro

{-Directory.CountOfFiles-|-\Resources\-}

 

Result

6

 

The path to a random file in the directory

This macro allows you to get a full path to the random file indicating the path to the directory where all the files that interest you are located.

 

Example

 

Directory path

F:\

 

Macro

{-Directory.RandomFile-|-F:\-}

 

Result

F:\test2.txt

 

Subitem(file or subdirectory) in the specified directory

Specify the path to a necessary directory, indicate what interests you (d – subdirectories, f – files). It is possible to sort the received paths alphabetically (true/ false), and it is necessary to indicate the comparison number (random or all).

 

Example

 

Directory path

F:\

Choose a subdirectory and (or) files

df

Sort alphabetically

true

Number of coincidence

all

 

Macro

{-Directory.SubItem-|-F:\-|-df-|-true-|-all-}

 

Result

F:\ICQ

F:\test.txt

F:\ZennoPoster

 

Delete file(s) by mask in the directory

This macro allows you to delete a file (one or several) specifying the path to the directory and file mask. It is based on regular expressions, but using only two symbols: * - zero or more symbols, ? - zero or one symbol.

 

Example 1

 

In the directory \Resources\ are two files "file1.txt" and "file1.txtother"

 

Directory path

\Resources\

File mask

file *. txt

 

Macro

{-Directory.DeleteFileByMask-|-\Resources\-|-file*.txt-}

 

Result

deleted both files

 

Example 2

 

In the directory \Resources\ are two files "file1.txt" and "file1.txtother"

 

Directory path

\Resources\

File mask

file?.txt

 

Macro

{-Directory.DeleteFileByMask-|-\Resources\-|-file?.txt-}

 

Result

deleted file "file1.txt"

 

Delete the specified file

This macro allows you to delete a file, specifying its complete path.

 

Example

 

The path to the file

F:\test.txt

 

Macro

{-Directory.DeleteFile-|-F:\test.txt-}

 

Result

specified file is deleted

 

Delete the specified directory

This macro allows you to delete the directory,  specifying its complete path.

 

Example

 

Directory path

F:\New Folder

 

Macro

{-Directory.SelfFile-|-F:\New Folder-}

 

Result

specified directory is removed

 

The full path to the ZennoPoster

This macro shows a full path to the directory where the program is launched.

 

Example

 

Macro

{-//-}

 

Result

C:\Program Files\ZennoLab\ZennoPoster Pro\Progs\