Air open exe

Source: Internet
Author: User
How can I open a file based on the built-in Association of the system?

This function is not supported until AIR 1.5. However, Adobe released AIR 2.0 BETA and added this function. The code is very simple. Just use the openWithDefaultApplication () function of File. However, by default, it is still impossible to use this function to open exe and other programs. What should I do? Don't worry, just add this sentence to the project configuration file: <supportedProfiles> extendedDesktop </supportedProfiles>. However, if you add this sentence, you cannot publish the project to a program with the air suffix. You must publish the project to a system application, such as a windows exe program. If you don't do it, it's okay,

 

1. Create a directory anywhere, such as the RunTest folder.

2. Go to the directory of the SDK used by your AIR project, find the runtimes folder, and copy it to the RunTest folder. (If your program does not use HTML controls or HTMLLoader, you can delete the "runtimes \ air \ win \ Adobe AIR \ Versions \ 1.0 \ Resources \ WebKit/dll" file to reduce the size of your project)

3. Create an app folder under the RunTest folder. (Random file name)

4. Enter the sdkscripts used by your airproject, find the binfolder, and copy adl.exe to the app folder created above.

5. Copy all the files under the Debug directory of your AIR project to the app folder. And change "adl.exe" to your program name (such as" .exe ").

6, return to the RunTest directory, create a new run. bat (file name arbitrary), write "app \ rice browser app \ Main-app.xml ". (Main-app.xml is your project configuration file)

7. Double-click run. bat to run your application without the AIR RunTime. However, there will be a DOS window. For details about how to remove the DOS window, see 8th.

8. Download a software named ExeScript, open the software, open the run. bat file, select silent mode, change the program icon, and finally build and save the exe file. OK, everything is done!

 

 

 

<? Xml version = "1.0" encoding = "UTF-8"?>
<Mx: Export wedapplication xmlns: mx = "http://www.adobe.com/2006/mxml" layout = "absolute" creationComplete = "CallEXE ()">
<Mx: Script>
<! [CDATA [

Import flash. display. MovieClip;

Import flash. desktop. NativeApplication;

Import flash. events. IOErrorEvent;

Import flash. events. MouseEvent;

Import flash. filesystem. File;

Import flash. desktop. NativeProcessStartupInfo;

Import flash. desktop. NativeProcess;

Private var file: File = new File ();

Private var nativeProcessStartupInfo: NativeProcessStartupInfo;

Public function CallEXE (): void

{

// Use the static property NativeApplication. nativeApplication to obtain the NativeApplication instance of the application.

// Specify whether the application should be automatically terminated after all windows are closed.

/* When autoExit is true (default), if all windows are closed, the application is terminated. Schedule exiting and exit events. If autoExit is false, you must call NativeApplication. nativeApplication. exit () to terminate the application. */

NativeApplication. nativeApplication. autoExit = true;

// Name of the called File

File = file. resolvePath ("D:/spcs_vc/HD-service.exe ");

Trace ("file:", file. nativePath );

NativeProcessStartupInfo = new NativeProcessStartupInfo ();

NativeProcessStartupInfo.exe cutable = file;


}

Private function runTest (): void

{
// File. openWithDefaultApplication (); or

Var process = new NativeProcess ();

Process. start (nativeProcessStartupInfo );

}

]>
</Mx: Script>
<Mx: Button x = "184" y = "20" label = "Button" click = "runTest ()"/>
</Mx: Using wedapplication>

 

 

 

 

I am not satisfied with this function of air.

Now that you have considered the trouble of opening the exe.

Away from adobe

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.