On Oct 11, 2011, at 9:15 PM, Christopher Stone wrote: set cmd to "mdls \\ -name kMDItemDescription \\ -name kMDItemFSCreationDate \\ -name kMDItemHeadline \\ -name kMDItemPixelHeight \\ -name kMDItemPixelWidth \\ -name kMDItemTitle " & posixPath
If you're only using these few items, you can control the output of the script that I supplied very easily, and even simplify what I supplied.
on getMDLSDetails(strFilePath)
set strCommandResult to do shell script "mdls -name kMDItemDescription -name kMDItemFSCreationDate -name kMDItemHeadline -name kMDItemPixelHeight -name kMDItemPixelWidth -name kMDItemTitle " & (quoted form of strFilePath)
set lstItems to paragraphs of strCommandResult set lstScriptItems to {} repeat with strLine in lstItems set strLine to replaceText(strLine, "=", "=\"") & "\""
set strLine to replaceText(strLine, "=", ":") set lstScriptItems to lstScriptItems & strLine end repeat set AppleScript's text item delimiters to ", "
set strScript to lstScriptItems as string set AppleScript's text item delimiters to "" set strScript to "{" & strScript & "}"
return run script strScript
end getMDLSDetails
on replaceText(strText, strCharactersToReplace, strReplacementCharacters) set AppleScript's text item delimiters to strCharactersToReplace set lstOriginalTextItems to text items of strText set AppleScript's text item delimiters to strReplacementCharacters set strResult to lstOriginalTextItems as string set AppleScript's text item delimiters to "" return strResult as Unicode text end replaceText |