如何从 finder 的 'More Info' 中提取信息?
How does one extract info from the 'More Info' of finder?
我一直在尝试从 finder 的 'More Info' 部分提取关键字。我已经能够从 'General' 部分提取数据,但无法找到从 'More Info' 部分提取数据的方法。下面是我为 'General' 部分
编写的一些代码
-- 代码版本 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
您可以在 Spotlight 元数据存储中找到大部分(如果不是全部的话),例如:
do shell script “mdls “ & quoted form of “/posix/path/to/file”
可以通过指定属性名称来提取单个项目 - 请参阅 mdls man page。
我一直在尝试从 finder 的 'More Info' 部分提取关键字。我已经能够从 'General' 部分提取数据,但无法找到从 'More Info' 部分提取数据的方法。下面是我为 'General' 部分
编写的一些代码-- 代码版本 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
您可以在 Spotlight 元数据存储中找到大部分(如果不是全部的话),例如:
do shell script “mdls “ & quoted form of “/posix/path/to/file”
可以通过指定属性名称来提取单个项目 - 请参阅 mdls man page。