Is it possible to rename a file to a two digit random number? Would I have to use the script function? I attempted this but as I know nothing about scripting I failed pretty miserably.
I ask because right now I have a button that renames like this:
[Parent folder name] - [##]_[imagewidth]px.jpg
Changing the number to something random would be awesome.
Edit: Also, how would I go about making the renamed file open with a certain program after it's renamed? I know how to get the program opened but that's about it.
The easiest way to do this is probably to use a rename script (assuming you have Opus 9) since VBScript has a convenient random number function.
Would you need it to check that the number isn't already in use by another file, though? That is still possible but a bit more work.
I'm not sure how you would do that. You'd need to know the new file's name but the only thing that knows that is the rename script, before the rename has happened, so it can't launch the program. (Unless it does something complicated, like launch a batch file which waits a couple of seconds and then launches the program with the expected new name, but that could be unreliable.)
And then my New Name code looks like this: {parent} - ~#_{picwidth}px.jpg
I couldn't work out how to make it put a zero if the number was less than 10 when I had it randomizing between 0-99 (:oops:) , which is why I went with two different functions (I don't know if that's the right word?) of 0-9.
The scripts in this thread don't check that the chosen random number isn't already used for an existing file, which could cause problems.
I have updated my Unique Numbers rename script to add a RandomNumbers option. That script will check that the chosen number isn't already in use. You can also use the PadTo setting at the top of the script to control the range of random numbers that are generated.