【问题标题】:How to check for version of illustrator that script is running on, and branch script based off that?如何检查正在运行脚本的 illustrator 版本,以及基于此的分支脚本?
【发布时间】:2015-11-04 12:57:28
【问题描述】:

我的团队使用不同版本的 Adob​​e Illustrator 或安装了多个版本的软件,因此我遇到了很大的问题。

有没有办法检查运行脚本的 adobe 应用程序的版本? 尤其是知道它是 32 位还是 64 位?

我需要正确定义#target 和 BridgeTalk.target,以便脚本在当前打开的应用程序中运行。 (脚本直接从脚本文件运行)

我似乎找不到任何关于该主题的可靠文档。 有没有人有类似的问题并找到解决方案或解决方法? (遗憾的是,将所有 adobe 软件更新为单一版本是不可能的)

【问题讨论】:

    标签: javascript adobe-illustrator extendscript


    【解决方案1】:

    您可以拨打app.version查看应用版本

    $.writeln(app.version)  
    

    但是好像没办法查出是32位还是64位

    也许 Extendscript 帮助器对象可以为您提供更多信息。例如

    $.writeln($.os)
    

    【讨论】:

      【解决方案2】:

      这将检查应用程序的版本,以及它是 32 位还是 64 位(不是操作系统):

      $.writeln(app.version); //writes the app version
      $.writeln((app.path.fsName.indexOf('Program Files (x86)') > -1)?'32 bit':'64 bit'); //writes the bit version of the app
      

      此代码适用于您要检查的任何应用。

      我能想到的唯一问题是应用程序是否安装在其他地方,然后是 Program FilesProgram Files (x86)。在这种情况下,您将不得不使用其他方式。

      【讨论】:

        【解决方案3】:

        @fabiantheblind

        使用您的提示,我设计了一段似乎可以解决问题的代码(但它缺乏优雅:P)

        switch(app.version.split(".")[0])
        {
          case "16":
            //32 bit versions run in emulated enviorment, so the $.os returns string
            //containing 'emulation' substring. Not entierly sure it is reliable :P 
            var string = String($.os);
            if(string.indexOf("emulation") > -1) 
            {   
                $.writeln("32 bit code here");
            }
            else
            {
                $.writeln("64 bit code here");
            }
            break;
        
            default:
                break;
        }
        

        【讨论】:

          猜你喜欢
          • 2011-03-02
          • 2015-06-13
          • 2020-12-17
          • 1970-01-01
          • 2013-01-02
          • 1970-01-01
          相关资源
          最近更新 更多