Hi,
Currently i'm working on a vb script on PCAN-Explorer, this latter aims to exchange messages(requests and responses) with different components that are connected to my pcan-Explorer, so i have spent countless hours trying to figure out how to write or implement event handler methods that can be invoked each time i receive a message which i didn't achieve yet,i would really appreciate your help.
Events management
Re: Events management
Hi,
i have an other question actually i'm trying to send and receive messages using VB scripts and i'm not sure if it's possible using VB scripts or Add-ins, i would really appreciate any help.
i have an other question actually i'm trying to send and receive messages using VB scripts and i'm not sure if it's possible using VB scripts or Add-ins, i would really appreciate any help.
Re: Events management
If you say 'VB script', do you mean a standalone VB script (file extension .vbs) or a VBS macro in PCAN-Explorer?
Please have a look at the sample macros titled 'NewClientSend' and 'WaitForID100' (accessible via the Macro drop-down list in the main PCAN-Explorer window). They demonstrate how to create a new virtual CAN node (a PCAN client), and how to read and write CAN messages. Regardless whether you're working with standalone VB scripts or with VBS macros within PCAN-Explorer, the principle is the same.
There is no event that notifies you that a message was received. Received messages are stored in the receive queue of the PCAN client, and it is your task to read and process the messages. See the RcvMsg.Read call in the WaitForID100 macro.
Please have a look at the sample macros titled 'NewClientSend' and 'WaitForID100' (accessible via the Macro drop-down list in the main PCAN-Explorer window). They demonstrate how to create a new virtual CAN node (a PCAN client), and how to read and write CAN messages. Regardless whether you're working with standalone VB scripts or with VBS macros within PCAN-Explorer, the principle is the same.
There is no event that notifies you that a message was received. Received messages are stored in the receive queue of the PCAN client, and it is your task to read and process the messages. See the RcvMsg.Read call in the WaitForID100 macro.
Re: Events management
Thank you Mr. Wolf for your quick answer, when i said VBScripts i meant VBS macros actually, sorry for the misapprehension, i will check out the macros samples and see where it leads, have a nice week end.
Re: Events management
Hi again,
As i have already said i want to create a virtual node that will interact with the other different physical nodes, my virtual node will have to send/receive messages( as a physical node does) for that i'm using vbscript macros, but when i started developing my script i have noticed that to imitate a node's behavior i have to keep listening for new messages and meanwhile send messages whenever i want to, in other to do that i thought of threads, but i'm not sure if i can use threads with vbscript macros i have tried but it's not working, i would like some guidance please, am I using the right technologies or i should follow an other track to solve this problem, and what other solution do you propose to solve this problem.
i really appreciate your help Mr. Wolf
As i have already said i want to create a virtual node that will interact with the other different physical nodes, my virtual node will have to send/receive messages( as a physical node does) for that i'm using vbscript macros, but when i started developing my script i have noticed that to imitate a node's behavior i have to keep listening for new messages and meanwhile send messages whenever i want to, in other to do that i thought of threads, but i'm not sure if i can use threads with vbscript macros i have tried but it's not working, i would like some guidance please, am I using the right technologies or i should follow an other track to solve this problem, and what other solution do you propose to solve this problem.
i really appreciate your help Mr. Wolf
Re: Events management
Hi,
threads are not possible in VBS macros.
If you must listen for new messages continuously, your macro needs to have an outer loop that reads the messages from the queue. At any time in this loop you can also send messages (as responses to received requests?).
Of course VBS macros offer very limited capabilites compared to other programming languages. If you think you could solve your task better by using threads, and if you are familiar with C++, C#, Java or other programming languages, perhaps you should consider to develop a standalone application e.g. by using our PCAN-Basic API to communicate with the CAN bus. Depending on the complexity of your task, just the better debugging possibilites in a good IDE could be a great help.
threads are not possible in VBS macros.
If you must listen for new messages continuously, your macro needs to have an outer loop that reads the messages from the queue. At any time in this loop you can also send messages (as responses to received requests?).
Of course VBS macros offer very limited capabilites compared to other programming languages. If you think you could solve your task better by using threads, and if you are familiar with C++, C#, Java or other programming languages, perhaps you should consider to develop a standalone application e.g. by using our PCAN-Basic API to communicate with the CAN bus. Depending on the complexity of your task, just the better debugging possibilites in a good IDE could be a great help.
Re: Events management
Hi Mr. Wolf,
Thank you for your time, i have already started working with the PCAN-BASIC API, and it seems okay for me, i appreciate your guidance.
regards,
Thank you for your time, i have already started working with the PCAN-BASIC API, and it seems okay for me, i appreciate your guidance.
regards,