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: creating a batch list
Date: Mon, 27 Jul 2009 19:39:45 +0200Hi,
There is not such function yet, although I have plans for implementing something similar. Until then, you might find the attached script useful. It is a script I made for someone else. It is not 100% finished so I can't guarantee that it will work perfectly.
// Dan
cliff wrote:
> Is there a way of creating a batch change list and importing it into the renamer?
> for example -
> if I have a list containing entries such as
>
> aaa
> http:\\www.xyz.com\aaalongname.rar
> bbb
> http:\\www.xyz.com\bbblongname.rar
>
> and I want to create a list to change entries from the second format to the first format
> like "http:\\www.xyz.com\aaalongname.rar" to "aaa".
>
> is there a way to do this? a script?(i'm no programmer) if not can this be a new addition in the next release?
>
language=vbscript
description=This script takes a comma separated list (CSV) with two columns: old filename and new filename. If the old name is found it will be renamed to the new. Type a filename containing the CSV file in the argument box.
' FlashRenamer.Filename - This is the string that Flash Renamer wants you to process. Note that it depends on the "Process Name" and "Process Extension" settings in Flash Renamer.
' FlashRenamer.FullFilename - This always contains the full filename, including extension, in contrast to the above. Use it for reference.
' FlashRenamer.Path - This is simply the path where the file is located.
' FlashRenamer.Args - The arguments you can enter when you run a script in Flash Renamer are delivered through this variable.
' FlashRenamer.FormatTags(myTags) - This is a function you can call to "render" a format string, just like format strings in Flash Renamer. For example, FlashRenamer.FormatTags("") will return the size of the file!
' FlashRenamer.Preview - This is a boolean value (true or false) that tells you if your script is being run to generate the preview or if it is the "real deal".
' FlashRenamer.DiskName - When runing presets, multiple functions process the filename before writing it to disk. Since the filename may have been changed previous to entering your script, you should use .DiskName if you want to access the file on disk.
' FlashRenamer.NumItems - This always contains to total amount of files that are destined to be renamed
' FlashRenamer.ItemOrder - This contains a zero padded id repressenting the order in which this item is located, relative to the rest of the items.
' FlashRenamer.BrowserPath - This contains the path that is currently loaded in the file browser in Flash Renamer. If using free select mode, this is empty.
'
'------------------------------------------------------------------------------------------------
'- Global variables -----------------------------------------------------------------------------
'------------------------------------------------------------------------------------------------
Dim old_names()
Dim new_names()
Dim nFiles
Dim bHaveFile
'------------------------------------------------------------------------------------------------
'- Init function --------------------------------------------------------------------------------
'------------------------------------------------------------------------------------------------
Function Init()
bHaveFile = false
Const fileRead = 1
redim preserve old_names(0)
redim preserve new_names(0)
nFiles = 0
Set objFSO = CreateObject("Scripting.FileSystemObject")
If objFSO.FileExists( FlashRenamer.Args ) Then
bHaveFile = true
If objFSO.FileExists( FlashRenamer.Args ) Then
Set objFile = objFSO.OpenTextFile(FlashRenamer.Args ,fileRead)
Do While Not objFile.AtEndOfStream
tmp = Split( objFile.ReadLine , "," )
if UBound(tmp) = 1 then
nFiles = nFiles + 1
redim preserve old_names(nFiles)
redim preserve new_names(nFiles)
old_names(nFiles) = tmp(0)
new_names(nFiles) = tmp(1)
end if
Loop
objFile.Close
End If
else
if FlashRenamer.Preview = false then MsgBox("Unable to open list file...")
end if
End Function
'------------------------------------------------------------------------------------------------
'- Rename function ------------------------------------------------------------------------------
'------------------------------------------------------------------------------------------------
Function Rename()
if bHaveFile = false then exit function
for n=1 to nFiles
if FlashRenamer.Filename = old_names(n) then
Rename = new_names(n)
end if
next
End Function
List Rename.frs
There is not such function yet, although I have plans for implementing something similar. Until then, you might find the attached script useful. It is a script I made for someone else. It is not 100% finished so I can't guarantee that it will work perfectly.
// Dan
cliff wrote:
> Is there a way of creating a batch change list and importing it into the renamer?
> for example -
> if I have a list containing entries such as
>
> aaa
> http:\\www.xyz.com\aaalongname.rar
> bbb
> http:\\www.xyz.com\bbblongname.rar
>
> and I want to create a list to change entries from the second format to the first format
> like "http:\\www.xyz.com\aaalongname.rar" to "aaa".
>
> is there a way to do this? a script?(i'm no programmer) if not can this be a new addition in the next release?
>
language=vbscript
description=This script takes a comma separated list (CSV) with two columns: old filename and new filename. If the old name is found it will be renamed to the new. Type a filename containing the CSV file in the argument box.
' FlashRenamer.Filename - This is the string that Flash Renamer wants you to process. Note that it depends on the "Process Name" and "Process Extension" settings in Flash Renamer.
' FlashRenamer.FullFilename - This always contains the full filename, including extension, in contrast to the above. Use it for reference.
' FlashRenamer.Path - This is simply the path where the file is located.
' FlashRenamer.Args - The arguments you can enter when you run a script in Flash Renamer are delivered through this variable.
' FlashRenamer.FormatTags(myTags) - This is a function you can call to "render" a format string, just like format strings in Flash Renamer. For example, FlashRenamer.FormatTags("
' FlashRenamer.Preview - This is a boolean value (true or false) that tells you if your script is being run to generate the preview or if it is the "real deal".
' FlashRenamer.DiskName - When runing presets, multiple functions process the filename before writing it to disk. Since the filename may have been changed previous to entering your script, you should use .DiskName if you want to access the file on disk.
' FlashRenamer.NumItems - This always contains to total amount of files that are destined to be renamed
' FlashRenamer.ItemOrder - This contains a zero padded id repressenting the order in which this item is located, relative to the rest of the items.
' FlashRenamer.BrowserPath - This contains the path that is currently loaded in the file browser in Flash Renamer. If using free select mode, this is empty.
'
'------------------------------------------------------------------------------------------------
'- Global variables -----------------------------------------------------------------------------
'------------------------------------------------------------------------------------------------
Dim old_names()
Dim new_names()
Dim nFiles
Dim bHaveFile
'------------------------------------------------------------------------------------------------
'- Init function --------------------------------------------------------------------------------
'------------------------------------------------------------------------------------------------
Function Init()
bHaveFile = false
Const fileRead = 1
redim preserve old_names(0)
redim preserve new_names(0)
nFiles = 0
Set objFSO = CreateObject("Scripting.FileSystemObject")
If objFSO.FileExists( FlashRenamer.Args ) Then
bHaveFile = true
If objFSO.FileExists( FlashRenamer.Args ) Then
Set objFile = objFSO.OpenTextFile(FlashRenamer.Args ,fileRead)
Do While Not objFile.AtEndOfStream
tmp = Split( objFile.ReadLine , "," )
if UBound(tmp) = 1 then
nFiles = nFiles + 1
redim preserve old_names(nFiles)
redim preserve new_names(nFiles)
old_names(nFiles) = tmp(0)
new_names(nFiles) = tmp(1)
end if
Loop
objFile.Close
End If
else
if FlashRenamer.Preview = false then MsgBox("Unable to open list file...")
end if
End Function
'------------------------------------------------------------------------------------------------
'- Rename function ------------------------------------------------------------------------------
'------------------------------------------------------------------------------------------------
Function Rename()
if bHaveFile = false then exit function
for n=1 to nFiles
if FlashRenamer.Filename = old_names(n) then
Rename = new_names(n)
end if
next
End Function
List Rename.frs