19-01-23 06:46 PM
19-01-23 08:40 PM
20-01-23 06:02 AM
12-01-24 11:37 AM
Does it work?
12-01-24 11:40 AM
somehow the config is wrong during installation. It referes to an xml file on drive d which doenst exist.
27-06-24 02:48 PM
Hi Eric,
In the original thread for this question others found this tool from the DX did not work. We tried it also in January 2024 and found the same.
Has this been fixed please? I see no changes on the relevant DX page.
Is there an alternative method or tool for file watching
Thank you and regards
Darren Rundell
RPA Developer - Royal Cornwall Hospitals Trust - UK
30-06-24 12:21 AM
Hi @DarrenRundell ,
I can suggest you an alternative way which would be to use a simple python script that can keep on checking if any file got placed within a folder or not. If yes, it can trigger a process using the AutomateC.exe file. Once this script has been created, you can execute the same using Windows Scheduler at some interval (for example, every 15 minutes)
Python Script:
import os
import subprocess
import json
import logging
from datetime import datetime
# Configuration
WATCH_FOLDER = r"<WATCH_FOLDER>"
AUTOMATEC_PATH = r"C:\Program Files\Blue Prism Limited\Blue Prism Automate\AutomateC.exe"
USERNAME = "<USER_NAME>"
PASSWORD = "<PASSWORD>"
PROCESS_NAME = "<PROCESS_NAME>"
RECORD_FILE = "processed_files.json"
LOG_FILE = r"C:\temp\watch_folder_trigger_bot.log"
# Setup logging
logging.basicConfig(
filename=LOG_FILE,
level=logging.INFO,
format='%(asctime)s - %(levelname)s - %(message)s',
datefmt='%Y-%m-%d %H:%M:%S'
)
def run_blue_prism_process():
try:
command = [
AUTOMATEC_PATH,
"/user", USERNAME, PASSWORD,
"/run", PROCESS_NAME
]
result = subprocess.run(command, capture_output=True, text=True)
if result.returncode == 0:
logging.info("Blue Prism process triggered successfully.")
else:
logging.error(f"Failed to trigger Blue Prism process. Error: {result.stdout}")
except Exception as e:
logging.error(f"An error occurred while triggering the Blue Prism process: {e}")
def load_processed_files():
if os.path.exists(RECORD_FILE):
with open(RECORD_FILE, "r") as file:
return set(json.load(file))
else:
return set()
def save_processed_files(processed_files):
with open(RECORD_FILE, "w") as file:
json.dump(list(processed_files), file)
def watch_folder():
processed_files = load_processed_files()
current_files = set(f for f in os.listdir(WATCH_FOLDER) if os.path.isfile(os.path.join(WATCH_FOLDER, f)))
new_files = current_files - processed_files
if new_files:
logging.info(f"New file(s) detected: {new_files}")
run_blue_prism_process()
processed_files.update(new_files)
save_processed_files(processed_files)
else:
logging.info("No new files detected.")
if __name__ == "__main__":
logging.info("Starting folder watch...")
watch_folder()
Here, you need to replace the Username, Password, Process Name and the Watch folder variable values with values specific to your use case.
What this script does is that it will check if there is any new file within your watch folder. If yes, it will check in a JSON file that it creates and tracks for the processed file otherwise will stop the process. If the entry is not found, then it will add the record entry with the file name and will trigger the process via AutomateC.exe application otherwise will stop the process.
Once the script has been created, save the python file in some directory and we will create the schedule in Task Scheduler and click on Create Task option from the Actions panel:
Provide the task name, description and select the options: Run whether user is logged on or not and Run with highest privileges and select the Operating System:
Now, click on Triggers tab at top and provide the Trigger to be at startup and repeat every 5 minutes indefinitely as shown below:
Now, set up the actions to trigger the python script using the python.exe file path and run the script in the same directory path where the script file is saved:
Once it has been setup, in the task scheduler your task should show up and now it should work.