Unable to open exe file using Adobe Animate and XML configuration
I'm trying to open an exe file from another exe file using Adobe Animate and XML configuration. However, the code seems to be correct, but the exe file is not opening. Here's the code I'm using:
// open exe from exe
import flash.net.URLLoader;
import flash.net.URLRequest;
import flash.events.Event;
import flash.events.MouseEvent;
import flash.filesystem.File;
import flash.desktop.NativeProcess;
import flash.desktop.NativeProcessStartupInfo;
stop();
var config:XML;
var configLoader:URLLoader = new URLLoader();
configLoader.addEventListener(Event.COMPLETE, onConfigLoaded);
configLoader.load(new URLRequest("config.xml"));
function onConfigLoaded(event:Event):void {
config = XML(event.target.data);
}
btn1.addEventListener(MouseEvent.CLICK, openExe);
function openExe(event:MouseEvent):void {
trace("Button clicked");
var exeName:String = event.target.name;
// Find the corresponding executable path in the XML configuration
var exePath:String = config.exes.exe.(@name == exeName).path;
// Create a File object with the executable path
var file:File = new File(exePath);
// Prepare the NativeProcessStartupInfo with the executable file
var processInfo:NativeProcessStartupInfo = new NativeProcessStartupInfo();
processInfo.executable = file;
// Start the native process
var process:NativeProcess = new NativeProcess();
process.start(processInfo);
}
Steps to reproduce:
Ensure that the "config.xml" file contains the correct paths for the exe files. Click on the "btn1" button to trigger the openExe function. Expected behavior:
The code should open the specified exe file when the button is clicked.
Actual behavior:
The exe file does not open, and there are no error messages or indications of any issue.
Additional information:
I have verified that the paths in the "config.xml" file are correct. I'm using Adobe Animate with the latest version of the AIR SDK (50.1.1.2). I have tested the code on Windows 10 and Windows 11 x64. I have checked the security settings and file permissions for the exe files. Note:
I would appreciate any insights or suggestions on what might be causing the issue and how to resolve it. Thank you in advance for your help!