0

I build a button on adobe animate project and I want to import a (.bat) file but it's open with browser. how does it open with Cmd ????

import flash.net.URLRequest;

var batURL:URLRequest=new URLRequest("71.bat")

function btnDown(event:MouseEvent):void{

    navigateToURL(batURL,"_self");
}


button.addEventListener(MouseEvent.CLICK,btnDown)
ShellDragon
  • 1,712
  • 2
  • 12
  • 24

1 Answers1

0

In order to access the local computer, you'll have to compile your application using the Adobe AIR SDK.

Using Air, you can start a native process to execute your bat file on Windows.

var file:File = new File("C:\windows\system32\cmd.exe"); 
var processArgs:Vector.<String> = new Vector.<String>(); 
processArgs.push("/c C:\path\to\bat\71.bat");

var nativeProcessStartupInfo:NativeProcessStartupInfo = new NativeProcessStartupInfo(); 
nativeProcessStartupInfo.executable = file; 
nativeProcessStartupInfo.arguments = processArgs;

var process:NativeProcess = new NativeProcess(); 
process.start(nativeProcessStartupInfo);