I have several internet connections that I am using with à 56k modem.
I would like to do some batch for lauching remote asp scripts.
Is it possible, using wsh, to
. connect to a specific internet connection
. launch an IE
. launch remote asp scripts using some URLs
. close IE
. disconnect the connection
Thanks in advance for your advices.
> I have several internet connections that I am using with à 56k modem.
> I would like to do some batch for lauching remote asp scripts.
>
> Is it possible, using wsh, to
> . connect to a specific internet connection
> . launch an IE
> . launch remote asp scripts using some URLs
> . close IE
> . disconnect the connection
For Win2k/WinXP, you can use rasdial to connect/disconnect
C:\>rasdial /?
USAGE:
rasdial entryname [username [password|*]] [/DOMAIN:domain]
[/PHONE:phonenumber] [/CALLBACK:callbacknumber]
[/PHONEBOOK:phonebookfile] [/PREFIXSUFFIX]
rasdial [entryname] /DISCONNECT
For NT 4.0, rasphone can be used:
Dial:
rasphone -d "PB Entry"
Hangup:
rasphone -h "PB Entry"
' Script that uses rasdial to connect, then starts IE and loads two
' different WEB pages, then quits IE and disconnect the connection
' connect
DialUpName = "Dial-up Connection 2"
sDialUpCmd = "rasdial " & """" & DialUpName & """"
' Alternativly:
' sDialUpCmd = "rasdial " & Chr(34) & DialUpName & Chr(34)
' -or-
' sDialUpCmd = "rasdial ""Dial-up Connection 2"""
If myRasDial(sDialUpCmd) Then
'connection successful, continuing
Set oIE = CreateObject("InternetExplorer.Application")
oIE.Visible = True
oUrl = "http://www.yahoo.com"
oIE.Navigate oUrl
Do While oIE.ReadyState<>4: WScript.Sleep 25:Loop
WScript.Echo oUrl & " loaded, continuing"
oUrl = "http://www.microsoft.com"
oIE.Navigate oUrl
Do While oIE.ReadyState<>4: WScript.Sleep 25:Loop
WScript.Echo oUrl & " loaded, quitting"
oIE.Quit
'disconnect
sDialUpCmd = "rasdial " & """" & DialUpName & """" & " /DISCONNECT"
myRasDial(sDialUpCmd)
End If
Function myRasDial(sCmdLine)
Set oShell = CreateObject("WScript.Shell")
myRasDial = True ' Init value
' Change 0 to 1 to make the command prompt window visible
iRC = oShell.Run(sCmdLine, 0, True)
If iRC <> 0 Then
myRasDial = False
WScript.Echo "Remote Access Error " & iRC _
& " when running command " & sCmdLine & vbCrLf & vbCrLf _
& "For more help on this error, run 'hh netcfg.chm'" & vbCrLf _
& " In help, click Troubleshooting, then Error Messages, " _
& "then " & iRC
End If
End Function
--
torgeir
That is exactly what I needed to learn my own way.
Now I have a lot of work to study all the possibilites of these objects.
I have just a little problem. My login/password are indicated within my
connections, but I MUST indicate my login/password for the connection when
launchin the rasdial command. If not, I get an error 691.
Thanks for your great help.
Julien
"Torgeir Bakken" <Torgeir.B...@hydro.com> a écrit dans le message
news: 3CF802DF...@hydro.com...
> Many thanks Torgeir !
>
> That is exactly what I needed to learn my own way.
> Now I have a lot of work to study all the possibilites of these objects.
>
> I have just a little problem. My login/password are indicated within my
> connections, but I MUST indicate my login/password for the connection when
> launchin the rasdial command. If not, I get an error 691.
Hi
Username and password added :
' connect
DialUpName = "Dial-up Connection 2"
sUserID = "something"
sPwd = "something"
sDialUpCmd = "rasdial " & """" & DialUpName & """" _
& " " & sUserID & " " & sPwd
--
torgeir
Yes, I know this syntax. It is OK when adding username and password within
the rasdial call.
However, I thought that was not necessary if username and password are
associated to the connection... ?
But when not indicated after the rasdial command, rasdial do not search them
into the connection.
That's not a real probelm for me, just for understanding why.
Julien
"Torgeir Bakken" <Torgeir.B...@hydro.com> a écrit dans le message
news: 3CF928F8...@hydro.com...