by Baz Cuda
Ronseal ! :D
I sometimes download flows from the community that I've already downloaded without realising. I also make copies of flows intending to modify the originals and then forget which I've modified and which ones I haven't. I now have quite a few duplicates.
If you do that too, then this is the flow for you !
Turn off logging for more helpful info in the live log window.
If you're interested in some of the internal workings of the flow, I've left various log blocks disconnected in the flow that were useful during development. It should, I hope, be obvious from how the flow is laid out, how to plug them back in again.
This flow uses nested for-each loops.
It also repeatedly removes element from an array while it is the subject of an active for-each loop. This is something that many 3GL languages actively prohibit, arbitrarily in my opinion; being able to do so allows for some very neat code, and alleviates the need to maintain both a bookmark and a cursor which then have to be modified after performing the inner loop each time. You simply remove the most recently processed element (which automatically provides an ever-decreasing array of files for the inner loop). Bravo, Automate !
The flow firstly saves a copy of every flow to a temporary folder, adding the flow number to the end of each file name for your convenience.
It then makes a single loop through all the flows, comparing each flow to the remaining flows in the list by treating the contents of each file as a single UTF-8 string. This is made possible by the fact that, fortunately, each saved .flo file contains absolutely no meta-data, with the possible exception of the flow format version number. If otherwise identical flows have been saved by different versions of Automate, I suspect that this flow will not recognise them as duplicates. I may work on that issue and upload an update if I can find a suitable hex editor with which to investigate.
The final action is to delete the temporary folder (a Good Boy choccie drop for me).
Constructive comments and observations always welcome.
Credit goes entirely to Pete Glass for the regex method of removing invalid characters like icons from the flow title so that the flow title can then be used as a valid filename. And also my gratitude for his flow in the first place, which this flow borrows from, which taught me a number of things about Automate and has so far inspired two new flows of my own...
Reviews and ratings can be submitted in the app.