检查Applescript中的两个文件是否相同
我正试图在Skim中获取当前打开的PDF的书目信息。 为此,我将该文件与我在BibDesk拥有的所有出版物的链接文件进行比较。 但出于某种原因,这种比较不起作用:检查Applescript中的两个文件是否相同,applescript,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 docume
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,但是比较它们并不起作用。为什么会这样?我需要做些什么不同的事情呢?事实证明这非常简单:您只需与as字符串进行比较:
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