2010-03-05 61 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进行交互,或者他们找到另一种方式。