Skip to end of banner
Go to start of banner

How to run external executable within BVMS SDK scriplet?

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Version History

« Previous Version 2 Next »

Article status

EXTERNAL 

Link to be provided outside of Bosch

Question

How to run external executable within BVMS SDK scriplet?

Answer

For more details about how to execute scriplets in the BVMS SDK, please check:


Call .bat files scriplet:


 

Example for BVMS scriplet    


    [Scriptlet("dbb99725-39ee-4bcf-972c-2f270aea727d")]
    public void runExternalBatFile(EventData e)
    {


        string fullBatPath = @"C:\temp\HelloWorld.bat";

        var process = new Process()
        {
            StartInfo = new ProcessStartInfo
            {
                FileName = "cmd.exe",
                Arguments = "/C C:\\temp\\HelloWorld.bat",

                UseShellExecute = false,
                CreateNoWindow = false,
            }
        };
        process.Start();
    }

   

Example for a method to be used in BVMS SDK based C# application
   

public void runExternalBatFile()
    {

//this is an example path to the test bat file called HelloWorld.bat
        string fullBatPath = @"C:\scripts\cameras_OFF.bat";

        var process = new Process()
        {
            StartInfo = new ProcessStartInfo
            {
                FileName = "cmd.exe",

//$ is a short-hand for String.Format, that is part of

//C# 6
                Arguments = $"/C \"{fullBatPath}\"",
                UseShellExecute = false,
                CreateNoWindow = false,
            }
        };
        process.Start();
    }
}




ADVANCED section

Please contact CTS / SG or GK team to view this section from draft space, if necessary


Information below is for CTS, SG, GK reference and must be kept internal only.

If you are part of CTS, SG or GK team, please hide this section when you have finished using this article!


This section will not be published externally and / or automatically downloaded in the PDF file!



  • No labels