2010-03-05 66 views

回答

7

我做了一些研究,發現這

tell application "System Events" 
    tell process "Preview" 
     set thefile to value of attribute "AXDocument" of window 1 
    end tell 
end tell 

-- macos comes with php installed you can decode this file name using php 
return do shell script "php -r 'echo urldecode(\"" & thefile & "\");'" 

我對macscripter

+0

這解決我的問題找到。謝謝! – Abhi 2010-04-07 19:52:28

+0

歡迎Abhi – mcgrailm 2010-04-08 01:04:35

+1

不幸的是,這給urlencoded'thefile' AppleScript沒有本地urldecode函數。 – mb21 2013-05-25 18:15:48

2

在我的10.6系統預覽版沒有Applescript詞典。這是可編寫腳本的應用程序所需要的。雖然預覽聲明它可以做Applescript,但它確實不能。

它沒有辦法將「窗口1的文檔1的路徑」翻譯成任何有意義的東西。

通常人們使用GUI腳本與Preview進行交互,或者他們找到另一種方式。