Running multiple macros one by one

Comprehensive CAN monitor for Windows® and its add-ins: Plotter, CANdb Import, and Instruments Panel
Post Reply
k-tod
Posts: 4
Joined: Thu 16. Feb 2012, 16:00

Running multiple macros one by one

Post by k-tod » Tue 21. Feb 2012, 11: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.

M.Maidhof
Support
Support
Posts: 1751
Joined: Wed 22. Sep 2010, 14:00

Re: Running multiple macros one by one

Post by M.Maidhof » Tue 21. Feb 2012, 11: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

k-tod
Posts: 4
Joined: Thu 16. Feb 2012, 16:00

Re: Running multiple macros one by one

Post by k-tod » Tue 21. Feb 2012, 17: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

M.Maidhof
Support
Support
Posts: 1751
Joined: Wed 22. Sep 2010, 14:00

Re: Running multiple macros one by one

Post by M.Maidhof » Wed 22. Feb 2012, 10:52

Hello,

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

regards

Michael

k-tod
Posts: 4
Joined: Thu 16. Feb 2012, 16:00

Re: Running multiple macros one by one

Post by k-tod » Thu 23. Feb 2012, 09: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

M.Maidhof
Support
Support
Posts: 1751
Joined: Wed 22. Sep 2010, 14:00

Re: Running multiple macros one by one

Post by M.Maidhof » Thu 23. Feb 2012, 10: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

k-tod
Posts: 4
Joined: Thu 16. Feb 2012, 16:00

Re: Running multiple macros one by one

Post by k-tod » Thu 23. Feb 2012, 14:26

Thank you a lot,
now it's working

Edwou1971
Posts: 1
Joined: Wed 24. Aug 2016, 14:42

Re: Running multiple macros one by one

Post by Edwou1971 » Sun 28. Aug 2016, 13:03

k-tod wrote: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.
phen375 review
thanks a lot
k-tod.
as far as i know, you can only use one macros at a time. in my own conception, issues might possibly occur if you use multiple macros.
Last edited by Edwou1971 on Wed 2. Nov 2016, 23:24, edited 1 time in total.

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

Re: Running multiple macros one by one

Post by PEAK-Support » Sun 28. Aug 2016, 17:27

Only one VBS could run in one instance of a PCAN-Explorer. If you use a main loop and call the SUB in a loop, you could also create larger and more complex scripts. But it is a VBS - if you want to build complex GUI, use the available HighLevel API based on PCAN-Basic.
--------------------------------
PEAK-System Technik
Technical Support Team
support[at]peak-system.com
-------------------------------

Post Reply