Running multiple macros one by one

Comprehensive CAN Monitor for Windows® and the Add-ins: Plotter, CANdb Import, and Instruments Panel

Running multiple macros one by one

Postby k-tod » Tue 21. Feb 2012, 12:21

Hi,
Is it possible in any way to start with a button a run of multiple macros one by one with a delay in VBscript?
I have a panel which is running macros using buttons(with ExecuteCommand),I run 3 separate macros , one standard macro and two VB macros, I was wondering if I can run all of them with the same button.

thanks a lot
k-tod.
k-tod
 
Posts: 4
Joined: Thu 16. Feb 2012, 17:00

Re: Running multiple macros one by one

Postby M.Maidhof » Tue 21. Feb 2012, 12:28

Hello,

in PCAN-Explorer you can only run one macro at a time. It will not be possible to start several macros with the same button, or start another macro from inside a macro.

best regards

Michael
User avatar
M.Maidhof
Support
Support
 
Posts: 200
Joined: Wed 22. Sep 2010, 14:00
Location: Darmstadt, Germany

Re: Running multiple macros one by one

Postby k-tod » Tue 21. Feb 2012, 18:13

Hello,thank you for your quick reply

In this case is it possible to do this with a script? I just need to send 2 periodic mesages(order doesn't matter and 6 other messages in a specified order), at the moment i use 3 buttons to execute 2 vb macros for the periodic messages and 1 standard macro for the other 6, and I need to execute them with a single button, could you please help?
thank's
k-tod
 
Posts: 4
Joined: Thu 16. Feb 2012, 17:00

Re: Running multiple macros one by one

Postby M.Maidhof » Wed 22. Feb 2012, 11:52

Hello,

the simplest solution will be to put all together in just one macro

regards

Michael
User avatar
M.Maidhof
Support
Support
 
Posts: 200
Joined: Wed 22. Sep 2010, 14:00
Location: Darmstadt, Germany

Re: Running multiple macros one by one

Postby k-tod » Thu 23. Feb 2012, 10:28

Hi, I succeded to put toghether the 2 VB macros but don't know how to transmit a non periodic message with VB macro,could you please help me to send msg2 as non periodic, I am really a beginner and maybe it's easy but I could not find how to do it so far.

thank you,
k-tod.

Code: Select all
Sub My_sub_01()

  Dim msg

  Set msg = TransmitMessages.Add

     msg.ID = &H100
   msg.DLC = 3
   msg.MsgType = pcanMsgTypeStandard
   msg.Data(0) = &H20
   msg.Data(1) = &H3A
   msg.Data(2) = &H00

  msg.SendPeriod = 4000
  msg.IsPaused = False

Wait 5000

Dim msg1

  Set msg1 = TransmitMessages.Add

     msg1.ID = &H100
   msg1.DLC = 3
   msg1.MsgType = pcanMsgTypeStandard
   msg1.Data(0) = &H3A
   msg1.Data(1) = &H03
   msg1.Data(2) = &H7F

  msg1.SendPeriod = 100

  msg1.IsPaused = False

Wait 500

Dim msg2

  Set msg2 = TransmitMessages.Add

     msg2.ID = &H100
   msg2.DLC = 3
   msg2.MsgType = pcanMsgTypeStandard
   msg2.Data(0) = &H20
   msg2.Data(1) = &H00
   msg2.Data(2) = &H03
 
  msg2.SendPeriod = 1000

  msg2.IsPaused = False
 
  Wait 500
   
End Sub
k-tod
 
Posts: 4
Joined: Thu 16. Feb 2012, 17:00

Re: Running multiple macros one by one

Postby M.Maidhof » Thu 23. Feb 2012, 11:56

Hi,

here an example on how to transmit non periodic messages:

Dim msg3

Set msg3 = TransmitMessages.Add

msg3.ID = &H300
msg3.DLC = 3
msg3.MsgType = pcanMsgTypeStandard
msg3.Data(0) = &H11
msg3.Data(1) = &H22
msg3.Data(2) = &H33
msg3.Write 0

msg3.ID = &H400
msg3.DLC = 2
msg3.Data(0) = &H44
msg3.Data(1) = &H55
msg3.Write 0
User avatar
M.Maidhof
Support
Support
 
Posts: 200
Joined: Wed 22. Sep 2010, 14:00
Location: Darmstadt, Germany

Re: Running multiple macros one by one

Postby k-tod » Thu 23. Feb 2012, 15:26

Thank you a lot,
now it's working
k-tod
 
Posts: 4
Joined: Thu 16. Feb 2012, 17:00


Return to PCAN-Explorer 4 & Add-ins



cron