更新:我已经测试以下代码在CS5和Mac OS 10.7中可以确认,即使通过tell application "Adobe Photoshop CS4"
到tell application "Adobe Photoshop CS5"
的简单切换,此功能也可以正常工作。你得到的误差是存在或者不存在首先打开文档,因为你的目标文档1.您可以轻松地用下面的检查这个结果:
tell application "Adobe Photoshop CS5"
set documentCount to count documents
if documentCount > 0 then
set theDocument to document 1
set theFilePath to file path of theDocument
return theFilePath
else
-- no documents open. what to do?
end if
end tell
OLD答案:我没有CS5(但是),但是这里是CS4,我想CS5的版本不会太差,因为Adobe自CS3以来做了很好的规范化API:
tell application "Adobe Photoshop CS4"
set theDocument to document 1
set theFilePath to file path of theDocument
return theFilePath
end tell
--> Result: Macintosh HD:path:to:file:filename.ext
我在使用Adobe CS5和Lion时遇到了一些麻烦。这是它被记录的方式,但它不起作用。如果这是在Lion上为CS5的其他人工作,请让我知道是否有任何设置需要在Photoshop或系统中检查。 – cwd
其实我有文档打开,所以这不是问题,但我想在Photoshop CS5中只有一个记录在Applescript中的错误 - http://forums.adobe.com/thread/632681 – cwd
您是否真的需要临时变量,或者你能不能'返回文件1'的文件路径? – tomlogic