Start and run CANoe from Command Prompt

11,157

Solution 1

CANOE simply loads a .cfg configuration file. For Jenkins, I am using the Visual Basic script and using this loading particular configuration file.

In this was it bypasses the "I accept" and other windows and loads the desired configuration also also using same kind of VB script you can close the application.

'ToStart CANoe_Start.vbs

Set App = CreateObject("CANoe.Application")   
dim fso: set fso = CreateObject("Scripting.FileSystemObject")   
dim CANoe_config    
CANoe_config = fso.BuildPath(fso.GetAbsolutePathName("."), "<target.cfg>")

App.Measurement.Start()

After that you can add the operations in Jenkins jobs; to close the same appilcation use:

'ToStop CANoe_Stop.vbs
Set App = CreateObject("CANoe.Application")
App.Quit()

This worked for me. You can call the vbs's over command prompt.

Solution 2

Yes, it is possible to run Vector CANoe from an external script. The following VBS script code shows the various possibilities to start CANoe and to react on events within CANoe

' Creates and returns a reference to CANoe Application.    
Set App = CreateObject("CANoe.Application")
Set Measurement = App.Measurement
Set Logging     = App.Configuration.OnlineSetup.LoggingCollection(1)
Dim TestFunction, IsRunning
Wscript.ConnectObject Measurement, "Measurement_"

For Count = 1 To 5
    Logging.FullName = "C:\CANWIN" & Count & ".ASC"
    StartMeasurement()
    MsgBox "Press [Ok] to start the next 
    Measurement...", vbSystemModal
    Measurement.Stop
Next
MsgBox "Logging script done..."

While IsRunning
  On Error Resume Next
  TestFunction.Call(CDbl(Second(Time)))
  Wscript.Sleep 1000
Wend
  Wscript.DisconnectObject Measurement

Set Measurement = Nothing
Set App = Nothing

Sub Measurement_OnInit()
  Set TestFunction = 
  App.CAPL.GetFunction("TestFunction")
End Sub

Sub Measurement_OnStart()
  IsRunning = True
End Sub

Sub Measurement_OnStop()
  IsRunning = False
End Sub

Sub StartMeasurement()
  IsRunning = False
  Measurement.Start
  Count = 0
  While Not IsRunning
    Wscript.Sleep 100
    Count = Count + 1
    If Count = 10 Then
      MsgBox "Failed to start measurement!"
      Wscript.Quit
    End If
  Wend
End Sub

Solution 3

This document tells you how to control CANoe from C++, C# etc. This by making use of the CANoe as a COM Server utilities. http://www.vector.com/portal/medien/cmc/application_notes/AN-AND-1-117_CANoe_CANalyzer_as_a_COM_Server.pdf

Share:
11,157
Gustaf Gulliksson
Author by

Gustaf Gulliksson

Updated on July 07, 2022

Comments

  • Gustaf Gulliksson
    Gustaf Gulliksson over 1 year

    Is it possible to start and run Vector CANoe from the Command Prompt and/or by using any other external script?

  • PlamZ
    PlamZ almost 9 years
    I should add that FDX is also a good choice. You can make an Ethernet application that remotely controls some parts of the configuration.