开发者

Indesign Scripting: If selected object is rectangle

I'm trying to rewrite the CornerEffects.jsx script in Indesign CS5.5 to make it more user friendly in school, so people know exactly where the first point is and where the last point is etc. The Script has to work in CS3 as well. I need to the options to change only when a rectangle is the selected object and otherwise fallback to the default. I've tried to the following snippet but it just falls back to the default anyway. Thanks, guys.

function myDisplayDialog(myObjectList){
        if (app.selection.constructor.name == "Rectangle"){                 
        var myStringList = ["all points","first point (top-left)", "last point(top-right)", "second point(bottom-left)", "third point(bottom-right)", "fourth point(top-right)", "first two", "second and third", "last two", "first and last", "odd points", "even points"]
        }
         else{  
             var myStringList = ["all points","first point", "last point", "s开发者_如何学Pythonecond point", "third point", "fourth point", "first two", "second and third", "last two", "first and last", "odd points", "even points"]
        }


Just looking at it, you would typically use 'selection[0].constructor' rather than 'selection.constructor' but it's hard to say if it will work with this fix. You should be able to step through the code in ExtendScript Toolkit to see where it goes wrong. It might be helpful to break it up into steps to be able to see the values easier.

Just out of curiosity, what school is teaching InDesign scripting?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜