Send message in macro VBS

Comprehensive CAN monitor for Windows® and its add-ins: Plotter, CANdb Import, Instruments Panel, and J1939
Post Reply
PPC63
Posts: 2
Joined: Fri 21. Jun 2019, 11:03

Send message in macro VBS

Post by PPC63 » Thu 5. Sep 2019, 10:09

Hello,

I have a problem with VBS macro, for send data with multiplexers not have a problem like :

Code: Select all

Sub Send_TestMux()

   Dim sym

   Set sym = SymbolsManager("Ctrl").Item("TestMux")

   sym.Multiplexers("Multiplexer1").Send(1)
   
End Sub 
It's okay! But send data without multiplexers like that:

Code: Select all

Sub Send_TestNoMux()

   Dim sym

   Set sym = SymbolsManager("Ctrl").Item("TestNoMux")

   sym.Send(1)
   
End Sub 
Does not work. I can't find an example or explanation in the documentation. I suppose that some methods are used depending on the class but I don't see where to find this class...

Thank you for your help,
Paul


PS my SymbolsManager :

Code: Select all


[TestMux]
ID=000h
DLC=1
Mux=Multiplexer1 0,0 0
Var=Toto unsigned 0,8

[TestNoMux]
ID=001h
DLC=1
Var=TotoNoMux unsigned 0,1


User avatar
PEAK-Support
Sales & Support
Sales & Support
Posts: 1646
Joined: Fri 10. Sep 2010, 19:34

Re: Send message in macro VBS

Post by PEAK-Support » Fri 6. Sep 2019, 10:59

To send a CAN Frame simple set the Value of ony signal, so the CAN Engine knows what to send:

Code: Select all

Sub Send_TestNoMux()
   Dim MySignal
   Set MySignal = Signals("TotoNoMux")
   MySignal.Value = 120
End Sub
To send the complete Symbol, you need to use the DefaultMultiplexer

Code: Select all

Sub Send_TestNoMux()   
   Dim sym, mux
   Set sym = SymbolsManager("Ctrl")
   Set mux = sym("TestNoMux").DefaultMultiplexer
   mux.Send(1)
End Sub   
--------------------------------
PEAK-System Technik
Technical Support Team
support[at]peak-system.com
-------------------------------

PPC63
Posts: 2
Joined: Fri 21. Jun 2019, 11:03

Re: Send message in macro VBS

Post by PPC63 » Fri 6. Sep 2019, 14:38

Thank you for your responce !
I wanted to send a frame without data.

Paul

K.Wolf
Software Development
Software Development
Posts: 141
Joined: Wed 22. Sep 2010, 15:37

Re: Send message in macro VBS

Post by K.Wolf » Mon 9. Sep 2019, 16:21

To send a frame without data, set DLC to 0 in your symbol:

Code: Select all

[TestNoMux]
ID=001h
DLC=0
And use this (simplified) code from the previous post to send the frame:

Code: Select all

Sub Send_TestNoMux()   
   SymbolsManager("Ctrl").Item("TestNoMux").DefaultMultiplexer.Send(1)
End Sub

Post Reply