Files
Please read the Terms of Use for Materials on ZennoLab
Table of contents
Description
ZennoPoster allows you to automate working with files.
Where can it be applied?
Insert prepared text from file when posting on forums,
Posting ads on various sites
Adding automatic comments
Write data to files when parsing sites
Maintain detailed logging to a file
Delete, move unnecessary files
How to add an action to a project?
Via context menu Add Action -> Data -> Files
Or use smart search.
How to work with an action?
To work with files, the following actions are provided, which are selected in the properties window:
Get text
Copying text from a file with the ability to write to a variable.
File path
Variable macros can be used.
Here you need to specify the path to the file from which the data will be read.
Delete the file after it has been read
After executing the action, the file will be deleted.
Write text
Adding text to the file.
What to write
The text to be written to the file.
Variable macros can be used.
Append to file
If set, the text you specified will be added to the file. If the checkbox is unchecked, the file will be completely overwritten with the text you specified.
Add a line break to the end
After entering it into the file, a line break will be added to the end of your text - \ r \ n. It is necessary for more correct writing of several lines of data to the file.
Move
This is moving the file to the specified directory. Also, this option can be used to rename the file.
Text existence
Checking the existence of a file at the specified path.
If the file exists - green (successful) exit, if not - red (unsuccessful);
Waiting timeout - how long the action will wait for the file to appear, in seconds.
Copy
Same as moving, but without deleting the original file.
Remove
Deleting a file at the specified path.
Possible practical application
We set ourselves the task:
Download picture from vk.com
Rename it
Move to the desired folder
Let's imagine that we have already received a direct link to the picture: https://sun9-71.userapi.com/zcp0gi3hCgW39FmT3J7vsAiawigKHI_WP4J5YA/fWlAmX-lUM8.jpg
Using Get request, we download the picture to our computer. Specify PicPath as a variable. After executing this action in the specified variable, we will have a direct path to the picture:
Next, we create a “Random” action to generate a filename, read more about Random here: Arbitrary numbers and strings (Random)
Next, create the "Files" action and select the "Move" option.
Specify as the "Path to the file": {-Variable.PicPath-}
;
As the "New Path" {-Project.Directory-} Police \ {- Variable.name_file -}. Jpg
{-Project.Directory-}
- a macro, when specified, the directory where the project is located will be used. Where the project is located (you can read more about this and other macros here).
After performing this action, the file will move to the desired folder and you can upload the next picture.
To get the file extension, you can use the Text Processing and Regular Expressions action, for more details: Regular Expression Tester.