您可以使用 Adobe 的 Alchemy 来执行批处理文件吗?
我打算制作一个 AIR 应用程序,但我需要执行一个外部应用程序,并且由于 Adobe AIR 中的安全限制...我在想为什么不尝试编写一些执行类似 System("file执行”); 然后使用 Alchemy 将其更改为 swc 并在我的应用程序中使用它...有人尝试过这种方法,或者认为它可以工作吗?
I was going to make an AIR application but I need to execute an external application and because of the security restrictions in Adobe AIR... I was thinking why not try and bypass it by writing some C code that does something like System("file to execute"); and then use Alchemy to change it into a swc and us that in my application... Anyone tried this sort, or think it could work?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
关于Alchemy,您需要了解的是,它将C编译成与actionscript相同的字节码,并且它与flash/flex as3应用程序运行在同一虚拟机(AVM2)下。
Alchemy 能够更快地执行某些操作的原因是,编译后的 C(编译为字节码)可以通过闪存 10 中添加的一些优化的 AVM2 指令来访问原始“内存”(ApplicationDomain.domainMemory)
。想要了解的是,由于 Alchemy 只是在 AVM2 之上运行,因此它与任何其他应用程序一样受到限制。 AIR 应用程序中的 Alchemy 可以比浏览器沙箱中的 Alchemy 做更多的事情,但它仍然受到该沙箱的限制。
如果您确实需要执行外部应用程序,则需要查看类似 Shu 或锌。
抱歉我无法提供更多帮助。
What you need to understand about Alchemy is that it compiles C into the same bytecode as actionscript, and it runs under the same virtual machine (AVM2) as flash/flex as3 applications.
The reason Alchemy is able to be faster for some operations is that the compiled C (compiled to bytecode) is given access to raw "memory" (ApplicationDomain.domainMemory) via some optimised AVM2 instructions that were added in flash 10.
What I'm trying to get at is that because Alchemy simply runs on top of the AVM2, it is restricted in the same way as any other application. Alchemy in an AIR application can do more than Alchemy in the browser sandbox, but it is still restricted by that sandbox.
If you really need to execute an external application, you'll need to look into something like Shu or Zinc.
Sorry I couldn't be any more help.
这是行不通的——Alchemy 并不是真的/真的不适合与外界交互的程序。 我不认为它会支持进行系统调用,即使 Alchemy 支持它,flash/air 运行时也肯定会阻止它。
如果您不需要跨平台行为,您可以考虑创建一个老式的“投影仪”。 可以使用 fscommand 从投影仪 exe 启动程序 - 请注意,您要启动的可执行文件必须位于二进制文件旁边名为 fscommand 的文件夹中。 如果这还不够,您可以尝试第三方商业工具,例如 http://www.northcode.com/。
This will not work - Alchemy is not really / really not suited for programs that interact with the outside world. I don't think it will support doing a system call, and even if Alchemy would support it the flash/air runtime will most certainly still block it.
If you don't need cross platform behavior you can look into creating an oldfashioned 'projector'. It is possible to launch programs from a projector exe using fscommand- just be aware the executable you want to launch has to be located in a folder named fscommand next to the binary. If that is not sufficient you could try a third party commercial tool like http://www.northcode.com/.
不,Richard Szalay 是正确的:Alchemy 将 C 代码编译为 ActionScript 字节码,因此生成的 SWF 仍然受到与其他 SWF 相同的沙箱限制; AIR 限制可能更宽松,但使用 Alchemy 在这方面没有任何好处。
但是,您仍然可以使用套接字连接“调用”沙箱,前提是您有一个正在侦听该连接的应用程序; 查看 Merapi ——如果您愿意使用 Java,它可能会作为一个简单的解决方案提供帮助,尽管您当然可以使用其他东西来实现自己的功能,例如 C#。
No, Richard Szalay's correct: Alchemy compiles C code into ActionScript bytecode, so the resulting SWF is still subject to the same sandbox restrictions as any other; the AIR restrictions may be looser, but using Alchemy provides no benefit in that respect.
However, you can still "call out" of the sandbox using a socket connection, provided you have an app listening for the connection; check out Merapi -- it might be able to help as a simple solution, if you were open to using Java, although you could certainly roll your own with something else, like C#.