Best Practices
This article gives you some ideas for designing Robotiq.ai processes. Following these practices helps you make automations that are easy to read, reliable, and simple to keep up.
General Design Guidelines
Variables and Naming Conventions
- Don't type values directly into your process.
- Put values in variables with clear, English names. Don't use spaces in variable names.
- Decide on clear variable naming rules and stick to them.
- Use Global Variables for values that:
- Change between different environments (like development, test, production).
- Are used in more than one process.
Process Structure
- Make a process template you can use again. This template should have:
- A standard process layout (like setup, local functions, main part, error handling).
- Error handling already set up.
- Start your process by:
- Setting up the variables you need.
- Closing all running applications to make sure you have a clean start.
- Putting these setup steps together so they're easy to see.
Reusing Existing Processes
If you have a process that's like a new one you need to build:
- Use start arguments to change how the process acts. For example, you can change behavior based on region or robot.
- Don't copy the process. Copying means more work to maintain it.
- This works well when the main logic is the same but needs small changes for different countries or business units.
File and Folder Organization
If your process uses input or output files:
- Make a folder named after the process.
- Put all the files you need in this folder.
- Make sure this folder is on the robot's machine before you publish the process to Test or Production. You can use the Create Folder Step.
Functions and Reusability
- Use Functions to make your processes organized, efficient, and easier to test.
- Save parts of a process that work on their own as separate functions.
- If several processes use the same application, make special functions for:
- Logging into the application.
- Each specific action within that application.
- If a function is only for one process but used many times in it, make a Local Function.
- Make Local Functions at the start of the process.
- Put all local functions together so they're easier to read.
Step and Group Naming
- Give all steps in your process clear names. The name should say what the step does.
- Put related steps into logical sections using the Group step.
- Give each group a name that describes it.
- Use different group colors to make them easier to see.
- Add descriptions for each group.
Script Usage
- If you use outside scripts (like batch, PowerShell, VBScript), add comments to clearly explain what they do.
- Don't use the Script Step unless you absolutely have to. Outside libraries or older .NET assemblies might not work with the current system.
- Try using the Python Script Step instead. This lets you handle your own Python version and code separately.
- Robotiq.ai's official support doesn't cover problems from custom code or code made by users.
Error and Exception Handling
- Make an Error Handling section using Error Mode. This deals with unexpected errors when the process is running.
- Think about making a special Error Handling Function.
- For errors you expect, set up a way to handle them.
- Use Try/Catch blocks when you can.
- Make sure the process stops smoothly with good logging and messages for the user.
- After an error, go back to the main screen so the process can keep going with the next item.
- Close all applications at the beginning, at the end, and in the Error Handling section.
Loops and Data Row Handling
If your process handles many entries (like rows in an Excel file):
- An error in one row shouldn't stop the process from working on other rows.
- After an error, the process should go back to a stable state.
- Think about using a dispatcher/worker pattern if it makes sense for what you're doing.
Input Validation
- Check all input data (like Excel files, arguments).
- If the process finds bad data:
- Stop the process smoothly.
- Tell the user about the business error.
Desktop Application Guidelines
Follow these tips when working with desktop applications:
- Use the Recorder feature whenever you can. This makes automation steps for working with desktop applications quickly.
- For Click and Find Image steps:
- Always turn on Retry and Timeout options. This gives the robot time to find the image or UI element.
- This means you don't need fixed delays and the process waits as long as needed for the screen to be ready.
- Don't use fixed pauses unless you really have to.
- If the image to click is unique, you don't need to set anchors.
- If there are many similar images:
- Set unique anchors to clearly show where the right image is.
- Pick anchor types based on how the UI looks and what's visible.
- After recording the process:
- Save the application path or URL to a variable.
- Change the fixed path in the Open Window Process Step to this variable. This makes it more flexible and reusable.
- Do the same for Click & Type and String Input Step steps.
Final Cleanup Before Production
Before publishing to production:
- Remove all steps that are turned off.
- Don't:
- Have duplicate steps.
- Create variables you don't need.
- Copy functions.
- Work with process owners to decide on and set up Key Performance Indicators (KPIs).
Tips & Tricks
- Run through the process manually to find ways to make it better.
- When working with web applications:
- Use direct URLs when you can.
- Build the process one step at a time. Test each part separately.
- Don't use fixed pauses. Use waits that adjust with timeouts to keep it from getting stuck.
- Use the Recorder tool whenever you can.
- Break big processes into smaller, easier-to-manage parts.
- Use what you know about other technologies (like API calls, database access, web services) to build more efficient automations.
- Get clients involved in testing. Make sure all situations are covered.
Need Help?
Can't find what you're looking for? Join the Robotiq Community to get help from other users and the Robotiq team.