TrFile_SetMetaData (function reference)

By May 1, 2017 May 15th, 2018 Online Help, Troi File Plug-in
Troi File Plug-in > Functions reference > TrFile_SetMetaData
Troi File Plug-in for FileMaker Pro

TrFile_SetMetaData

Sets metadata into an image file. Metadata can contain a description of the image, copyright information, etc.

SyntaxFunction badge

TrFile_SetMetaData ( switches ; sourceFilePath ; destFilePath ;
metadatablock )

Parameters

switchesthese determine the metadata that is set
sourceFilePaththe path to the source file
destFilePath(optional) the path to the destination file
metaDataBlocktext formatted for this function

Switches

switches can be one or more of the following:

-SetIPTCset the IPTC metadata (Photoshop’s File Info)
-SetExifset the Exif metadata
-MacCharSetthe IPTC data will be written Mac encoded
-WinCharSetthe IPTC data will be written Windows encoded
-UTF8CharSetthe IPTC data will be written as UTF-8 encoded characters (new!)

Returned Result

Data type returned

Error code

Result

The returned result is an error code. Returned error codes can be:

0no errorthe metadata was set
$$-43fnfErrsource file not found

Other errors may be returned.

Originated in

Troi File Plug-in 3.5

Compatibility

FileMaker Pro 13 to 17

Considerations

If the destination parameter is empty the metadata will be saved in the source file itself. This happens also when you specify the same source file and destination file.
Currently only works with JPEGs.
ISSUES: Photoshop (or other programs) may have added other types of metadata, like XMP. These types of metadata are not changed at the moment. This may cause inconsistent metadata in the file.

If you want to remove IPTC data set the metaDataBlock to “”

See the example files “IPTC_XMP_Metadata” for information on how to create the metadata block.

Example

Set Field [ gErrorCode ; TrFile_SetMetaData ( "-SetIPTC" ; "C:\myData\Photo1.jpg"; "" ; 
			"##IPTC 120¶ my caption ¶##END 120" ) ]

This will set the IPTC data, in this case only a caption. Note the returns in the IPTC data.

Example 2

Set Field [ gErrorCode ; TrFile_SetMetaData ( "-SetIPTC "  & this::IPTC_DestinationCharSet ;  
			this::PathToSourceFile ; this::PathToDestinationFile ; this::gMetaDataBlock ) ]

gMetaDataBlock should contain something similar to this below:

##IPTC 120
FOR IMMEDIATE RELEASE–FILE–Shania Twain performs at the Country Music Association Awards show in Nashville, Tenn., …
##END 120
##IPTC 122
CJC RWP MAH
##END 122
##IPTC 105
SHANIA TWAIN
##END 105
##IPTC 40
FOR IMMEDIATE RELEASE. A SEPT. 22, 1999 FILE PHOTO. DIGITAL IMAGE
##END 40

Related functionFunction badge

TrFile_GetMetaData

Related script stepScript step badge

Set MetaData of Image File

Related topics

Troi File Plug-in online help (overview)


Online Help Page for Troi File Plug-in for 13 to 17 –> TrFile_SetMetaData (filep4287) 2018-0515 15:57:36