Indesign 脚本:如果所选对象是矩形

发布于 2024-12-06 09:25:40 字数 838 浏览 1 评论 0原文

我正在尝试在 Indesign CS5.5 中重写 CornerEffects.jsx 脚本,使其在学校中更加用户友好,以便人们确切地知道第一个点在哪里以及最后一个点在哪里等。该脚本必须在 CS3 中工作出色地。 我需要仅当矩形是选定对象时才更改选项,否则回退到默认值。我尝试过以下代码片段,但无论如何它都会回落到默认值。谢谢,伙计们。

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", "second point", "third point", "fourth point", "first two", "second and third", "last two", "first and last", "odd points", "even points"]
        }

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", "second point", "third point", "fourth point", "first two", "second and third", "last two", "first and last", "odd points", "even points"]
        }

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

黯淡〆 2024-12-13 09:25:40

只要看看它,您通常会使用“selection[0].constructor”而不是“selection.constructor”,但很难说它是否适用于此修复。您应该能够单步调试 ExtendScript Toolkit 中的代码以查看哪里出了问题。将其分解为步骤可能会有所帮助,以便能够更轻松地查看值。

出于好奇,哪所学校正在教授 InDesign 脚本?

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?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文