Script functions reference > Script functions in alphabetical order > S

S
SaveCompCResourceToFile
Syntax
SaveCompCResourceToFile(id, filename, replaceMetadata, base64Encode);
1 – Replace metadata
0 – Do not replace
1 – Base64 encode
0 – Do not Base64 encode
Description
Saves the Composition Center resource specified in the id parameter in the file specified in the filename parameter.
For information about other Composition Center resource functions, see Composition Center resource functions.
Example
This example gets the resources and saves them in the working directory.
num cnt = getCompCResourceCount();
num i = 0;
while(i<cnt)
{
  GetCompCResourceInfo(i,$id,$name,$contentType,$section); 
i++;
if(StrIdx($contentType,"image")== 0)
//checks if text resource
{
$filename = "./" + $id + ".xml";
SaveCompCResourceToFile($id,$filename,0,0);//save as XML
}
else
{
$filename = "./" + $id + ".jpg";
SaveCompCResourceToFile($id,$filename,0,0);//for JPEG file
}
}
OpenText StreamServe 5.6.2 Updated: 2018-01-26