Jump to content
Sign in to follow this  
jmon

File Sequence UDF

Recommended Posts

jmon

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

Share this post


Link to post
Share on other sites
kiboost

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

Share this post


Link to post
Share on other sites
jmon

@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

Share this post


Link to post
Share on other sites
kiboost

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

Share this post


Link to post
Share on other sites

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
Sign in to follow this  

  • Similar Content

    • caramen
      By caramen
      I watched _OL_ItemSend&_OL_ItemFind&_OL_ItemCreate in OutlookEx UDF but hmmm
       
      Since it use the test environnement i cant get the orders of the mail creation
       
      Can someone make me win some time of reading all exemples script and lead me how to do one ?
      That whould be lovely.
      Gnight
    • Xandy
      By Xandy
      Special thanks: AdmiralAlkex, Melba23, MrCrearoR, Dragon Warrior 3, SDL
      MapIt is a tile world editor.  MapIt was built around the concept of reversing Dragon Warrior map images.  MapIt can take image input and produce a tile and world array.  
      Changing and replacing tile / world data is easy.  B/c tile world editor.

      CTRL+R in image above to signal replace tile action and I use "G" to Get the tile under mouse.
      A full list of hotkeys can be assigned in the: Help Menu\Hotkeys
       
      MapParser is a C++ project that scans images for unique tiles. 
      MapIt can be downloaded without MapParser. MapParser can be toggled off in the Scan_Image dialog. Without MapParser, MapIt will use the Scan_Tiles() function written in AutoIt ; which is 100 * slower Idk. If MapParser.exe will not run for you:      Installing Visual C++ Redistributable for Visual Studio 2015 should fix it: https://www.microsoft.com/en-us/download/details.aspx?id=48145   
      You can start with example world and tiles.
      Example world was made following these steps:
      Started with a tile map image of DragonWarrior3 town of: Reeve From MapIt World Menu \ New \ Scan_Image dialog, I set the area to exclude the key legend to the far right of image. After scanning the map image to world and tile array.  I removed a few of the map artifacts.  More work could be done on this world; removing unwanted tiles, but it is fine for now. I saved my world to disk.  This creates folder: Worldname: Containing folder of Tiles and a Worldname.txt. Using The Gimp, I edited some tiles to have a transparent color: Stairs, Trees, Desk Tables, Chest-of-drawers, Chairs, Signs, Doors, Beds. I changed the world layers to 2: World Menu \ Properties. F9 Finds all selected tile on current layer and changes to a new selected tile on new layer. I used F9 to change all Trees on layer: 0 to Trees on layer: 1. Then I used F9 to change all Trees on layer: 0 to Grass on layer: 0  
      In this video you can see how I used the Tile Menu \ Replace From Disk option to remap tile images to my custom tiles.  Conveniently my tiles already have a transparent pixel.
      See video for how that was done:
      To use the example world:
      First unzip the world save file: http://songersoft.com/programming/mapit/worlds/Reeve_Swapped.zip From the World Menu: choose \Load Navigate to the Reeve_Swapped.txt located in the extracted zip. Or you can scan any image.
      The map images I used are here: http://www.realmofdarkness.net/dq/games/nes/dw3/maps/world
      For download, videos, and example of created world file data; please visit the MapIt webpage: http://songersoft.com/programming/mapit/mapit_about.phtml
    • Tersion
      By Tersion
      Here the this wiki page with list of available UDFs for data compression. For my tasks I only need ZIP support, so I started looking at pure AutoIt UDFs without any 3rd party dlls. And found out that most of available realizations uses standard ("native method") Windows dll - "zipfldr.dll". So for now I chose ZIP UDF by wraithdu. I've tested it on Windows 7 (x64) and it seem works fine. But here the comment from another topic where user says that Windows 10 discontinued support of "zipfldr.dll". Now I confused. I don't have around any Windows 10 machine to tested it. So maybe someone could confirm or deny that? Or maybe would better to switch to UDF with 7zip dll?
      I need an advice...
    • TheSaint
      By TheSaint
      Here is the bare bones of a UDF I have started work on.
      Mostly just a proof of concept at this stage, and still need to add some functions and dress the UDF up a bit ... to look like a UDF ... though it has my own distinct styling, especially as I have never really developed a UDF before now .... used plenty and modified plenty though. I've even invented my own UDF variable naming convention, which I am sure some of you will be aghast at. I work with what feels best for me, but others are free to adapt if they wish.
      The idea is to emulate the simplicity of INI files, but gain the benefits of SQL.
      Two scripts are provided.
      (1) The UDF, a work in progress - SimpleSQL_UDF.au3
      (2) An example or testing script - UDF_Test.au3
      Another first for me, is creating a 2D array from scratch, never done that before, that I can recall ... never had a need, and even for 1 dimension arrays, for a long time now, I have just used _StringSplit to create them. So I needed a bit of a refresher course, which my good buddy @TheDcoder assisted me with ... not without some angst I might add. LOL
      SimpleSQL_UDF.zip  (12 downloads previously)
      (I have now completed all the functions I intended to. My next update will be a big improvement, bringing things more inline with my latest INItoSQL DB program changes.)
      Program requires the sqlite3.dll, not included, but easily enough obtained.
      Hopefully the usage is self-evident ... just change the Job number variable in the UDF_Test.au3 file to check the existing functions out.
      Enjoy!
      P.S. This is also related to a new program I have just finished and uploaded - INItoSQL DB
    • xtcislove
      By xtcislove
      Hello,
      as a start in Autoit i tried something i was missing since im using Autoit. 

      I build a custom MessageBox which has a large amount of custom options and which scales its size on the parameters you set. 

      Aviable Settings:
      -Title
      -Unlimited Buttons
      -Text Color (Buttons, Text)

      -Background Color (Msgbox, Buttons, Label) 

      -Button Timeout
      -Autoclose Timeout
      -Icon (Default, No Icon, Custom)

      -Label/ Button Style. 
      -Transparency

      I tried to keep this as close as i could to a Msgbox i was used too on my batch times.

      After i was ready i realised, @Melba23 probably build a way better msgbox which would have suit my needs enterly, anyway thanks to @Melba23 because i use his Stringsize UDF. 

       
       
      local $Message = _sMsgBox("Test", 6, "Continue?") if @extended <> -1 Then MsgBox(0, @extended, $Message&" Button pressed")  
      ScalingMessageBox.au3
×