RL Vision Knowledge Base
Support questions and answers for software by RL Vision.
Note: This is an archived discussion. Any bug, problem or suggestion mentioned here is likely to have been fixed since it was written.
Subject: Re: Flash Renamer 6.41 - Add random number with padding to file.
Date: Mon, 25 Oct 2010 18:47:53 +0200Hi,
Thank you for notifying me about the problems. I'll have a look at it as soon as I have the time. Maybe I can also add your zero-padding request then.
// Dan
Mr. Random wrote:
> Hi,
> I'm trying Flash Renamer 6.41 and the software is pretty neat. Thank you very much for your effort.
>
> I have a comment in particular. I see that the tag in the file name still needs some additional tweaking.
>
> For example:
>
> (Note: In the next examples the file name is FileName.txt
>
> 1) if I put (no spaces), the name generated is: 835ame].txt
> 2) if I put (1 space), the name generated is: 104Name].txt
> 3) if I put (2 spaces), the name generated is: 584FileName.txt (this looks ok)
> 4) if I put (no spaces or any number of spaces), the name generated is just the number 584.txt File name lost.
>
> My need is about adding a random Number to the file name and also to be able to add padding to the number. Below you will find a script that fits to my needs but it's not generic.
>
> Best Regards,
>
> Thanks again.
>
> Mr. R.
>
>
> --------------------------------------------------------
> language=vbscript
> description=This script inserts a random prefix number to the files and a Space. Argument: Length of the Random Number. Default = 2
>
> '------------------------------------------------------------------------------------------------
> 'Do not modify this script! It might be overwritten by the installer if 'you upgrade Flash Renamer. Make a copy of it and modify that instead.
> '------------------------------------------------------------------------------------------------
>
> Function Rename()
> Dim NbrDigits, UpToNumber, MyValue, ZeroPad
>
> 'Validations
> NbrDigits = 0
> If Trim(FlashRenamer.Args) <> "" And IsNumeric(FlashRenamer.Args) Then
> NbrDigits = CInt(FlashRenamer.Args)
> End If If NbrDigits < 2 Then NbrDigits = 2
>
> 'Random Number
> UpToNumber = (10 ^ NbrDigits) - 1
> MyValue = Int((UpToNumber * Rnd) + 1)
>
> 'Add Zero Padding
> For i = 1 To NbrDigits
> ZeroPad = ZeroPad & "0"
> Next
>
> 'Rename file
> Rename = Right(ZeroPad & MyValue, NbrDigits) & " " & FlashRenamer.Filename
> End Function
Thank you for notifying me about the problems. I'll have a look at it as soon as I have the time. Maybe I can also add your zero-padding request then.
// Dan
Mr. Random wrote:
> Hi,
> I'm trying Flash Renamer 6.41 and the software is pretty neat. Thank you very much for your effort.
>
> I have a comment in particular. I see that the
>
> For example:
>
> (Note: In the next examples the file name is FileName.txt
>
> 1) if I put
> 2) if I put
> 3) if I put
> 4) if I put
>
> My need is about adding a random Number to the file name and also to be able to add padding to the number. Below you will find a script that fits to my needs but it's not generic.
>
> Best Regards,
>
> Thanks again.
>
> Mr. R.
>
>
> --------------------------------------------------------
> language=vbscript
> description=This script inserts a random prefix number to the files and a Space. Argument: Length of the Random Number. Default = 2
>
> '------------------------------------------------------------------------------------------------
> 'Do not modify this script! It might be overwritten by the installer if 'you upgrade Flash Renamer. Make a copy of it and modify that instead.
> '------------------------------------------------------------------------------------------------
>
> Function Rename()
> Dim NbrDigits, UpToNumber, MyValue, ZeroPad
>
> 'Validations
> NbrDigits = 0
> If Trim(FlashRenamer.Args) <> "" And IsNumeric(FlashRenamer.Args) Then
> NbrDigits = CInt(FlashRenamer.Args)
> End If If NbrDigits < 2 Then NbrDigits = 2
>
> 'Random Number
> UpToNumber = (10 ^ NbrDigits) - 1
> MyValue = Int((UpToNumber * Rnd) + 1)
>
> 'Add Zero Padding
> For i = 1 To NbrDigits
> ZeroPad = ZeroPad & "0"
> Next
>
> 'Rename file
> Rename = Right(ZeroPad & MyValue, NbrDigits) & " " & FlashRenamer.Filename
> End Function


