FileReference.GetFileInSequence

Description

Returns the resolved path of the specified file in the file sequence.

A file sequence is a set of multiple files with the same base name, such as 'myfile.1.pic', 'myfile.2.pic', etc. For example, when rendering to disk, Softimage creates file sequences based on a base filename that you provide in the Render Options property page and when browsing the output folder, Softimage displays file sequences as a single entity with an annotation like: 'myfile.[1..2].pic'.

Scripting Syntax

oString = FileReference.GetFileInSequence( Index );

Return Value

String The resolved path of a specific file in the file sequence. If the file is not a sequence, the index 0 will return the resolved path, else if the index is greater than 0 an error is returned. If the index is out of bound, the path returned is empty and an error is returned.

Parameters

Parameter Type Description
Index Long Indicates the position of the file in the file sequence. Even though file sequences start at '1', this index is zero-based, so if you want 'myoutput.24.pic', you need to specify '23' for this argument. Note: If the index is equal to or greater than the number of files in the sequence, an error is returned

Examples

JScript Example

NewScene( null, false );
// ---------------------------------------------------------------------------
//      SETUP
//
// First import a model so we have some external files to find
var FPath = XSIUtils.BuildPath(
        Application.InstallationPath( siFactoryPath ),
        "Data", "XSI_SAMPLES", "Models", "Man_Face.emdl"
);
ImportModel( FPath, null, true );
// ---------------------------------------------------------------------------
//      USING THE FileReference OBJECT
//
// Get the collection of all external files on the scene
var oScene = Application.ActiveProject.ActiveScene;
var l_extFileList = oScene.ExternalFiles;
// Get the first file object in the list
var oFile = l_extFileList(0);
if ( l_extFileList.NumberOfFilesInSequence > 1 ) {
        // Show the last file in the sequence
        Application.LogMessage( oFile.GetFileInSequence(oFile.NumberOfFilesInSequence-1) );
}
// Expected results:
//INFO : <factory_path>\rsrc\noIcon3.pic

See Also

FileReference.NumberOfFilesInSequence