Highlighted

Restarting an AIR desktop application

Explorer ,
Jul 05, 2018

Copy link to clipboard

Copied

Hello,

I need a DESKTOP AIR application (captive runtime bundle) to be able to restart itself after an update process.

The method involving productManager.launch doesn't work because <allowBrowserInvocation></allowBrowserInvocation> cannot be set to true for an application packaged with the captive runtime option :

Does anyone has a solution to this problem ?

Thanks.

Vincent.

Hello el111,

Thank you.

Found a solution that works on both mac and win based on native script too.

public  function restartApplication():void
{
   var applicationDescriptor:XML = NativeApplication.nativeApplication.applicationDescriptor;
   var xmlns:Namespace = new Namespace(applicationDescriptor.namespace());
   var applicationName:String = applicationDescriptor.xmlns::filename;
   var nativeProcessStartupInfo:NativeProcessStartupInfo = new NativeProcessStartupInfo();
   var nativeProcess:NativeProcess = new NativeProcess();
   var applicationExecutable:File;

   if (Capabilities.os.indexOf("Win") > -1)
   {
        applicationExecutable = new File(File.applicationDirectory.nativePath + "/" + applicationName + ".exe");

   }else{
 
        applicationExecutable = new File(File.applicationDirectory.nativePath.replace("Resources", "MacOS/" + applicationName));
   }

   nativeProcessStartupInfo.executable = applicationExecutable;
   nativeProcess.start(nativeProcessStartupInfo);
   NativeApplication.nativeApplication.exit();
}

TOPICS
Development

Views

835

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Restarting an AIR desktop application

Explorer ,
Jul 05, 2018

Copy link to clipboard

Copied

Hello,

I need a DESKTOP AIR application (captive runtime bundle) to be able to restart itself after an update process.

The method involving productManager.launch doesn't work because <allowBrowserInvocation></allowBrowserInvocation> cannot be set to true for an application packaged with the captive runtime option :

Does anyone has a solution to this problem ?

Thanks.

Vincent.

Hello el111,

Thank you.

Found a solution that works on both mac and win based on native script too.

public  function restartApplication():void
{
   var applicationDescriptor:XML = NativeApplication.nativeApplication.applicationDescriptor;
   var xmlns:Namespace = new Namespace(applicationDescriptor.namespace());
   var applicationName:String = applicationDescriptor.xmlns::filename;
   var nativeProcessStartupInfo:NativeProcessStartupInfo = new NativeProcessStartupInfo();
   var nativeProcess:NativeProcess = new NativeProcess();
   var applicationExecutable:File;

   if (Capabilities.os.indexOf("Win") > -1)
   {
        applicationExecutable = new File(File.applicationDirectory.nativePath + "/" + applicationName + ".exe");

   }else{
 
        applicationExecutable = new File(File.applicationDirectory.nativePath.replace("Resources", "MacOS/" + applicationName));
   }

   nativeProcessStartupInfo.executable = applicationExecutable;
   nativeProcess.start(nativeProcessStartupInfo);
   NativeApplication.nativeApplication.exit();
}

TOPICS
Development

Views

836

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Jul 05, 2018 0
Engaged ,
Jul 08, 2018

Copy link to clipboard

Copied

You can try running a bat script using NativeProcess

https://forum.starling-framework.org/topic/restart-standalone-application-on-desktop-windows

or you can use this ANE

which has a method called restartApp()

GitHub - tuarua/WindowsHelperANE: a set of methods for Adobe AIR for Windows

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jul 08, 2018 0
Explorer ,
Jul 08, 2018

Copy link to clipboard

Copied

Hello el111,

Thank you.

Found a solution that works on both mac and win based on native script too.

public  function restartApplication():void
{
   var applicationDescriptor:XML = NativeApplication.nativeApplication.applicationDescriptor;
   var xmlns:Namespace = new Namespace(applicationDescriptor.namespace());
   var applicationName:String = applicationDescriptor.xmlns::filename;
   var nativeProcessStartupInfo:NativeProcessStartupInfo = new NativeProcessStartupInfo();
   var nativeProcess:NativeProcess = new NativeProcess();
   var applicationExecutable:File;

   if (Capabilities.os.indexOf("Win") > -1)
   {
        applicationExecutable = new File(File.applicationDirectory.nativePath + "/" + applicationName + ".exe");

   }else{
 
        applicationExecutable = new File(File.applicationDirectory.nativePath.replace("Resources", "MacOS/" + applicationName));
   }

   nativeProcessStartupInfo.executable = applicationExecutable;
   nativeProcess.start(nativeProcessStartupInfo);
   NativeApplication.nativeApplication.exit();
}

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jul 08, 2018 0