启动EXE(Serproxy)与Adobe AIR [英] Launch EXE (Serproxy) with Adobe AIR

查看:573
本文介绍了启动EXE(Serproxy)与Adobe AIR的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发在Flash Builder(Flex的)AIR应用程序,我需要在计算机上的串行端口进行通信的选项。所以我使用 Serproxy 帮我这一点。

I'm developing an AIR application in Flash Builder (Flex) and I needed the option to communicate with a serial port on the computer. So I'm using Serproxy to help me with that.

我希望能够在我的应用程序运行时启动serproxy.exe。我试过两种方法,和他们都不是为我工作。

I want to be able to launch serproxy.exe when my application runs. I've tried two methods, and neither of them are working for me.

我已经设置supportedProfiles与extendedDesktop。

I have set supportedProfiles with extendedDesktop.

第一种方法:

var file:File = File.applicationDirectory.resolvePath("assets/serproxy.exe");
file.openWithDefaultApplication();

这继续打开程序,但随后立即关闭它。不会引发任何错误。

This proceeds to open the program, but then immediately closes it. No errors are thrown.

第二种方法:

var file:File = File.applicationDirectory.resolvePath("assets/serproxy.exe");

var nativeProcessStartupInfo:NativeProcessStartupInfo = new NativeProcessStartupInfo();
nativeProcessStartupInfo.executable = file;
var process:NativeProcess = new NativeProcess();

process.start(nativeProcessStartupInfo);

尽管通过研​​究这种方法已经找到工作,它根本就没有我的。不会引发任何错误,并没有程序启动。

Although through research this method has been found to work, it simply does nothing for me. No errors are thrown, and no program is launched.

如果任何人有任何想法,请让我知道!谢谢

If anyone has any ideas please let me know! Thanks

推荐答案

我已经解决了。我的问题是,由于Serproxy打开,CMD.EXE,有一些问题,保持文件打开,因为Windows喜欢将自动关闭。我得到了解决此通过创建该文件的快捷方式,和pre-未决的目标与

I've solved it. My issue was that since Serproxy opens with cmd.exe, there were some issues keeping the file open, as Windows likes to automatically close it. I got around this by creating a shortcut to the file, and pre-pending its target with

C:\Windows\System32\cmd.exe /K "C:\...assets\serproxy.exe"

然后我可以运行使用快捷

Then I could run the shortcut with

var file:File = File.applicationDirectory.resolvePath("assets/serproxy.lnk");
file.openWithDefaultApplication();

和窗口呆开放!

这篇关于启动EXE(Serproxy)与Adobe AIR的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆