Sign in to follow this  
Followers 0
Glyph

Phone dialing through COM?

4 posts in this topic

#1 ·  Posted (edited)

; Set a COM Error handler -- only one can be active at a time (see helpfile)
$oMyError = ObjEvent("AutoIt.Error", "MyErrFunc")

$sNumberToDial = "numberhere"
Dial($sNumberToDial)

Exit

Func Dial($pNum, $time2wait = 5000)
    
    dim $FromModem = ""
    $DialString = "ATDT" & $pNum & ";" & @CR
    
    $com = ObjCreate ("NETCommOCX.NETComm")

    With $com
        .CommPort = 3
        .PortOpen = True
        .Settings = "9600,N,8,1"
        .InBufferCount = 0
        .Output = $DialString
    EndWith

    $begin = TimerInit()
    While 1
        If $com.InBufferCount Then
            $FromModem = $FromModem & $com.InputData;* Check for "OK".
            If StringInStr($FromModem, "OK") Then;* Notify the user to pick up the phone.
                MsgBox(0, "Phone", "Please pick up the phone and either press Enter or click OK")
                ExitLoop
            EndIf
        EndIf
        If (TimerDiff($begin) > $time2wait) Then
            MsgBox(0, "Error", "No response from modem on COM" & $com.CommPort & " in " & $time2wait & " milliseconds")
            Exit
        EndIf
    WEnd

    $com.Output = "ATH" & @CR
    $com.PortOpen = False
    $com = 0
    
EndFunc;==>Dial

Func MyErrFunc()
; Set @ERROR to 1 and return control to the program following the trapped error
    SetError(1)
    MsgBox(0, "Error", "Error communicating with modem on COM" );& $com.CommPort)
    Exit
EndFunc;==>MyErrFunc

Error communicating with modem on COM

Using a dial up connection, should work off the same connection?

i've already dled netcomm installed and and replaced it with the updated netcomm from hardandsoftware.net

I'm not sure what the problem is here....

Reference:

http://www.autoitscript.com/forum/index.php?showtopic=19769

Edited by BackStabbed

tolle indicium

Share this post


Link to post
Share on other sites



Using a dial up connection, should work off the same connection?

Same connection as what?

If you already have some other program using COM3 then you cannot use COM3.


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

Same connection as what?

If you already have some other program using COM3 then you cannot use COM3.

I'll try this disconnected from the internet and see if it works??

if it does, i'll let you know.

i'll try this later on, seeing as how it's 4am here.

thanks for replying!


tolle indicium

Share this post


Link to post
Share on other sites

This worked!! thanks for the help!


tolle indicium

Share this post


Link to post
Share on other sites

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
Sign in to follow this  
Followers 0