Firstly I 'm trying to figure this whole process out. To hopefully understand it.
What I am trying to do is use a scanner to rename files.
So when I scan it I need the EAN to rename the selected file but if I have scanned it before I need it to add _2 and somehow if 5xxxxxxxxxxxx_2 exists then make it _3.
What i was first trying to do is add the scanned string to the variable so it can compare the previous scanned item.
This is the reg expressions that I am using \b503\d.*\r
Basically, you have to first test whether the target file exists, and then if it does, you need to keep incrementing an index until you find one that doesn't exist and use that.
It's non trivial to get it correct, so use some caution.
I've almost got it working as I would like.
The only issue I have is that where I manually select the file (highlight) this may then not be the file that gets renamed.
For example if you have the files
1.jpg
3.jpg
5.jpg
7.jpg
If I select 3.jpg then scan, the first interaction from the scanner begins with the number 5 and therefore will jump to file 5.jpg, and then this one gets renamed.
I would need it to remember the trigger value but not let it input to the finder?
so that the originally selected file remains selected