Borrar filtros
Borrar filtros

Launch deployed application with winopen

3 visualizaciones (últimos 30 días)
Simone
Simone el 2 de Abr. de 2024
Editada: chrisw23 el 8 de Abr. de 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 comentarios
Simone
Simone el 2 de Abr. de 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 el 6 de Abr. de 2024
Also the sytem command that works correclty from Matlab returns the same error once the application is deployed.

Iniciar sesión para comentar.

Respuestas (1)

chrisw23
chrisw23 el 2 de Abr. de 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 comentarios
Simone
Simone el 6 de Abr. de 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 el 8 de Abr. de 2024
Editada: chrisw23 el 8 de Abr. de 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.

Iniciar sesión para comentar.

Categorías

Más información sobre Environment and Settings en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by