sykes Posted May 8, 2006 Share Posted May 8, 2006 I have taken snippets of code from the forum as well as some from MSDN, but all i'm receiving from this program is zero's. I have com1 connected to a device that supplies raw data (i.e. text) but I never see any of it. The program returns thousands of zeros and just seems to stop. Am I missing something in my code? $NetComm = ObjCreate("NETCommOCX.NETComm") $NetComm.CommPort = 1;Set port number $NetComm.Settings = "9600,N,8,1";Set port settings $NetComm.InputLen = 0;reads entire buffer $NetComm.InputMode = 0;reads in text mode $NetComm.PortOpen = "True";opens specified COM port While 1 ConsoleWrite($NetComm.InputData) WEnd We have enough youth. How about a fountain of SMART? Link to comment Share on other sites More sharing options...
seandisanti Posted May 8, 2006 Share Posted May 8, 2006 I have taken snippets of code from the forum as well as some from MSDN, but all i'm receiving from this program is zero's. I have com1 connected to a device that supplies raw data (i.e. text) but I never see any of it. The program returns thousands of zeros and just seems to stop. Am I missing something in my code? $NetComm = ObjCreate("NETCommOCX.NETComm") $NetComm.CommPort = 1;Set port number $NetComm.Settings = "9600,N,8,1";Set port settings $NetComm.InputLen = 0;reads entire buffer $NetComm.InputMode = 0;reads in text mode $NetComm.PortOpen = "True";opens specified COM port While 1 ConsoleWrite($NetComm.InputData) WEndwhat kind of device is it attached to? what program is that data supposed to be directed at? Link to comment Share on other sites More sharing options...
sykes Posted May 8, 2006 Author Share Posted May 8, 2006 The device is a register from Verifone. It is set up to have a Virtual Journal Printer. This is the port I am hooked to with COM1 on my pc. The virtual journal port supplies raw data in text form of all transactions on the register. All I am trying to do at this point is retrieve the data from this port and display it using the consolewrite function in autoit. Upon getting that far I intend to write the data to a database. We have enough youth. How about a fountain of SMART? Link to comment Share on other sites More sharing options...
seandisanti Posted May 8, 2006 Share Posted May 8, 2006 The device is a register from Verifone. It is set up to have a Virtual Journal Printer. This is the port I am hooked to with COM1 on my pc. The virtual journal port supplies raw data in text form of all transactions on the register. All I am trying to do at this point is retrieve the data from this port and display it using the consolewrite function in autoit. Upon getting that far I intend to write the data to a database.ok, a couple of things to check, do you have any lights or indicators on the register to say that it's not hooked to a printer, or a communication error? also, does the register show as connected in your device manager? the reason i ask, is that either device may not be acknowledging the connection, in which case not trying to actually communicate. Link to comment Share on other sites More sharing options...
sykes Posted May 8, 2006 Author Share Posted May 8, 2006 (edited) No lights to check. I can however open hyperterminal on com1 and see the data stream by. Edited May 8, 2006 by sykes We have enough youth. How about a fountain of SMART? Link to comment Share on other sites More sharing options...
CyberSlug Posted May 8, 2006 Share Posted May 8, 2006 Take a look at some of the posts athttp://www.autoitscript.com/forum/index.php?showtopic=13890Some of the syntax might have changed, but I *think* the current beta of AutoIt should be compatible with the posted code samples. Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig! Link to comment Share on other sites More sharing options...
sykes Posted May 9, 2006 Author Share Posted May 9, 2006 Take a look at some of the posts athttp://www.autoitscript.com/forum/index.php?showtopic=13890Some of the syntax might have changed, but I *think* the current beta of AutoIt should be compatible with the posted code samples.Thats where I got the code I've been using ... Just can't seem to receive the data We have enough youth. How about a fountain of SMART? Link to comment Share on other sites More sharing options...
CyberSlug Posted May 9, 2006 Share Posted May 9, 2006 Thats where I got the code I've been using ... Just can't seem to receive the data Oh, sorry then. I saw your ObjCreate("NETCommOCX.NETComm") line and thought you were using something different. Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig! Link to comment Share on other sites More sharing options...
sykes Posted May 9, 2006 Author Share Posted May 9, 2006 (edited) I used NETComm.ocx because it is free and redistributable. All Properties, Methods, Events, etc, etc are the same as MSCOMM32.OCX with the exception of the Input property (it's InputData in NETComm.ocx). I played with the code this morning and was finally able to get it working. Working code is below: HotKeySet("{ESC}", "_KillDaWabbit") $NetComm = ObjCreate("NETCommOCX.NETComm");Create NETComm.ocx object ;Set object settings With $NetComm .CommPort = 1 ;Set port number .Settings = "9600,N,8,1" ;Set port settings .InputLen = 0 ;reads entire buffer .InputMode = 0 ;reads in text mode .HandShaking = 3 ;uses both RTS and Xon/Xoff handshaking .PortOpen = "True" ;opens specified COM port EndWith While 1 _GetData() WEnd Func _GetData() If $NetComm.InBufferCount > 0 Then ConsoleWrite($NetComm.InputData) Sleep(250) EndIf EndFunc Func _KillDaWabbit() Exit EndFunc Adding the HandShaking property was what finnaly enabled me to retrieve the data. Edited May 9, 2006 by sykes We have enough youth. How about a fountain of SMART? Link to comment Share on other sites More sharing options...
Uten Posted May 9, 2006 Share Posted May 9, 2006 Use portmon from sysinternals to see if there are any activity at all on the port.Happy for you that you got it working Please keep your sig. small! Use the help file. Search the forum. Then ask unresolved questions :) Script plugin demo, Simple Trace udf, TrayMenuEx udf, IOChatter demo, freebasic multithreaded dll sample, PostMessage, Aspell, Code profiling Link to comment Share on other sites More sharing options...
microera Posted November 28, 2010 Share Posted November 28, 2010 Maybe anybody solve this situation with portmon.exe? (ports not viewed) see sysinternals forum: http://forum.sysinternals.com/topic15200.html Link to comment Share on other sites More sharing options...
microera Posted November 30, 2010 Share Posted November 30, 2010 solution is disabling non hw ports!See my answer on sysinternals forum!example: Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now