Getting Finder results into LiveCode

Peter M. Brigham pmbrig at gmail.com
Tue Jan 12 10:50:10 EST 2016


mdls doesn't like spaces in the file path. What do I do to escape spaces here?

-- Peter

Peter M. Brigham
pmbrig at gmail.com
http://home.comcast.net/~pmbrig

On Jan 11, 2016, at 9:48 AM, Martin Koob wrote:

> 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.
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the Use-livecode mailing list