search
Search keywords
Category
Featured Applications
MailWorks Professional let's you create and manage your own e-mail marketing campaigns.
We offer FREE voting polls for your web site.
The new auction site that has all the features of a successfull market place.
Banner Advertisement to give you a channel to present your products to a targeted Web Development audience.
Give your Application the exposure it deserves! Your application will be displayed on each and every page header.
Your application holds one of the top positions and seen first when browsing through your Application's category.
Full application details

Full application details

COM port control - controlling a serial device
Programming > Components & Libraries
Modified: 07/03/2007
Application ID: #5929
Author:
License:
Commercial license(s) available (license information)
Platforms:
Programming language:
Visual Basic
Source Code Available:
No
Option Explicit

Dim numDevices, strDevices, i, str, objComport

Set objComport = CreateObject( "ActiveXperts.Comport" )
Wscript.Echo "ActiveComport " & objComport.Version & " demo."
Wscript.Echo "Expiration date: " & objComport.ExpirationDate & vbCrLf

' Set Device property
numDevices = objComport.GetDeviceCount()
strDevices = "*** Enter one of the following device names *** " & vbCrLf & vbCrLf
For i = 0 To numDevices - 1
strDevices = strDevices & objComport.GetDevice( i )
strDevices = strDevices & vbCrLf
Next
strDevices = strDevices & "COM1" & vbCrLf & "COM2" & vbCrLf & "COM ..." & vbCrLf
Do
objComport.Device = InputBox( strDevices, "Input" )
Loop until objComport.Device <> ""

' Optionally override defaults
' objComport.BaudRate = 9600
' objComport.HardwareFlowControl = True
' objComport.SoftwareFlowControl = False

' Set Logging - for troubleshooting purposes
objComport.LogFile = "C:\ActiveComport.log"

' Open the port
objComport.Open
If( objComport.LastError <> 0 ) Then
Wscript.Echo "Open failed, Error #" & objComport.LastError & " : " & objComport.GetErrorDescription( objComport.LastError )
WScript.Echo "Ready."
WScript.Quit
End If

' Write command, and wait for the response
WriteStr objComport, "atz"
ReadStr objComport

' Write command, and wait for the response
WriteStr objComport, "ati"
ReadStr objComport

' Close the port
objComport.Close
Set objComport = Nothing
WScript.Echo "Ready."



' ********************************************************************
' Sub Routines
' ********************************************************************

Sub WriteStr( obj, str )
obj.WriteString str
WScript.Echo "-> " & str
End Sub

' ********************************************************************

Sub ReadStr( obj )
str = "notempty"
obj.Sleep 200
Do While str <> ""
str = obj.ReadString
If( str <> "" ) Then
WScript.Echo "<- " & str
End If
Loop
End Sub
License Information Direct link:
Rate this application now
hits: 76
downloads: 72
reviews: 0
rating: 0.0 / 5 (0 votes)
Statistics
Today
  • New listings
    0
  • Downloads
    0
This week
  • New listings
    0
  • Downloads
    0
This month
  • New listings
    0
  • Downloads
    0
Total
  • Members
    86
  • Listings
    681
  • Downloads
    63531
  • Categories
    137
  • Reviews
    3606