Working With Files
File processing in a program like XenoGuard is a crucial element in automation. Files often contain data, settings, or configurations essential for business processes or workflows. Automated file processing can perform routine tasks, such as reading, editing, or saving data, without manual intervention. This not only increases the efficiency and consistency of the processing but also minimizes human errors. In the context of XenoGuard, file processing enables seamless integration of various data sources and formats, facilitating complex automation scenarios. The result is improved operational performance, time savings, and the ability to focus on more strategic tasks rather than dealing with manual, repetitive file operations.
XenoGuard offers a variety of actions to read and save files. Some of these actions even allow direct downloading of files from the network, supporting protocols like HTTP, FTP, or SFTP. Below is an overview:
Actions that expect a file path or folder path as a parameter indicate this in the input parameter. For a file, it displays <<File not set>>, and for a folder, <<Path not set>>. Drag-and-drop is the easiest way to populate these parameters with files. XenoGuard differentiates paths depending on whether they are in its own workspace or external. Within the workspace, relative paths are used, while external sources show absolute paths. A significant advantage of XenoGuard is its ability to automatically update file paths when you move files or folders in the Workspace Explorer. This also applies to referenced ActionScripts: if you move a script, all references adjust automatically. Therefore, it's advisable to store central files to be processed in the workspace. This also makes backups and versioning easier.
The next figure shows an example:
The action Database Create Connection opens the Access database Person_Import.accdb, located in the workspace. The relative path is Files\Examples\Database\Data\Person_Import.accdb. XenoGuard automatically completes this path during script execution. If you move the Access database within the workspace, XenoGuard automatically adjusts the reference accordingly.
Processing Text Files
With the File Read action, you can read unformatted text files. The results are presented as a list, which can be iterated through, for example, using For Each. Here's an example:
The File Write action is used for saving text and expects the file path, file encoding, and the text to be saved.
More file-related actions can be found in the File folder, under the main group Windows.
Processing CSV Files
CSV (Comma-Separated Values) files are widely used file formats that store data in a tabular form and are often employed for data exchange between programs. XenoGuard offers a series of specific actions to efficiently process these files. With Read File, you can read a CSV file, while Read Value and Write Value allow querying and modifying individual values within the file. The Save Buffer action is used to save the changes made so far, and Clear Content can erase the entire content of the CSV file. These functions provide XenoGuard with a comprehensive toolkit for flexible and precise processing of CSV files.
CSV files do not necessarily need to have a *.csv extension. Text files with the *.txt extension or other formats can also be read as CSV. The crucial aspect is the delimiter between columns, which is adjustable when reading the file. By default, XenoGuard uses a semicolon as the delimiter. |
You can find the CSV actions in the folder Windows::File Handling::CSV.
The following script reads a CSV file. XenoGuard presents the result in a tabular format.
Processing Excel Files
Excel files are widespread in the business world, often serving as the standard format for data exchange, recording, and analysis. As many business processes and decision-making are based on data stored in Excel files, it's essential for an automation software like XenoGuard to process these files efficiently. XenoGuard offers the following advantages:
- Increased Efficiency: Many business processes rely on data stored in Excel. By automating routine tasks such as reading, processing, and storing Excel data, employees can focus on more value-adding activities.
- Error Reduction: Manual data manipulation is prone to errors. Automated processes decrease the risk of human errors, ensuring more consistent and accurate results.
- Integration: Excel files often contain data that needs to interact with other systems, applications, or databases. XenoGuard enables seamless integration, optimizing data flows.
- Accessibility: As no-code platforms do not require a programming background, XenoGuard allows non-technical users to perform complex data operations without relying on IT experts.
Specific actions available for Excel files in XenoGuard include:
Action | Description |
---|---|
Create File | This action allows creating a new Excel file. When a user specifies a filename and location, XenoGuard creates an empty Excel file at that location. |
Get Sheet Information | This action enables the user to retrieve detailed information about a specific worksheet within an Excel file, such as the name of the worksheet, the number of rows and columns, and other relevant data. |
Add Sheet | This function allows adding a new worksheet to an existing Excel file. The user specifies the name for the new worksheet, and XenoGuard adds it to the file. |
Rename Sheet | This action allows for renaming an existing worksheet. The user specifies the current and new names, and XenoGuard performs the renaming. |
Delete Sheet | Enables the deletion of a specific worksheet from an Excel file. |
Insert Data | This action allows data to be inserted into a specific worksheet. The user specifies the cell coordinates and the data to be inserted, and XenoGuard places it accordingly. |
Update Data | Allows updating data in specific cells of a worksheet. Similar to inserting, the user must specify the cell coordinates and new data. |
Get Data | This action enables retrieving data from a specific area of a worksheet. The user specifies the desired cell coordinates, and XenoGuard returns the data. |
Format Cells | This action allows changing the format of specific cells, such as font, font size, cell color, and other formatting options. |
Clear Cells | This action can be used to remove data from specific cells or cell ranges without deleting the cells themselves. |
Delete Cells | Allows complete deletion of cells or cell ranges, which can affect the overall structure of the worksheet, such as moving cells below the deleted area. |
You can find the Excel actions in the folder Windows::File Handling::Excel:
Packing and Unpacking Files
Packing files into a ZIP archive and then unpacking them are common requirements in the world of automation. A ZIP file is a compressed archive that can contain one or more files. Compression reduces files and folders into a smaller file size, which facilitates transfer and storage.
In an automation solution like XenoGuard, the ZIP actions serve several purposes:
-
Data Transfer: Large files or a multitude of files can be bundled into a ZIP archive to make them easier to send via email, store on servers, or transfer between systems.
-
Storage Optimization: Compressing files can save valuable storage space, especially when working with large volumes of data.
-
Organization: Packaging files into a ZIP archive can also serve to organize them. Instead of transferring or storing many files, you have just one ZIP file that contains everything.
-
Integrity and Security: ZIP archives can be password-protected, providing an additional level of security when sending or storing sensitive data.
-
Automated Workflows: In automated processes, such as regular data backups, system updates, or collecting and sending reports, it is often more efficient to bundle files into a ZIP archive. Once the archive reaches its destination, it can then be automatically unpacked and processed.
You can find the ZIP actions in the folder Windows::Compression:
The following script packs all files from the workspace folder Files into a ZIP archive. Optionally, the archive can be secured with a password.
Downloading Files
The action Network HTTP Download allows for downloading files via HTTP. It simply requires the URL of the desired file and the local storage path. This way, images and HTML files can be easily downloaded and edited locally. You can find the action in the folder Windows::Network::HTTP.
Transfering Files via FTP
FTP transfer functions are essential in automation software. XenoGuard offers numerous actions that communicate with an FTP server, divided into file and folder functions. The FTP actions can be found in the folder Windows::Network::FTP.
FTP File Actions
XenoGuard provides the following FTP file actions to automate file exchange and management on an FTP server:
Action | Description |
---|---|
Download | This action allows you to download a file from an FTP server. You need to provide the source URL on the FTP server and the local target path where the file will be saved. |
Upload | Enables the uploading of a local file to an FTP server. Here, the local file path and the destination path on the FTP server must be specified. |
Move | This action lets you move a file to a different location on the FTP server. Both paths, source and destination, must be specified on the FTP server. |
Delete | This action allows you to delete a file on the FTP server. You only need to specify the path to the file on the FTP server. |
Rename | This action allows you to change the name of a file on the FTP server. You must specify the current path and the new name of the file. |
Get Information | This action lets you retrieve detailed information about a file on the FTP server, such as size, last modification date, etc. The file path on the FTP server is required. |
Permission | This action allows changing file permissions on the FTP server. This can be important to ensure files are properly protected or to control access for certain users. |
The next example script transfers all files from the desktop folder 'Upload MycroTools' to the FTP server. Directory Get Files first generates the file list. With For Each, the files are iterated through and then sent to the server using FTP File Upload.
FTP Folder Actions
In XenoGuard, the FTP actions offer not only file management but also control over directories on an FTP server. Here is a description of the relevant actions:
Action | Description |
---|---|
Create | This action allows you to create a new directory on the FTP server. You simply need to specify the path under which the new directory should be created. |
List Content | This function enables you to list the contents of a directory on the FTP server. This provides an overview of all files and subdirectories within the specified directory. |
Delete | This allows you to delete an existing directory on the FTP server. Caution is advised, as this usually also deletes all contained files and subdirectories. The path to the directory to be deleted is required. |
Move | This action allows moving an entire directory to another location on the FTP server. You must specify both the original path and the destination path on the FTP server. |
Transferring Files/Data via TCP/IP
The TCP extension in XenoGuard allows users to acquire additional actions for data exchange over the TCP/IP protocol. With these actions, users can create and operate their own TCP servers or TCP clients within the XenoGuard environment. Such servers and clients are essential for communication between computers in networks. The corresponding data transfer actions facilitate the exchange of strings and files between these systems.
TCP/IP, an acronym for Transmission Control Protocol/Internet Protocol, is the foundational communication protocol of the internet and most local networks. It consists of a set of protocols that regulate data exchange between computers. TCP ensures that data packets correctly travel from a source to a destination, while IP handles addressing and routing of packets in networks. Thus, TCP/IP allows for efficient, reliable, and secure transmission of information across various networks and often over large distances. Adding TCP functionality to XenoGuard significantly expands the possibilities for users to exchange and integrate data between different systems and locations. |
The TCP actions are contained in the folder Windows::Network::TCP:
The following table describes all the TCP actions:
Action | Description |
---|---|
Server Start | This action enables the user to start a TCP server to wait for incoming connections. It lays the groundwork for all subsequent server-related actions. |
Server Send String | With this action, the server can send a string to a connected client. This is useful for exchanging messages or commands between server and client. |
Server Send File | This action allows the server to transfer a file to a connected client. It is especially useful when larger data amounts or specific files need to be shared. |
Server Receive | This action enables the server to receive data from all clients. This can include both strings and files. |
Server Block Client | If a client appears unwanted or harmful, this action allows the server to block this client, preventing them from sending any further connection requests. |
Server Remove Client | With this action, the server can remove or disconnect an already connected client. This is useful for maintaining control over the number and type of connected clients. |
Server Statistic | This action provides an overview of various server statistics, such as the number of connected clients, data transfer amounts, and other useful information to monitor the server's performance and efficiency. |
Client Start | This action initiates a TCP client connection to a specific server. The user specifies the target IP address and port to connect to. Once successfully connected, the client is ready to send and receive data from the server. |
Client Send | After establishing a TCP client connection, this action enables the sending of data (typically as strings) to the connected server. The user specifies the data string to be sent. |
Client Send File | This action is specifically designed to send a file from the client side to the server. The user specifies the path to the file to be sent. XenoGuard handles the conversion and transmission of the file as a data stream. |
Client Receive | This action allows the TCP client to receive data from the server. Once data is available, the client reads it and stores it in the result lists. A client can receive both strings and files from the server. |
The following figure shows a script as an example: After initiating the TCP server, the script monitors incoming data from the client in a loop. Upon receipt, these data are further processed, for example, for archiving purposes. Additional functions can be added to identify errors and respond accordingly or to send notifications once data has been successfully processed. This highlights XenoGuard's efficiency and flexibility in managing TCP communication and data processing.
Parsing JSON Files
JSON, short for JavaScript Object Notation, is a lightweight data format commonly used in many web applications and data transmissions. XenoGuard's JSON Parse File action enables the reading and decoding of JSON files. The user simply specifies the file path. Subsequently, XenoGuard analyzes the contents and transfers them into a result list. This function facilitates the integration of JSON configurations and data sources into automation processes, thus expanding XenoGuard's flexibility in data-oriented applications.
An example is the following JSON structure for processing in XenoGuard.
{ "store": { "name": "TechShop", "location": "123 Tech St, Tech City", "products": [ { "id": 1, "name": "Laptop", "brand": "TechBrand", "price": 999.99 }, { "id": 2, "name": "Smartphone", "brand": "PhoneBrand", "price": 599.99 }, { "id": 3, "name": "Headphones", "brand": "SoundBrand", "price": 49.99 } ] }, "timestamp": "2023-10-10T14:30:00Z" }
The following representation shows the script after its execution. Here, data and structure are displayed hierarchically. With the For Each action, individual branches of the structure can be traversed, allowing for systematic processing.