2011-02-16 73 views
0

我能够替换当前文档的每一层的名称,但是当我通过它时,“名称以”结尾“,它失败&异常不会给出任何宝贵的意见。删除“copy#” - 使用applescript在photoshop中的图层文字

tell application "Adobe Photoshop CS3" 
tell current document 
    set name of every layer where name ends with "copy*" to "replace_using_sed" 
end tell 

末告诉

你能找出错误或者你知道这个的另一种方式?

回答

0

copy*导致错误。 AppleScript中不能使用*作为通配符。相反,使用... where name contains "copy" ...

这是你的脚本(与Photoshop CS5测试)的我工作的版本:

tell application "Adobe Photoshop CS3" 
    set layerList to name of every layer in current document where name contains "copy" 
end tell 

repeat with currentName in layerList 
    set layerName to text 1 thru ((offset of "copy" in currentName) - 1) of currentName 
    tell application "Adobe Photoshop CS3" 
     set (the name of first layer in current document where name contains "copy") to layerName 
    end tell 
end repeat 
+0

不幸的是这不CS3工作。这个例外仍然非常模糊,所以在这里没有帮助。但是,如果你的片段在CS5上工作,你可能已经帮助了很多人。真的很讨厌这个! – hkjels 2011-02-17 09:58:23

0

不知道这是否会修复整个脚本,但它被称为“谁的”过滤器......所以用“who”替换“where”这个词。我不是说谁的过滤器适用于Photoshop,但可以尝试。如果它不起作用,那么你必须得到所有图层,用重复循环遍历它们,并逐个过滤每个名称。

相关问题