Initiating a Dial-Up Network connection 
Author Message
 Initiating a Dial-Up Network connection

From a VBScript, how can I bring up a pre-defined dial-up network
connection? Then after the script is done, can the script disconnect the
dial-up connection?

--
Mike Roeglin



Fri, 14 Jun 2002 03:00:00 GMT  
 Initiating a Dial-Up Network connection

Here's a post from Bill James in the ...scripting.wsh newsgroup from October 28th...

============================================

Use an InputBox to display a "menu" specifying what key to press for what
connection, then process that input.  As luck would have it, I use this
technique for 10 dialup connections.  I use a dictionary object here, but
you could do the same thing with just variables.

'DUNmenu.vbs - Dial-Up Networking (DUN) menu.

'
Option Explicit
Dim WshShell
Set WshShell=WScript.CreateObject("WScript.Shell")
'
'Create dictionary object of DUN connectoids.
'Item string must match connectoid name exactly.
Dim DUN
Set DUN = CreateObject("Scripting.Dictionary")
DUN.Add "0", "Aurora - Earthlink"
DUN.Add "1", "Boulder - Earthlink"
DUN.Add "2", "Brighton - Earthlink"
DUN.Add "3", "Denver - Earthlink"
DUN.Add "4", "Golden - Earthlink"
DUN.Add "5", "NE Denver - Earthlink"
DUN.Add "6", "Parker - Earthlink"
DUN.Add "7", "Southwest - Earthlink"
DUN.Add "8", "Sullivan - Earthlink"
DUN.Add "9", "800 Access ($4.95 per hour)"
'
'Create menu to display.
Dim Key, Menu
For Each Key in DUN
  Menu = Menu & Key & " --- " & DUN(Key) & vbCRLF
Next
'
'Get user choice from menu items.
Dim Choice
Choice = InputBox("Select a connection by typing " &_
  "it's number, then click OK or press Enter." & vbCRLF &_
  vbCRLF &  Menu, "Dial-Up Connection Menu", "2")
'
'Dial the selected connectoid.
If Choice <> "" Then
    WshShell.Run "rundll rnaui.dll,RnaDial " & DUN(Choice)
End If

Bill James

================================================

--
Michael Harris


  From a vbscript, how can I bring up a pre-defined dial-up network
  connection? Then after the script is done, can the script disconnect the
  dial-up connection?

  --
  Mike Roeglin



Fri, 14 Jun 2002 03:00:00 GMT  
 Initiating a Dial-Up Network connection
You can start a dial-up connection with this VBScript code:

Set ws = CreateObject("WScript.Shell")
c = "Exact Name of DUN Connection"
ws.Run "rundll rnaui.dll,RnaDial " & Chr(34) & c & Chr(34)
'the Chr(34)'s are only needed if space in DUN connectoid name.

Of course, you must have your username and password saved in the DUN
connectiod, and you must have DUN configured to not prompt for information
before dialing.

No way I have found no good way to kill a connection using VBScript.  If you
have WSH 2, I suppose you could open an instance of Outlook Express and use
SendKeys to send Alt, F, W, to trigger the File menu item and the Work
Offline item.  In OE this brings up a prompt to hang up the modem, which you
could send a Y or Enter to trigger.  Real kludgy, with lots of pitfalls.

Your other option is to use a third party tool, Rasdial95.  You can send
command lines to it, and configure it to either dial a specific connection,
hang up a specific connection, or hang up any connection.  Check it out at
http://www.homenet.com.hk/nonags/dun.html.

--
Bill James

Free Win9x VBScript Utilities
http://home.earthlink.net/~wgjames/vbspage/


Quote:
> From a vbscript, how can I bring up a pre-defined dial-up network
> connection? Then after the script is done, can the script disconnect the
> dial-up connection?

> --
> Mike Roeglin




Sat, 15 Jun 2002 03:00:00 GMT  
 Initiating a Dial-Up Network connection

Here's a little snippet from a WSH post by Robert Bradley back in November on how to write a simple phone dialer in VBScript...

<snip>
...
shell.Run "%comspec% /c echo ATDT " & number & " > com1:"
MsgBox "dialled"
shell.Run "%comspec% /c echo ATH > com1:"
...
</snip>

Try using the echo ATH to the appropriate com port...

--
Michael Harris


  You can start a dial-up connection with this VBScript code:

  Set ws = CreateObject("WScript.Shell")
  c = "Exact Name of DUN Connection"
  ws.Run "rundll rnaui.dll,RnaDial " & Chr(34) & c & Chr(34)
  'the Chr(34)'s are only needed if space in DUN connectoid name.

  Of course, you must have your username and password saved in the DUN
  connectiod, and you must have DUN configured to not prompt for information
  before dialing.

  No way I have found no good way to kill a connection using VBScript.  If you
  have WSH 2, I suppose you could open an instance of Outlook Express and use
  SendKeys to send Alt, F, W, to trigger the File menu item and the Work
  Offline item.  In OE this brings up a prompt to hang up the modem, which you
  could send a Y or Enter to trigger.  Real kludgy, with lots of pitfalls.

  Your other option is to use a third party tool, Rasdial95.  You can send
  command lines to it, and configure it to either dial a specific connection,
  hang up a specific connection, or hang up any connection.  Check it out at
  http://www.homenet.com.hk/nonags/dun.html.

  --
  Bill James

  Free Win9x VBScript Utilities
  http://home.earthlink.net/~wgjames/vbspage/



  > From a vbscript, how can I bring up a pre-defined dial-up network
  > connection? Then after the script is done, can the script disconnect the
  > dial-up connection?
  >
  > --
  > Mike Roeglin



Sat, 15 Jun 2002 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Initiating a VBscript after Dial Up Connection is completed

2. Initiating Dial-up networking sequence

3. Initiating Dial-up networking ....

4. how to initiate Win95's Dial-Up Networking using VB3

5. Initiating DIal-up Networking sequence

6. Initiating a dial up connection w/ Inet control or wininet API calls

7. How to initiate Dial-Up (RAS) connection?

8. client side causing dial-up connection to initiate

9. How: Detect Dialup-Connection with Dialup-Network?

10. Dial-up or NIC Network Connection

11. start a Dial-Up Network Connection

12. Dial-up networking connections

 

 
Powered by phpBB® Forum Software