Jump to content

phone dialer


Guest zirex
 Share

Recommended Posts

On windows 2000/XP you can use the following to connect/disconnect dial-up connections:

Rasdial.exe "My Connection"  myusername mypassword
rasdial.exe "My Connection" /disconnect

Not sure if this is what you are looking for....

We have enough youth. How about a fountain of SMART?

Link to comment
Share on other sites

I think windows 95/98 used to come with a dialer built-in. I don't know if newer windows include that, but you might want to look for that and see if it's scriptable...

Link to comment
Share on other sites

:"> I wonder can someone show me how to create a phon dialer simpl   with auto it..........

<{POST_SNAPBACK}>

I'm not able to test this at the moment, but not surprisingly there is a COM interface that can do this. I found a VBS example and did a quick conversion... Bone up on your Hayes AT modem commands to do the fancy stuff. (requires 3.1.1+ beta)

Dale

Dial("1234567")

Exit

Func Dial($pNum)

    dim $FromModem = ""
    $DialString = "ATDT" & $pNum & ";" & @CR
    
    $com = ObjCreate ("MSCommLib.MSComm")
    
    With $com
        .CommPort = 3
        .Settings = "9600,N,8,1"
        .PortOpen = True
        .InBufferCount = 0
        .Output = $DialString
    EndWith
        
    While 1
        If $com.InBufferCount Then
            $FromModem = $FromModem & $com.Input;* 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
    WEnd
    
    $com.Output = "ATH" & @CR
    $com.PortOpen = False
    $com = 0
    
EndFunc  ;==>Dial

Edit: fixed a typo

Edit: I tested it... it works

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

  • 4 months later...

For the previous COM example, many people will not have the MSComm ocx file on thier system (unless they once had VB6 installed). It is a royalty component and therefore cannot be redistributed.

Fortunately, there is a freeware version created to be a full emulation of that control that you can doewnload and install... then just replace the MSComm with NetCommOCX in the previous example and you should be set.

You'll find the download link here: NetComm

Here's an updated example using NetComm with some additional error handling tossed in:

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

$sNumberToDial = "5551212"
Dial($sNumberToDial)

Exit

Func Dial($pNum, $time2wait = 5000)
    
    dim $FromModem = ""
    $DialString = "ATDT" & $pNum & ";" & @CR
    
;   $com = ObjCreate ("MSCommLib.MSComm")
    $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.Input;* 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

Enjoy,

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

  • Moderators

This is very cool Dale... as usual :P

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
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
 Share

  • Recently Browsing   0 members

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