Acronis GUI Automation API is a Flask-based automation tool that enables users to interact with Acronis TrueImage for backup and file scanning operations through a REST API. The project uses PyAutoGUI for GUI automation, pytesseract for text extraction from screenshots, and logging to track all operations.
This tool is useful when Acronis TrueImage does not provide a command-line interface (CLI) or API and you need an automated way to interact with its GUI.
- Automated File Backup: Start a backup process by specifying the source and destination directories.
- Automated File Scanning: Scan a file for potential threats using Acronis TrueImage.
- Retrieve Scan History: Get a list of previously scanned files along with their results.
- Mouse Coordinate Helper: Identify screen coordinates to fine-tune PyAutoGUI operations.
- API Status Check: Verify whether the API is running.
- Logging System: All operations (backups, scans, errors) are recorded in
log.txt.
First, clone the repository and navigate into the project directory:
git clone https://github.com/yourusername/Acronis-GUI-Automation.git
cd Acronis-GUI-AutomationInstall the required Python packages using:
pip install -r requirements.txtOnce the dependencies are installed, start the API server by running:
python Main.pyAfter running the command, you should see output similar to:
Starting API server...
POST /backup - Start a backup operation
POST /scan - Scan a file for viruses
GET /get-coordinates - Helper to find screen coordinates
GET /scan/history - Retrieve scan history
GET /status - Check API status
This means the API is up and running at http://127.0.0.1:5000/.
Below are the available API endpoints and how to use them via PowerShell.
Endpoint: POST /scan
Description: Scans a file for viruses using Acronis TrueImage.
PowerShell Command:
& curl.exe -X POST -F "file=@C:/Users/LOQ/Desktop/TestToScan.exe" http://127.0.0.1:5000/scanResponse Example:
{
"status": "success",
"message": "Scan completed. No threats found."
}or if an issue is found:
{
"status": "warning",
"message": "Threat detected in file!"
}Endpoint: GET /scan/history
Description: Returns a list of scanned files and their results.
PowerShell Command:
Invoke-RestMethod -Uri "http://127.0.0.1:5000/scan/history" -Method GetResponse Example:
{
"history": [
{
"file": "C:/Users/LOQ/Desktop/TestToScan.exe",
"result": "Clean"
},
{
"file": "C:/Users/LOQ/Desktop/Malware.exe",
"result": "Infected"
}
]
}Endpoint: POST /backup
Description: Initiates a backup from a specified source directory to a destination.
PowerShell Command:
curl -X POST http://127.0.0.1:5000/backup -H "Content-Type: application/json" -d "{\"source\": \"D:\\University\\Term 6\\testfolder\", \"destination\": \"G:\\Newfolder\"}"Response Example:
{
"status": "success",
"message": "Backup started successfully"
}Endpoint: GET /get-coordinates
Description: A helper function to get the current mouse cursor position.
PowerShell Command:
Invoke-RestMethod -Uri "http://127.0.0.1:5000/get-coordinates" -Method GetResponse Example:
{
"x": 1023,
"y": 345
}This helps in fine-tuning PyAutoGUI's automation process.
Endpoint: GET /status
Description: Checks if the API is running.
PowerShell Command:
Invoke-RestMethod -Uri "http://127.0.0.1:5000/status" -Method GetResponse Example:
{
"status": "running",
"message": "API is up and running"
}All backup and scanning operations, along with errors, are logged in log.txt. This helps with debugging and monitoring.
[2025-04-02 19:30:12] INFO: Backup started from D:\University\Term 6\testfolder to G:\Newfolder
[2025-04-02 19:31:20] INFO: Scan started for file C:/Users/LOQ/Desktop/TestToScan.exe
[2025-04-02 19:31:25] ERROR: Scan failed due to missing Acronis application
Each log entry contains a timestamp, log level (INFO/ERROR), and a description of the operation.
1. Acronis TrueImage is not opening automatically?
- Ensure Acronis is installed at:
C:\Program Files (x86)\Acronis\TrueImageHome\TrueImageLauncher.exe - Try opening Acronis manually and check for errors.
2. PyAutoGUI is not clicking the right elements?
- Use the
/get-coordinatesendpoint to determine the correct screen coordinates. - Adjust the click positions in the Python code.
3. Tesseract OCR is not detecting text?
- Install Tesseract OCR and ensure it’s added to the system
PATH. - Try using different OCR configurations.
-
BackupManager (BackGUI.py)
- Automates Acronis backup operations by simulating user interactions.
- Uses PyAutoGUI to click and type paths in the GUI.
- Takes screenshots of the backup result.
-
Scanner (PyAutoGUI.py)
- Automates Acronis virus scanning.
- Extracts scan results using pytesseract (OCR).
- Saves scan history.
-
Flask API (Main.py)
- Provides a REST API for backup and scanning.
- Routes user requests to the BackupManager and Scanner classes.
This project is licensed under the MIT License. You are free to modify and distribute it.