Did you know that your Mac tracks URLs used with downloaded files?
In the metadata for a file, you find extra attributes for download URL and download date, which spotlight uses to track downloads. In Finder, you find the URL in the information dialog for the file.
In Xojo, you can use MDItemMBS class:
dim file as FolderItem = DownloadsFolderMBS(0).Child("test.html") dim item as new MDItemMBS(file) dim value as Variant = item.GetAttribute(MDItemMBS.kMDItemWhereFroms) if value <> nil then dim values() as Variant = value dim Link as String = values(0) MsgBox link end if
In FileMaker, our MetaDataQuery.AttributesForFile would provide all the metadata as JSON and this includes the kMDItemWhereFroms entry:
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 ]
If you like to get rid of the attributes, you can use xattr -c followed with the path to the file.
Or in Xojo use ExtendedAttributesMBS module to do it in code.