简体   繁体   English

Javascript,如何在Mirth中运行.exe文件? 如何在Mirth中调用ActiveXObject?

[英]Javascript , how can I run .exe file in Mirth? How can I invoke ActiveXObject in Mirth?

In mirth , in a JavaScript Writer Destination I am trying to run a .exe file with arguments \\ as the following: 令人高兴的是,在JavaScript编写器目标中,我试图使用参数\\来运行.exe文件,如下所示:

oShell.ShellExecute(commandtoRun,file_path,"","open","1");

and I get an error at this line: 我在这一行得到一个错误:

var oShell = new ActiveXObject("Shell.Application");

the error is: 错误是:

 ReferenceError: "ActiveXObject" is not defined. 

I searched and learnt that my piece of code can only run on internet explorer , and actually I am writing this script to run in a middle-ware which is Mirth Connect 我搜索并了解到我的代码只能在Internet Explorer上运行,实际上我正在编写此脚本以在名为Mirth Connect的中间件中运行

Can anyone help me using one of these options: - a way to run .exe fle with arguments in Mirth? 任何人都可以使用以下选项之一帮助我:-一种在Mirth中使用参数运行.exe文件的方法吗? - an alternative for ActiveXObject in Javascript? -用Javascript替代ActiveXObject - a way to invoke ActiveXObject in Mirth? -在Mirth中调用ActiveXObject的方法?

Best Regards, 最好的祝福,

Unless you have ActiveXObject Java object in your classpath this will not work. 除非您的类路径中有ActiveXObject Java对象,否则它将无法正常工作。 What you may use instead: 您可以改用的是:

var runtime = new Packages.java.lang.Runtime.getRuntime();
runtime.exec(["notepad", "C:\\Temp\\test.txt"]);

or 要么

var processBuilder = new Packages.java.lang.ProcessBuilder("notepad", "C:\\Temp\\test.txt");
var process = processBuilder.start();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM