我一直在尝试从finder的“更多信息”部分提取关键字。我已经能够从“常规”部分提取数据,但无法找到从“更多信息”部分提取数据的方法。以下是我为“常规”部分提供的一些代码
-代码版本1-
on run
tell application "Finder"
set selectedItem to (item 1 of (get selection))
set infoList to {}
copy ("Displayed Name: " & displayed name of selectedItem) to end of infoList
copy ("Kind: " & kind of selectedItem) to end of infoList
copy ("Size: " & size of selectedItem & " (" & physical size of selectedItem & ")") to end of infoList
copy ("Where: " & (selectedItem as alias) as string) to end of infoList
copy ("Created: " & creation date of selectedItem) to end of infoList
copy ("Modified: " & modification date of selectedItem) to end of infoList
copy ("Name & Extension: " & name of selectedItem) to end of infoList
copy ("Locked: " & locked of selectedItem) to end of infoList
copy ("Comments: " & comment of selectedItem) to end of infoList
copy ("Owner: " & owner of selectedItem) to end of infoList
copy ("Group: " & group of selectedItem) to end of infoList
end tell
set {od, AppleScript's text item delimiters} to {AppleScript's text item delimiters, return}
set infoAsString to infoList as string
set AppleScript's text item delimiters to od
set the clipboard to infoAsString
return infoAsString
end run
-代码版本2-
tell application "Image Events"
-- start the Image Events application
launch
-- open the image file
set this_image to open (inputPath & "HighRes/" & fname & ".tif")
-- extract the value for the metadata tag
tell this_image
set the imgDescp to the value of metadata tag "description"
end tell
-- purge the open image data
close this_image
end tell
答案 0 :(得分:0)
您可以在Spotlight元数据存储中找到大部分(如果不是全部的话),例如:
do shell script “mdls “ & quoted form of “/posix/path/to/file”
可以通过指定属性名称来提取各个项目-请参见mdls man page。