anybody know how to write this scripts?

Post new topic   Reply to topic    DD-WRT Forum Index -> Broadcom SoC based Hardware
Author Message
andylol
DD-WRT Novice


Joined: 22 Dec 2006
Posts: 12

PostPosted: Mon Feb 19, 2007 7:05    Post subject: anybody know how to write this scripts? Reply with quote
i want to auto select ip under 218.111.xxx.xxx.

i dun not how to write a scripts at start up command.

eg.

my pppoe everytime i startup my router ddwrt v23 sp2 mini version.

its will auto connect random ip under 3 difference ip 60.xxx.xxx.xxx , 219.xxx.xxx.xxx , 218.111.xxx.xxx. so can i just connect what i wan ip around 218.111.xxx.xxx. then i will no need goto webpage disconnect it and connect it untill reach what i wan ip.

anybody know how to write a scripts.

thanks for read my question.

and sorry about my poor english. Cool
Sponsor
andylol
DD-WRT Novice


Joined: 22 Dec 2006
Posts: 12

PostPosted: Mon Feb 19, 2007 7:40    Post subject: Reply with quote
show you a picture.

i know must got something scripts can write at startup command.

unfortunely i don no how to write.

very troublesome everytime i start up my router, i need to go webpage ddwrt see i aready connect to 218.111.xxx.xxx, otherwise i need to disconnect it, and connect it back. untill i reach my 218.111.xxx.xxx .



ip.jpg
 Description:
 Filesize:  18.48 KB
 Viewed:  3641 Time(s)

ip.jpg


andylol
DD-WRT Novice


Joined: 22 Dec 2006
Posts: 12

PostPosted: Mon Feb 19, 2007 8:48    Post subject: Reply with quote
anybody know, anybody has this problem b4.. Very Happy
andylol
DD-WRT Novice


Joined: 22 Dec 2006
Posts: 12

PostPosted: Mon Feb 19, 2007 9:13    Post subject: Reply with quote
i got use this scripts b4.but is for pc connect to modem only.not use router.

so i show here for e.g.

'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 = "goodsver" 'the name of your goodsver connection
UserName = "xxxxxxxxxx@goodsver"'replace with your NETWORK ID
Password = "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
Display posts from previous:    Page 1 of 1
Post new topic   Reply to topic    DD-WRT Forum Index -> Broadcom SoC based Hardware All times are GMT

Navigation

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum