Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old

MetaDataQuery.AttributesForFile

Queries properties for a file.

Component Version macOS Windows Linux Server iOS SDK
MetaDataQuery 8.0 ✅ Yes ❌ No ❌ No ✅ Yes, on macOS ❌ No
MBS( "MetaDataQuery.AttributesForFile"; Path )   More

Parameters

Parameter Description Example
Path The native file path to the file to check. "/Users/cs/Desktop/sample.pdf"

Result

Returns JSON or error.

Description

Queries properties for a file.
Returns JSON block with attributes.
This provides information Spotlight knows about the file.
Includes a lot of metadata like values from EXIF and IPTC.

This function requires a native path. Use Path.FileMakerPathToNativePath to convert a FileMaker path to a native path if required. If you like to have the user choose the path, you can use FileDialog functions.
For Server be aware that server has limited permissions and may not be able to access all files on a computer.

Examples

Query download URL of file:

Set Variable [ $path ; Value: "/Users/cs/Downloads/test.html" ]
Set Variable [ $json ; Value: MBS( "MetaDataQuery.AttributesForFile"; $path) ]
Set Variable [ $link ; Value: MBS("JSON.GetPathItem"; $json; "kMDItemWhereFroms¶0") ]
Show Custom Dialog [ "Link" ; $link ]

Query song details:

MBS( "MetaDataQuery.AttributesForFile"; "/Users/cs/Music/iTunes/iTunes Music/ABBA/ABBA_ Gold - Greatest Hits/16 One of Us.m4p" )

Check image file:

MBS("MetaDataQuery.AttributesForFile"; "/Users/cs/Pictures/IMG_5199.jpeg")

Example result:
{ "kMDItemLogicalSize" : 4320752, "kMDItemFocalLength" : 24, "kMDItemPhysicalSize" : 4321280, "kMDItemMeteringMode" : 5, "kMDItemInterestingDate_Ranking" : "2023-10-19 00:00:00 +0000", "kMDItemFlashOnOff" : false, "kMDItemAcquisitionMake" : "Canon", "kMDItemFSFinderFlags" : 0, "kMDItemFSTypeCode" : 0, "kMDItemAcquisitionModel" : "Canon EOS 760D", "kMDItemProfileName" : "Apple Wide Color Sharing Profile", "kMDItemFSLabel" : 0, "kMDItemExposureProgram" : 3, "kMDItemFSCreatorCode" : 0, "kMDItemISOSpeed" : 800, "kMDItemFSSize" : 4320752, "kMDItemEXIFVersion" : "2.3", "kMDItemFSOwnerUserID" : 501, "kMDItemBitsPerSample" : 24, "_kMDItemDisplayNameWithExtensions" : "IMG_5199.jpeg", "kMDItemLastUsedDate_Ranking" : "2023-10-19 00:00:00 +0000", "kMDItemHasAlphaChannel" : false, "kMDItemFSName" : "IMG_5199.jpeg", "kMDItemUsedDates" : [ "2023-10-18 22:00:00 +0000" ], "kMDItemContentCreationDate" : "2019-04-28 13:57:29 +0000", "kMDItemKind" : "JPEG-Bild", "kMDItemFSContentChangeDate" : "2023-03-20 16:37:18 +0000", "kMDItemExposureMode" : 0, "kMDItemColorSpace" : "RGB", "kMDItemContentCreationDate_Ranking" : "2019-04-28 00:00:00 +0000", "kMDItemOrientation" : 0, "kMDItemContentModificationDate" : "2019-04-28 13:57:29 +0000", "kMDItemAperture" : 6, "kMDItemFNumber" : 8, "kMDItemFSInvisible" : false, "kMDItemLensModel" : "Canon EF-S 18-135mm f\/3.5-5.6 IS STM", "kMDItemResolutionWidthDPI" : 72, "kMDItemDisplayName" : "IMG_5199.jpeg", "kMDItemResolutionHeightDPI" : 72, "kMDItemUseCount" : 3, "kMDItemContentType" : "public.jpeg", "kMDItemFSOwnerGroupID" : 20, "kMDItemWhiteBalance" : 0, "kMDItemLastUsedDate" : "2023-10-19 08:04:21 +0000", "kMDItemPixelWidth" : 6000, "kMDItemPixelHeight" : 4000, "kMDItemFSCreationDate" : "2023-03-20 16:37:15 +0000", "kMDItemExposureTimeSeconds" : 0.033333333333333333, "kMDItemFSIsExtensionHidden" : false, "kMDItemDateAdded" : "2023-03-20 16:37:23 +0000", "kMDItemPixelCount" : 24000000, "kMDItemDocumentIdentifier" : 1079121, "kMDItemAuthors" : [ "Monika Schmitz" ], "kMDItemRedEyeOnOff" : false, "kMDItemContentTypeTree" : [ "public.jpeg", "public.image", "public.data", "public.item", "public.content" ], "kMDItemPath" : "\/System\/Volumes\/Data\/Users\/cs\/Pictures\/IMG_5199.jpeg", "kMDItemContentRating" : 0 }

See also

Blog Entries

This function checks for a license.

Created 21st December 2017, last changed 19th October 2023


MessageComposer.disableUserAttachments - MetaDataQuery.Close