Getting Finder results into LiveCode

Martin Koob mkoob at rogers.com
Mon Jan 11 09:48:15 EST 2016


Any time I see "can you get this info on a Mac" I head for the shell.

I found the following for a terminal command to get file info.

http://apple.stackexchange.com/questions/165095/is-there-a-similar-functionality-of-get-info-cmdi-from-the-mac-os-x-termina

So it says use the mdls command

So then I put it in a shell function in a LiveCode Script.

http://apple.stackexchange.com/questions/165095/is-there-a-similar-functionality-of-get-info-cmdi-from-the-mac-os-x-termina

on mouseUp
   answer File "Select file to get info on..."
   put it into tFilePath
   put shell( "mdls" && tFilepath) into tFileInfo
   put tFileInfo into field 1
end mouseUp

Then you get the following data in tFileInfo that you would then parse for
the data you want.

-------------------------------
kMDItemAlternateNames          = (
    "MyFile.rtf"
)
kMDItemContentCreationDate     = 2016-01-11 15:04:45 +0000
kMDItemContentModificationDate = 2016-01-11 15:04:45 +0000
kMDItemContentType             = "public.rtf"
kMDItemContentTypeTree         = (
    "public.rtf",
    "public.text",
    "public.data",
    "public.item",
    "public.content"
)
kMDItemDateAdded               = 2016-01-11 15:04:45 +0000
kMDItemDisplayName             = "MyFile"
kMDItemFSContentChangeDate     = 2016-01-11 15:04:45 +0000
kMDItemFSCreationDate          = 2016-01-11 15:04:45 +0000
kMDItemFSCreatorCode           = ""
kMDItemFSFinderFlags           = 16
kMDItemFSHasCustomIcon         = (null)
kMDItemFSInvisible             = 0
kMDItemFSIsExtensionHidden     = 1
kMDItemFSIsStationery          = (null)
kMDItemFSLabel                 = 0
kMDItemFSName                  = "MyFile.rtf"
kMDItemFSNodeCount             = (null)
kMDItemFSOwnerGroupID          = 20
kMDItemFSOwnerUserID           = 501
kMDItemFSSize                  = 332
kMDItemFSTypeCode              = ""
kMDItemKind                    = "Rich Text Document"
kMDItemLastUsedDate            = 2016-01-11 15:04:45 +0000
kMDItemLogicalSize             = 332
kMDItemPhysicalSize            = 4096
kMDItemUseCount                = 1
kMDItemUsedDates               = (
    "2016-01-11 05:00:00 +0000"
)
-----------------------------


Martin



--
View this message in context: http://runtime-revolution.278305.n4.nabble.com/Getting-Finder-results-into-LiveCode-tp4700069p4700072.html
Sent from the Revolution - User mailing list archive at Nabble.com.




More information about the use-livecode mailing list