I have made a few functions for a certain use case (further: "use case 1"). These functions are tested properly and work well.
Later I imported ("add existing items...") a couple of these functions to use case 2. These functions also work well in this second use case. But if these use cases were to come together in one solution for some reason, this way of working will cause a few errors, because the automation ID's will be identical.
What is a proper way to work with functions? And what would be a good way to handle the situation above (manually adjust ID's in the .OS)?
A solution should consist of multiple projects. If you keep your use cases in separate projects, then the IDs matching wouldn't be an issue. If you do have items in the same project that you want to make a copy of though, then the best way is to change the ID. I usually open it up in a text editor and replace it with a new ID. I generally change the last five characters to random numbers (or letters A-F).
Posted: 9 months ago
Updated: 9 months ago
Posted: 28 Oct 2020 11:54 EDT Updated: 28 Oct 2020 12:44 EDT
I mixed things up in my last post, I indeed meant projects.
If the functions were to be in a dedicated project, it would be easier to manage the functions. For example: if for some reason a function needs to be adjusted it can easily be done by updating the dedicated project. Whereas if you would have made copies of those functions (and changed the ID's), you would have to track down all of the copies and make the adjustments in the separate copies.
@jeffbadger I added a solution to the attachment of this reply.
In this solution there are 5 functions we are currently using. We provided the functions with comments and examples. Any feedback or improvements are very welcome!
When you run the solution the Robot Inspector will appear. We use the robot inspector as a quick way of testing our functions.
Now days we don't import a project with all of the generic functions anymore. We collected all our functions in a central directory. If we ever need a functions, we take the following course of action: (1) click "Add project items", (2) click "Existing item", (3) click "Browse" and pick the desired function from the directory, (4) click the checkbox "Generate new ID", (5) click "Add". This way a new copy is made of the function and a new ID is generated. Even if two of the same functions were to ever come in the same solution, it wouldn't cause problems (because of the different ID's).