I've tried this script and I can't seems to get a connection, few examples;
1.
I've used 218.208 / 218.111 but no connection (meaning status of my network showing connected)
Maybe it just because it hasn't found the ip in the string, well so i killed the process (wscript).
IPInString = "218.111"
IPNumber = "218."
2.
I edited the script to the normal IP I always get which is 60.54 / 60.50 but still no connection.
Maybe it just because it hasn't found the ip in the string, well so i killed the process and did a manual connection and got 118.101.x.x
3.
So i thought what the hack, let try doing this instead;
IPInString = "118.101"
IPNumber = "118."
Yet again, still no connection. But the things is when I did a manual connection again (using my fingers) I would get the 108.101.x.x IP again
Before, I leave out anything let me just say YES to the following;
- my Modem is on Bridged
- my username & password is correct
- i'm connecting via a dialer
Below is the script that is saved in VBS i'm using;
'Script to auto connect/disconnect until you get the ip within a range that specified by you.
TempFileName="c:ips.txt" 'Any temporary location
IPInString = "218.111" 'String to search for
IPNumber = "218." 'Beginning of IP to search for.
ConnectionName = "Useless Streamyx" 'the name of your StreamyX connection
UserName = "username@streamyx" 'replace with your NETWORK ID
Password = "password" 'replace with your NETWORK PASSWORD
'---------------------------------------------------------------------
sFlag = 0
Const ForReading = 1, ForWriting = 2, ForAppending = 3
Set oFileSystem = CreateObject("Scripting.FileSystemObject")
Set oShell = CreateObject("WScript.Shell")
oShell.Run "%comspec% /c rasdial.exe " & ConnectionName & " /Disconnect"
Do While sFlag <> 1
oShell.Run "%comspec% /c rasdial.exe " & ConnectionName & " " & UserName & " " & Password,2,true
oShell.Run "%comspec% /c ipconfig.exe > " & TempFileName,2,true 'line 10
Set oFile = oFileSystem.OpenTextFile(TempFileName, ForReading)
'Search for IPs and check if in right domain
Do While oFile.AtEndOfStream <> True
sIPAddress = oFile.ReadLine 'Read line of temporary file
If Instr(sIPAddress,IPInString) <>0 then 'Find line start with IP Address
ColonPos = Instr(21,sIPAddress,":") 'Find position of colon
sIPAddress = Mid(sIPAddress,ColonPos+2) 'Extract IP portion
If Trim(Left(sIPAddress,Len(IPNumber))) = IPNumber then 'Check of right IP
sFlag = 1 'Found good IP so set flag
exit do
End If
End If
Loop 'Look for next IP
If sFlag = 0 then
oShell.Run "%comspec% /c rasdial.exe " & ConnectionName & " /Disconnect"
oShell.Run "ping.exe -n 3 127.0.0.1", 0, True
End If
Loop
If sFlag = 1 then 'Found good IP so process route table
oFile.Close
set oFile=nothing
'Delete temporary file.
oFileSystem.DeleteFile TempFileName,true
'Cleanup
set oTXTFile=nothing
set oFileSystem=nothing
set oShell = nothing
end if
I've tried using this script while network connected & not connected but the result is still same. Is my script wrong, did i miss something out? Appreciate your help guys.. tks
p/s: Its now 4.30am I've got a headache trying to figure this out
Jun 14 2008, 04:34 AM
Quote
0.0203sec
0.42
7 queries
GZIP Disabled