检查Applescript中的两个文件是否相同

时间:2015-10-17 12:30:52

标签: applescript

我正在尝试获取Skim中当前打开的PDF的书目信息。 为此,我将文件与BibDesk中所有出版物的链接文件进行比较 但由于某种原因,这种比较不起作用:

tell application "Skim"
    set theFile to the file of the front document

    tell application "BibDesk"
        repeat with currentPub in publications of front document
            set bibFile to linked file of currentPub
            if bibFile = theFile then
                say "lala"
            end if
        end repeat
    end tell
end tell

该脚本确实正确获取了文件和bibFile,但比较它们不起作用。为什么这样做,我需要做些什么呢?

1 个答案:

答案 0 :(得分:0)

事实证明它非常简单:你只需要与as string进行比较:

tell application "Skim"
    set theFile to the file of the front document

        tell application "BibDesk"
            repeat with currentPub in publications of front document
                set bibFile to linked file of currentPub
                if bibFile as string = theFile as string then
                    say "lala"
                end if
            end repeat
        end tell
end tell