Page 1 of 1
Running multiple macros one by one
Posted: Tue 21. Feb 2012, 11:21
by k-tod
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.
Re: Running multiple macros one by one
Posted: Tue 21. Feb 2012, 11:28
by M.Maidhof
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
Re: Running multiple macros one by one
Posted: Tue 21. Feb 2012, 17:13
by k-tod
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
Re: Running multiple macros one by one
Posted: Wed 22. Feb 2012, 10:52
by M.Maidhof
Hello,
the simplest solution will be to put all together in just one macro
regards
Michael
Re: Running multiple macros one by one
Posted: Thu 23. Feb 2012, 09:28
by k-tod
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
Re: Running multiple macros one by one
Posted: Thu 23. Feb 2012, 10:56
by M.Maidhof
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
Re: Running multiple macros one by one
Posted: Thu 23. Feb 2012, 14:26
by k-tod
Thank you a lot,
now it's working
Re: Running multiple macros one by one
Posted: Sun 28. Aug 2016, 13:03
by Edwou1971
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.
Re: Running multiple macros one by one
Posted: Sun 28. Aug 2016, 17:27
by PEAK-Support
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.