如何从查找器的“更多信息”中提取信息?

问题描述 投票:0回答:1

我一直试图从finder的“More Info”部分中提取关键字。我已经能够从“常规”部分提取数据,但是无法找到从“更多信息”部分中提取数据的方法。以下是我对“常规”部分的一些代码

- 代码版本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
macos automation applescript finder
1个回答
0
投票

您可以在Spotlight元数据存储中找到大部分(如果不是全部),例如:

do shell script “mdls “ & quoted form of “/posix/path/to/file”

可以通过指定属性名称来提取单个项目 - 请参阅mdls man page

© www.soinside.com 2019 - 2024. All rights reserved.