The scenario
We are trying to create a boot application of the current primary project using code only.
A plugin which we have created is communicating with another program which sends data to Codesys using tcp.
One of those data objects(commands) are meant to create a boot application of the current project. The boot application files will be retrieved by the parent program when the codesys operation is complete using the path specified and store it binary in a database for later usage.
We have so far tried to create a boot application by using one of the standard commmands in the type list. ICommandManager2 cmdMgr.ExecuteCommand(GUID_CREATEBOOTAPPLICATIONCOMMAND, batchArguments)
The batchArguments are currently empty because the specific command wont take arguments.
Problem arrives when there always is a popup where userinteraction is needed to specify the path to store the files.
We somehow want to automate this so the user can control where the path should be from the parent program.
Is there some other way to create a boot application once you have a primary project and specify a path at the same time?
We donΒ΄t need to be online because this function is only meant to store the .app and the other generated files in a external database for later usage.
We canΒ΄t seem to find conclusive information on this. Maybe you have to go through the ILanguageModel?
Maybe there are examples somewhere that we have missed?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The scenario
We are trying to create a boot application of the current primary project using code only.
A plugin which we have created is communicating with another program which sends data to Codesys using tcp.
One of those data objects(commands) are meant to create a boot application of the current project. The boot application files will be retrieved by the parent program when the codesys operation is complete using the path specified and store it binary in a database for later usage.
We have so far tried to create a boot application by using one of the standard commmands in the type list.
ICommandManager2 cmdMgr.ExecuteCommand(GUID_CREATEBOOTAPPLICATIONCOMMAND, batchArguments)
The batchArguments are currently empty because the specific command wont take arguments.
Problem arrives when there always is a popup where userinteraction is needed to specify the path to store the files.
We somehow want to automate this so the user can control where the path should be from the parent program.
Is there some other way to create a boot application once you have a primary project and specify a path at the same time?
We donΒ΄t need to be online because this function is only meant to store the .app and the other generated files in a external database for later usage.
We canΒ΄t seem to find conclusive information on this. Maybe you have to go through the ILanguageModel?
Maybe there are examples somewhere that we have missed?
Have you tried to use a python script? You usecase seems to be possible with V3.5 SP5
Have look at this:
l viewtopic.php?f=18&t=5010&hilit=boot l
Hi again and thanks for the tip
The solution to this particular problem is the current code.
IMetaObjectStub application = ProjectHelper.GetMetaObjectByName(existingProject.Handle, "Application"); //internal helper method
var filePath = Path.Combine(Path.GetDirectoryName(existingProject.Path), application.Name + ".app");
SystemInstances.LanguageModelMgr.GenerateCode(application.ObjectGuid, false, false);
IOnlineApplication onlineappl = SystemInstances.OnlineMgr.GetApplication(application.ObjectGuid);
using (FileStream stream = new FileStream(filePath, FileMode.Create))
{
using (BinaryWriter writer = new BinaryWriter(stream))
{
onlineappl.StreamDownloadCommand(writer);
}
}