Jump to content

Phone Dialer (using COM to modem on serial port)


DaleHohm
 Share

Recommended Posts

I'm sorry, that doesn't make sense to me.

What is your native language?

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

I'm sorry, that doesn't make sense to me.

What is your native language?

Dale

no I have a rs232 device on com4 if I use a modem program I can send it the command fr; and it send back the status as fs0; fr1; fr2; so what I went to do is send the command and see the what comes back so I known the next command. I need to send thanks Beau

Link to comment
Share on other sites

You're at it again Dale! Trying to extend the capabilities of AutoIt where no other programming language has gone before...

It's a real shame I don't have data cables for serial ports, in fact, I seem to have no devices for those ports. When I saw the title for this topic I didn't read the 'serial' part and kept hoping usb ports were supported.

Well, can't try it, but it definitely is a good idea.

IVAN

Link to comment
Share on other sites

@n9mfk9

If $com.InBufferCount is >0, then there is data in the output buffer

$com.Input will return the data from the buffer to your program

So, send your command and read $com.Input to the modem response and take appropriate action based on the result

@ivan

Thanks for the kind words, but they are hyperbole... this example was adapted from a VB sample I found and MSComm has been around for quite a long time... This sort of thing is old hat and only new to AutoIt because it uses the COM support. There are other more brute force methods as well that read and write directly to the serial interface.

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

  • 4 weeks later...

Sorry, don't know. Suggest you might want to create a test in VBScript and then look in MSDN for docs and for support.

If it works in VBScript and not in AutoIt, then it will warrant more research.

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

  • 2 months later...

Great!

In AutoIt you'll need to use ObjEvent to set up a COM event handler. Take a look at the helpfile... it is pretty straight forward and similar to the VBS handler.

Dale

Can you give a brief example of this? I am trying to write a simple script that looks for a change in the Carrier Detect Event (comEvCD) and notifies me each time it chages state.

I reviewed the help file on ObjEvent but I can't relate it to your NetComm object.

All I am trying to do is read the Carrier Detect state and send time and date info to a file when the state changes. I have this script working in Reflections Basic Script but can't match it in AutoIT.

Any help would be greatly appreciated.

RanzITman

Edited by RanzITman
Link to comment
Share on other sites

Suggest you post what you have tried so far and see if anyone can help.

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

stupid question here dale your computer must be connected straight to your modem and not going through a router?

the component controls a serial (COM) port. ObjCreate can connect to a remote system however, so it depends on how your modem is connected.

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

  • 4 weeks later...

Suggest you post what you have tried so far and see if anyone can help.

Dale

I wrote this simple script that records probe activity on a CMM. It works fine with MSCOMM but the machine I am loading it on does not have that control. Does NETCOMM have all the routines of MSCOMM? Can this script be easily converted?

Thanks;

RanzITman

#include <Date.au3>

Opt("TrayAutoPause",0) ;0=no pause, 1=Pause

Opt("TrayMenuMode",1) ;0=append, 1=no default menu, 2=no automatic check, 4=menuitemID not return

$oMyError = ObjEvent("AutoIt.Error", "MyErrFunc")

$cfg = FileOpen ("CMMMon.cfg",0)

If $cfg = -1 Then

MsgBox(0, "Error", "Unable to open Config file.")

Exit

EndIf

$cport = FileReadLine($cfg)

$csets = FileReadLine($cfg)

$path = FileReadLine($cfg)

FileClose($cfg)

$file = FileOpen($path, 1)

FileWriteLine($file, @CRLF & '"----","----","------","-----------","-----------"')

FileWriteLine($file,'"Date","Time","Status","Mins Parked","Mins Active"')

FileWrite($file,'"' & _NowCalcDate() & '","' & _NowTime(5) & '","PrgStart",')

FileClose($file)

$Parked = True

$chngd = TimerInit()

$dif = Round(TimerDiff($chngd),3)

$hour = 0

$mins = 0

$secs = 0

$com = ObjCreate ("MSCommLib.MSComm")

ObjEvent($com,"CommEvent")

With $com

.CommPort = $cport

.PortOpen = True

.Settings = $csets

.InBufferCount = 0

.Handshaking = 2

.Sthreshold = 1

.Rthreshold = 0

EndWith

While 1

If $com.cdHolding = True and $parked = True Then

$dif = Round(((TimerDiff($chngd) / 1000)/60),3)

$file = FileOpen($path, 1)

FileWriteLine($file,',,' & $dif)

FileWrite($file,'"' & _NowCalcDate() & '","' & _NowTime(5) & '","Parked"')

FileClose($file)

$Parked = False

$chngd = TimerInit()

Elseif $com.cdHolding = False and $Parked = False Then

$dif = Round(((TimerDiff($chngd) / 1000)/60),3)

$file = FileOpen($path, 1)

FileWriteLine($file,',' & $dif)

FileWrite($file,'"' & _NowCalcDate() & '","' & _NowTime(5) & '","Active"')

FileClose($file)

$Parked = True

$chngd = TimerInit()

EndIf

Sleep(1000)

WEnd

$com.Output = "ATH" & @CR

$com.PortOpen = False

$com = 0

Func MyErrFunc()

; Set @ERROR to 1 and return control to the program following the trapped error

SetError(1)

MsgBox(0, "Error", "Error communicating with COM port" );& $com.CommPort)

Exit

EndFunc;==>MyErrFunc

Link to comment
Share on other sites

Most likely. See the Netcomm api docs.

Dale

Edited by DaleHohm

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

  • 2 months later...

Hi there,

I tried the example NETComm code. When I read the port using inputData, I got the "Error communicating with modem on COM" message. I have installed the NETCommOCX and update (is it just overwrite the old NETComm.ocx with the new one?) Does anyone see this problem before?

Thanks,

larson

Link to comment
Share on other sites

  • 6 months later...

There is a way to know if there is already a call on the line , so if there is a call the script can wait for it to end?

And after the number has been sent there is a way to know if the called phone is ringing?

There are built in solutions or i must see 'by hand' what data are sent to the modem when there are not calls on the line and when the other phone is ringing?

Link to comment
Share on other sites

You'll need to look at documentation for MSCOMM (probably in MSDN) and NETComm (at the HardAndSoftware link in the base note).

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

Hey Dale;

Is there any special syntax needed in NETCOMM to change the default buffer sizes? I can read the values easily with:

MsgBox(0,"Show Me","Settings are at " & $com.InBufferSize)

MsgBox(0,"Show Me","Settings are at " & $com.OutBufferSize)

They both return 1024.

But... When I try to set the values using:

$com.InBufferSize = 4096

$com.OutBufferSize = 32000

I get an immediate error trapped and the program exits. I have tried these lines before and after opening the port. The routine works fine with the lines commented out.

The Machine I am connecting to requires those buffer settings.

Any Ideas?

Thanks;

RanzITman

Link to comment
Share on other sites

Figured it out.. It looks like order is critical.

Set port

Set inbuffer

Set outbuffer

Set baud,parity etc...

open port.

No errors...

Hey Dale;

Is there any special syntax needed in NETCOMM to change the default buffer sizes? I can read the values easily with:

MsgBox(0,"Show Me","Settings are at " & $com.InBufferSize)

MsgBox(0,"Show Me","Settings are at " & $com.OutBufferSize)

They both return 1024.

But... When I try to set the values using:

$com.InBufferSize = 4096

$com.OutBufferSize = 32000

I get an immediate error trapped and the program exits. I have tried these lines before and after opening the port. The routine works fine with the lines commented out.

The Machine I am connecting to requires those buffer settings.

Any Ideas?

Thanks;

RanzITman

Link to comment
Share on other sites

Cool. Glad I could help :)

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

  • 1 month later...

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...