2015-10-17 110 views
0

我正在嘗試獲取脫機中當前打開的PDF的書目信息。 爲此,我將該文件與BibDesk中所有出版物的鏈接文件進行比較。
但由於某些原因,比較不工作:檢查Applescript中是否有兩個文件是相同的

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 

該腳本正確地同時獲得theFile和bibFile,但比較它們不起作用。爲什麼是這樣,我需要做什麼不同?

回答

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 
相關問題