如何抑制来自Abode Bridge Extendscript的控制台窗口和系统调用?

时间:2019-03-19 14:00:23

标签: windows base64 adobe extendscript certutil

我有一个用Extendscript编写的脚本应用程序,它可以在Adobe Bridge中运行。我已经嵌入了一些图形作为base64编码的文本,并在Mac和Windows上都使用了系统功能来编写实际的图形文件。我在脚本中使用了“ app.system()”调用(在Mac上为openSSL,在Win上为certutil。)

在Mac上,我执行了无提示命令。在Windows上,将为运行的每个命令弹出一个控制台窗口。我正在寻找一种防止控制台窗口出现的方法。否则脚本将完美运行。

Microsoft的文档中提到了-silent选项,但该选项无效。它实际上破坏了脚本。控制台仍然显示,在命令中添加“> nul”不会执行任何操作。 https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/certutil

这里的搜索找不到有用的东西。

示例代码:将其另存为“ .jsx”文件,然后从Extendscript Toolkit中运行,以Bridge(CC 2018或CC 2019)为目标。它将png文件保存在与脚本相同的文件夹中。


if(BridgeTalk.appName == 'bridge'){
    try{
        var scriptf = File($.fileName); //script name
        var scriptfo = scriptf.parent; //parent folder of script
        var inFile = scriptfo.fsName + '/icon.txt';
        var outFile = scriptfo.fsName + '/icon.png';
        var icon = '''iVBORw0KGgoAAAANSUhEUgAAAAoAAAAOCAYAAAAWo42rAAAACXBIWXMAAAsTAAALEwEAmpwYAAAGxGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNS42LWMxNDUgNzkuMTYzNDk5LCAyMDE4LzA4LzEzLTE2OjQwOjIyICAgICAgICAiPiA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPiA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0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R5Po8rz0XiguvJnm+NTVxbY+NHZs9Q1GmBk0hABF6Y/q9a0Iypm7Kr13VdKwmK4978u+wRUBN4oQIh7Vgt3wKSgnARPIAXnAvb2eS9WCfamqaU0ED7OfQTCdaiMbcAE9oYPnkmo2SgI5r90LZbUH6AKygAfoug75PHg+WCaxrLOmxWKJoglYP6VkEnwf/DzksmAYqMMjnjKgip0/Jd8Hx/mGrgON1yMlXejdy1h2IwG/yG0j2wY7h6hUNhVVT97TbSy3RkYf8TwwDTCM9luvqLEl4olTTYYhtFp7zULxJJqc2NBtZ0Y1DYjCQ/FSX0eLnwF8AY6rXfuh6xyTAAAAAElFTkSuQmCC''';
        var F = new File(scriptfo + '/icon.txt');

        F.open('w');
        F.write(icon);
        F.close();

        if(Folder.fs == 'Windows'){
            var command = 'certutil -decode "' + inFile + '" "' + outFile + '"';
            }
        else{ //Mac
            var command = 'openssl base64 -d -A -in "' + inFile + '" -out "' +  outFile + '"';
            }
        app.system(command);
        File(scriptfo + '/icon.txt').remove();
        }
    catch(e){
        Window.alert(e + ' ' + e.line);
        }
    }

0 个答案:

没有答案