2015-11-03 33 views
0

我的團隊在不同版本的Adobe Illustrator上工作,或者安裝了多個版本的軟件,所以出現了相當大的問題。如何檢查腳本正在運行的插圖畫家的版本以及基於該腳本的分支腳本?

有沒有辦法檢查運行腳本的adobe應用的版本? 尤其知道它是32位還是64位?

我需要正確定義#target和BridgeTalk.target,以便腳本在當前打開的應用程序中運行。 (腳本直接從腳本文件運行)

我似乎無法找到關於該主題的任何可靠文檔。 有沒有人有類似的問題,找到解決方案或解決方法? (更新所有的Adobe軟件單機版是毫無疑問的傷心地)

回答

2

您可以通過調用app.version

$.writeln(app.version) 

發現應用程式版本,但似乎沒有辦法找出它是否是32或64位

也許Extendscript助手對象可以給你更多的信息。例如

$.writeln($.os) 
0

@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; 
} 
+0

好吧。如果它有效。 :) – fabianmoronzirfas

1

這將檢查知道是什麼是應用程序的版本,並且如果它是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)。在這種情況下,您將不得不使用其他方式。