Altering a NUMBER script to decrement instead of increment

Hi.
Years ago, a programming genius created the following button for me.
I looked through all my messages and this fellow is not in there. Alas.

@nodeselect @set Start={dlgstringS|Number the first selected file (use leading zeros to pad}:|01 @set By={dlgstringS|Increment file numbers by:|1}) Rename NUMBER=" {$Start}" BY={$By} PATTERN="*" TO="[#] *"

The botton adds a numbers to the beginning of the files you have selected, incrementing the number for each file.

Now I'd like to have it number the files in reverse order.
In other words, to DECREMENT the prefixes it appends.

Looking at the script, I don't see any mathematical function I can alter.
Nor can I give the variable "By" a value of "-1"
Where is the secret to this function?

Thx

Easiest way is to revere-sort the files before running the button. They'll be numbered in the order they are listed so that will give the same result as numbering them downwards.

unfortunately, the numbering was applied in alphabetical order, no matter which way I sorted it

Works here...

The button in your post, did you type parts of it by hand or edit it? It's got some brackets missing and some in the wrong places; it doesn't work at all as-is in the post above.

I fixed it like this and it counts upwards and downwards depending on which way the files are sorted when I run it:

@nodeselect @set Start={dlgstringS|Number the first selected file (use leading zeros to pad):|01} @set By={dlgstringS|Increment file numbers by:|1} Rename NUMBER=" {$Start}" BY={$By} PATTERN="*" TO="[#] *"

I typed it by hand, since there is no internet on the computer where the script is located.
And when I created new test files, it worked for me too.
Thanks!

Will explore why I couldn't get it to work on my original batch of files...