Jump to content

File Sequence UDF


jmon
 Share

Recommended Posts

FileSequence UDF

My job requires me everyday to work with a LOT of file sequences, mostly image file sequences. So I created this UDF. I use it to batch convert image sequences to quicktimes, resize, rename, move, backup, count total frames ...etc... I use it for image scanning, but you can use it for any files numbered. Just type in the extention you need.

In this UDF, I consider a file sequence to be of more than 3 consecutive files. Example:

C:FolderImageSequence_001.tga
C:FolderImageSequence_002.tga
C:FolderImageSequence_003.tga
....
--> C:FolderImageSequence_###.tga

Example: If you scan this folder : "C:Folder", looking for extentions like "jpg tga mov", then the function may return an array like this:

$array[0] = 3
$array[1] = C:FolderImageSequence_#####.tga
$array[2] = C:FolderImageSequence_Converted_####.jpg
$array[3] = C:FolderSubFolderquicktime movies ###.mov")

You can convert the returned file sequence to format %0id or wildcard with the provided functions:

C:FolderImageSequence_###.tga
--> C:FolderImageSequence_%03d.tga
--> C:FolderImageSequence_***.tga

C:FolderImageSequence_######.tga
--> C:FolderImageSequence_%06d.tga
--> C:FolderImageSequence_******.tga

This UDF is a relatively fast folder scanning UDF, scanning ~40 GB with about 100 file sequences (~5000 images) and gathering all the informations (Sequence length, Sequence Range, Dimensions, FileSize ...) takes about 6-7 seconds on my computer.

Remark: parts of this UDF require IrfanView, which you can download for free on their website (www.irfanview.com). I am currently converting this part of the UDF to use the FreeImage UDF instead. The UDF also uses "Array.au3" and "GDIPlus.au3".

Functions:

_FileSequence_Convert (uses IrfanView)
_FileSequence_Copy
_FileSequence_Delete
_FileSequence_Exists
_FileSequence_Find (Main function)
_FileSequence_FSToRegExp
_FileSequence_FSToWildcard
_FileSequence_GetFileName
_FileSequence_GetImageDimensions
_FileSequence_GetParentFolder
_FileSequence_GetRange
_FileSequence_GetSize
_FileSequence_Move
_FileSequence_Rename
_FileSequence_Resize (uses IrfanView)

If you see anything that could be improved, please tell me, I'd be happy to make it even faster! Comments and critics welcome! Tell me what you use it for, I am curious!

File_Sequence.au3

File_Sequence_ExampleSimple.au3

File_Sequence_ExampleAdvanced.au3

Edited by jmon
Link to comment
Share on other sites

  • 3 months later...

Wow ! that's exactly what I was searching for !! Also works in vfx industry and work with a lot of file sequences, and I'm writing concept of a new custom software that will require heavy sequences work.

Will try your UDF, many thanks for sharing.

Win7 pro x64. scripts compiled to x64. - Autoit v3.3.6.1 | Scite 1.79

Link to comment
Share on other sites

@kiboost

It's very useful with programs like Nuke and PDplayer, because they both require file numbering in format #### or regexp %0xd. In PDPlayer you can use the filesequence UDF to auto convert your sequences in Quicktime for example.

I also use it to backup 3dsmax files, which I usually save incrementally. So you can create a small program that scans for 3dsmax files sequences, and then backup them to a zip file. I think this UDF can be used for so many purposes. I use it everyday. :)

Edited by jmon
Link to comment
Share on other sites

Ahah seems we use exact same tools ! Happy to see AutoIt used in this industry, a real winner. Could be better in some aeras and faster, but so easy to develop and deploy lot of little tools here and there in our workflow.

Cheers :bye:

Win7 pro x64. scripts compiled to x64. - Autoit v3.3.6.1 | Scite 1.79

Link to comment
Share on other sites

  • 9 years later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...