FredP Posted May 23, 2008 Share Posted May 23, 2008 I am having to find the "padding" of an image sequence. Padding is the number of digits used in the sequential filename. Filename_00001.tga Filename_00002.tga Has a padding of 5 digits. In other scripting languages I have used, that is represented by %d5. What I need to do is Identify the padding, and then use that number to call a specific frame number up. "%d"&Length ( filename::firstframe ) the field firstframe based on the above example would have 00001 in it. So to call up frame 25 in other scripting languages, I would use "25 %d5" which would become 00025 with the correct padding. I am sure there is a way to do this in filemaker, but I dont know which function to use. Any help would be appreciated. Link to comment Share on other sites More sharing options...
AHunter3 Posted May 23, 2008 Share Posted May 23, 2008 Wouldn't your example be either a padding to 5 digits or a padding of 4 digits? 00005.tga? "FileName_" & Right ("000000000000000000000"& $Currentdigit), $PaddingToUse & ".tga" would output FileName_00003.tga if you feed it 3 for $Currentdigit and 5 for $PaddingToUse. Or did you mean going the other way, feeding it a string like "FileName_00003.tga" and having it output how many padding zeros got used? Let (rightofdash = Middle (fullstring, position (fullstring, "_", 1, 1)+1, length (fullstring) ); PatternCount (rightofdash, "0") ) ought to output 4 if you feed it "FileName_00003.tga" in a field/variable 'fullstring' Link to comment Share on other sites More sharing options...
FredP Posted May 23, 2008 Author Share Posted May 23, 2008 00001 I consider padding 5 digit padding. 00023 I also consider 5 digit padding. Is that what you are asking? I consider the total digits the amount of padding. I am having to generate a frame 0 for an image sequence via a script. In order to write out frame 0, I need to know the padding involved. So Filename_001.jpg would get a file written out which is Filename_000.jpg But Filename_000001.tga would get a file written out Filename_000000.tga In order for the frame filemaker creates to be considered part of the sequential sequence, the filename as well as the padding needs to be the same. So essentially, i think your first example is what I need. Link to comment Share on other sites More sharing options...
Recommended Posts