The output I would expect from: 'mdls /Applications/TextEdit.app' is similar to this which comes from a test text file in the Applications Folder:
kMDItemContentCreationDate = 2011-02-05 16:36:34 -0600
kMDItemContentModificationDate = 2011-02-05 16:36:34 -0600
kMDItemContentType = "public.plain-text"
kMDItemContentTypeTree = (
"public.plain-text",
"public.text",
"public.data",
"public.item",
"public.content"
)
kMDItemDisplayName = "test.txt"
kMDItemFSContentChangeDate = 2011-02-05 16:36:34 -0600
kMDItemFSCreationDate = 2011-02-05 16:36:34 -0600
kMDItemFSCreatorCode = ""
kMDItemFSFinderFlags = 0
kMDItemFSHasCustomIcon = 0
kMDItemFSInvisible = 0
kMDItemFSIsExtensionHidden = 0
kMDItemFSIsStationery = 0
kMDItemFSLabel = 0
kMDItemFSName = "test.txt"
kMDItemFSNodeCount = 0
kMDItemFSOwnerGroupID = 80
kMDItemFSOwnerUserID = 501
kMDItemFSSize = 17639
kMDItemFSTypeCode = ""
kMDItemKind = "BBEdit text document"
kMDItemLastUsedDate = 2011-02-05 16:36:34 -0600
kMDItemUsedDates = (
"2011-02-05 00:00:00 -0600"
)
kMDItemWhereFroms = (
)
What I actually get from 'TextEdit.app' is zippo from the command line or "" from a do shell script in Applescript.
I do realize of course that the metadata for a directory will be different than that of a file, but an application is a pseudo file and therefore should behave similarly with tools like 'mdls' - or so it seems to me.
I can do something like this and accomplish what I want:
set theApp to "/Applications/TextEdit.app"
set cmd to "mdls \\
-name kMDItemFSName \\
-name kMDItemKind \\
-name kMDItemFSCreationDate \\
-name kMDItemFSContentChangeDate \\
-name kMDItemLastUsedDate \\
-name kMDItemUsedDates \\
" & theApp
set mdlsOutput to do shell script cmd
Curiously though the output is not in the order I've specified in the command.
Also in the following I'm not able to get the -nullmarker string to change from null.
set cmd to "mdls \\
-name kMDItemFSName \\
-name kMDItemKind \\
-name kMDItemFSCreationDate \\
-name kMDItemFSContentChangeDate \\
-name kMDItemLastUsedDate \\
-raw \\
-nullMarker \", \" \\
/Applications/TextEdit.app"
So I'm having to resort to:
set mdlsOutput to do shell script cmd
set AppleScript's text item delimiters to (character id 0)
text items of mdlsOutput
This is not a big problem, but I'd like to know if my syntax is wrong for -nullmarker or if I've hit a bug.
--
Best Regards,
Chris