I am fairly new to VBScript but am familiar with VB. I would like to comunicate with a Balance using a Rs232 Comm Port. In VB6 this was easy using a MScomm control.
If someone can point me in right direction to make a start that would be a great help.[?]
Posts: 78
Score: 0
Joined: 1/27/2005
From: USA
Status: offline
I have a tutorial posted on my website that explains exactly how to use the MSComm control with VBScript. It shows how to respond to events and how to properly grab everything waiting in the buffer. If interested, I'll post a link. (I am an electronics guy and have had a good bit of experience with the MSComm control.)
Posts: 78
Score: 0
Joined: 1/27/2005
From: USA
Status: offline
Ok, [url]www.mindspring.com/~redrocker1[/url]. That's the main page. Scroll down to the link to the tutorial. Disclaimer: I am no web page designer! My page is rudimentary. My interest is in providing good tutorials, not fancy presentations. Nothwithstanding, the tutorial should at least get VeronicaF started in the right direction.
I'm trying to apply what I learned from beaker's web page, but I'm stuck. He says that you don't need VB installed (I don't have it) to access MSComm. But when I run CreateObject("MSCommLib.MSComm") in my VBScript, I get the error ActiveX can't create object "MSCommLib.MSComm" The rest of the script runs fine.
If I can really use MSComm without VB, do I need to do something so that VBScript can access it?
Posts: 78
Score: 0
Joined: 1/27/2005
From: USA
Status: offline
The MSComm ActiveX control lives on my computer because I have Visual C++ 6.0 installed, but I don't really know if I would have it there if not for that fact. It is a redistributable component, meaning developers have license to include it within software distributions, but it may well be that you have never installed a program that installed the component onto your computer. You can of course do a quick check of the registry to see if it is in there, by searching for 'MSCOMMLib.MSComm'. Also, I probably should fix this, but the '.1' in the ProgID 'MSCOMMLib.MSComm.1' is not necessary. That caused a problem for another respondent a few weeks ago. If you don't have the control installed on your computer, I'll go ahead and copy it up to my page, but I'll only bother if you show interest.
Thanks beaker. I can't find MSComm in the registry, so, yes, if you are allowed to, please put the control up on your web page (with info on how to install it, if you will). PHP and Perl have both failed me on my project and I think VBScript (if I can get MSComm) will be my solution.
Posts: 78
Score: 0
Joined: 1/27/2005
From: USA
Status: offline
I was wrong about its redistributable nature. I erroneously believed because it was on the list, it was good to go. Actually, it is a licensed component. Sorry, I did not know that.
Posts: 78
Score: 0
Joined: 1/27/2005
From: USA
Status: offline
Yes, I looked at their example pretty hard, but could not conceive of a way to adapt it to VBS because VBS only has access to the methods exposed by the automation interface, while C++ has access to the functions of the base class from which the control was derived.
I have updated my web page to reflect this new information. Good luck with your project.
I have not tried it yet, but maybe the MScomm look-alike described here (http://ourworld.compuserve.com/homepages/richard_grier/xmcomm.htm) can do the job.
Posts: 78
Score: 0
Joined: 1/27/2005
From: USA
Status: offline
I would say 'go for it' and let us know if it works. Perhaps InstallShield puts the license for the control into the registry. Grier explicitly says his motivation was to make the MSComm control available to non-VB5/VB6 users, so ostensibly that means that it should work for those of you who do not have it already installed. This will be my last post for a week or so as I will be losing internet access for a while while I move, but maybe I'll go the library or something to check on your progress. You are doing a service!
Prerequisites The MSComm32.ocx ActiveX control is licensed. Therefore, it must be legitimately installed onto the computer on which this script is run. Simply copying the control will not license it and the control will not work. The programmer has two options:
Install Visual Basic 6.0 or Visual C++ 6.0. This will install a licensed version of the MSComm32.ocx ActiveX control onto the computer.
Install the NETCommOCX ActiveX control from Richard Grier's web site. I have not personally tried it but I do have direct testimonial from another user who did not have the MSComm control installed on his computer and installed this control and used this example successfully. Mr. Grier's control is a wrapper around Microsoft's MSComm control. Grier uses an installation program to install the control on the computer, and this step likely register's the licensed control properly.
Introduction This example is for those individuals who are interested in using script to do sophisticated serial comms on their computer. It shows four key concepts: receive, transmit, saving received data to a file, and formatting the received data with comma separators. Naturally, as a script, the program has no user interface, but is great for doing background processing, and it does not tie up the CPU. The example is setup to receive six characters and then store them into a file with comma separators between each pair of characters.