Effacer les filtres
Effacer les filtres

Launch deployed application with winopen

5 vues (au cours des 30 derniers jours)
Simone
Simone le 2 Avr 2024
Modifié(e) : chrisw23 le 8 Avr 2024
Hi, I'm trying to launch an executable (application compiled with AppDesigner) from another deployed application (application compiled with AppDesigner) using the winopen function.
I get the error: Error in validating CTF manifest file.
Is there a solution?
  3 commentaires
Simone
Simone le 2 Avr 2024
It is an error that prevents the start of the second application.
I'll try to use the system command.
The problem relies on the deployed application since If I try to use winopen to launch the second application (executable) by using the first one from matlab everithing works fine.
Simone
Simone le 6 Avr 2024
Also the sytem command that works correclty from Matlab returns the same error once the application is deployed.

Connectez-vous pour commenter.

Réponses (1)

chrisw23
chrisw23 le 2 Avr 2024
...
function callConsoleApplicationAsync(obj,appWorkingPath,appFileNameWithArguments)
arguments
obj
appWorkingPath
appFileNameWithArguments
end
import System.IO.*
asyncSysProc = System.Diagnostics.Process();
asyncSysProc.EnableRaisingEvents = true;
try
liEmptyProc = addlistener(asyncSysProc,'Exited',@obj.consoleProcessFinished_Callback);
catch ex
disp("Error@callConsoleApplicationAsync save listener handle " + string(ex.message))
end
try
asyncSysProc.StartInfo.CreateNoWindow = true; % true = no cmd windows pops up
asyncSysProc.StartInfo.UseShellExecute = false; % false to enable redirection
asyncSysProc.StartInfo.WorkingDirectory = appWorkingPath;
asyncSysProc.StartInfo.FileName = "cmd.exe"; % use cmd.exe to call any app
asyncSysProc.StartInfo.Arguments = "/c " + appFileNameWithArguments; % add arguments here
asyncSysProc.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
asyncSysProc.Start();
notify(obj,"ConsoleProcessStartedAsync", WinNetIO.NotifyDiagArgs(string(asyncSysProc.StartInfo.Arguments)))
obj.liAsyncCmd.("P" + string(asyncSysProc.Id)) = liEmptyProc; % id available after start
catch ex
disp(ex.message)
end
end
...
Just copied a function from one of my classes to show how to call any executable asynchronous. This will not block your calling app. If you don't want to use events skip lines for listeners and notification. Be aware of missing class frame for this code snippet.
  3 commentaires
Simone
Simone le 6 Avr 2024
At the end I was able to run the function from Matlab cutting several parts of code as reported below.
Anyway once I make the executable there is always the error: Error in validating CTF manifest file.
I just want to underline that the applications I'm trying to run from the deplyoed application are other executable compiled with application designer or guide.
function callConsoleApplicationAsync(~,appWorkingPath,appFileNameWithArguments)
import System.IO.*
asyncSysProc = System.Diagnostics.Process();
asyncSysProc.EnableRaisingEvents = true;
try
asyncSysProc.StartInfo.CreateNoWindow = true; % true = no cmd windows pops up
asyncSysProc.StartInfo.UseShellExecute = false; % false to enable redirection
asyncSysProc.StartInfo.WorkingDirectory = appWorkingPath;
asyncSysProc.StartInfo.FileName = "cmd.exe"; % use cmd.exe to call any app
asyncSysProc.StartInfo.Arguments = "/c " + appFileNameWithArguments; % add arguments here
asyncSysProc.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
asyncSysProc.Start();
catch ex
disp(ex.message)
end
end
chrisw23
chrisw23 le 8 Avr 2024
Modifié(e) : chrisw23 le 8 Avr 2024
Sry for the late response. Its rigth the code snippet should be used to create a simple function as you did. This is a fire and forget call and you can call anything from the console. You could call explorer.exe instead of the Matlab executable to debug this part of your code. As you have two AppDesigner apps both are to be compiled and app1.exe needs the path to app2.exe . In the AdditionalSettings section of the AppCompiler you should enable the console output to write debug info via disp cmd for better understanding what happens when.
Check also that the Matlab Runtime version installed matches the compiler version. Another option ist to start the appdesigner app as Administrator to check if this is an priviliges error.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Environment and Settings dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by