drislaam Posted March 8, 2008 Share Posted March 8, 2008 (edited) Hi,My name is Islaam, a medical student from Egypt and a NEW user of AutoItI am somewhat newbie but after working around 20 hours back to back I could develop this script to grab new IP address for SpeedTouch 510 (E) Using TCP commands. [For downloading issues]I add a lot of options First It runs TRANSPARENTLY but dispalys a traytip of what is goinig on but also it can be run in silent mode all that being determine from settings file which store this in config file the user can determine delay time of ISP other options.after developing that algorithm , I can develop a program like a expect or Telnet scripting tool 1.0 that enable to but in txt file what value to wait and what to send But as a medical student I will not and made what I WANT and it's open for you if you want to develop that script.Screenshots of settings file Here is the executables And here is the code expandcollapse popup#NoTrayIcon #include <Inet.au3> #include <Misc.au3> ; ------------------ Cheacking Existence of config.snt! file ---------------- >> If Not FileExists("config.snt!") Then MsgBox(16, "Error", "config.snt! file couldn't be localized..!") Exit EndIf ; << --------------- Cheacking Existence of config.snt! file ------------------- ; ---------------------- Allow Single Instance Starts ----------------------- >> _Singleton("IP Snatcher v1.5") ; << --------------------- Allow Single Instance Ends -------------------------- ; ------------------ Options & Tray Icon Settings Starts -------------------- >> ; Condition Of Displaying The Tray Icon $CurSilentStatus = StringMid(FileReadLine("config.snt!", 6), 8) If $CurSilentStatus = "Off" Then Opt("TrayIconHide", 0) Else TraySetToolTip("IP Snatcher v1.5 (Running) - Please wait..") TraySetClick(0); Disable clicking EndIf ; << ------------------ Options & Tray Icon Settings Ends --------------------- ; ---------------------- Extracting variables values ----------------------- >> $Gateway = StringMid(FileReadLine("config.snt!", 3), 9) $Port = "23" $Username = StringMid(FileReadLine("config.snt!", 4), 10) $Password = StringMid(FileReadLine("config.snt!", 5), 10) $ReconnectionDelay = StringReplace(StringMid(FileReadLine("config.snt!", 7), 20), " Seconds", "000") $ServiceWaitTime = StringReplace(StringMid(FileReadLine("config.snt!", 8), 19), " Seconds", "000") ; << ---------------------- Extracting variables values ----------------------- ; ------------------------- Welcome TrayTip Starts ------------------------- >> If $CurSilentStatus = "Off" Then TrayTip("IP Snatcher v1.5", "Initializing ... ", 5, 17) Sleep(1000) EndIf ; Check if connected or not ..! $ZeroChk = Ping("www.google.com", 1000) ; << ------------------------ Welcome TrayTip Ends --------------------------- ; ------------------------------ If Connected ----------------------------- >> If $ZeroChk <> "0" Then If $CurSilentStatus = "Off" Then ; Current IP TrayTip Starts! $CurIP = _GetIP() TrayTip("IP Snatcher v1.5", "Current: " & $CurIP & " ", 5, 17) Sleep(2000) ; Current IP TrayTip Ends! ; Snatching Progress TrayTip Starts! TrayTip("IP Snatcher v1.5", "Snatching ... ", 5, 17) ; Snatching Progress TrayTip Ends! EndIf ; Disconnecting ..! TCPStartup() $MainSocket = TCPConnect($Gateway, $Port) Do $recv = TCPRecv($MainSocket, 2048) Until StringInStr($recv, "Username", 2) <> "0" TCPSend($MainSocket, $Username & @CRLF) Do $recv = TCPRecv($MainSocket, 2048) Until StringInStr($recv, "Password", 2) <> "0" TCPSend($MainSocket, $Password & @CRLF) Do $recv = TCPRecv($MainSocket, 2048) Until StringInStr($recv, "}=>", 2) <> "0" TCPSend($MainSocket, "ppp ifdetach" & @CRLF) Do $recv = TCPRecv($MainSocket, 2048) Until StringInStr($recv, "intf =", 2) <> "0" TCPSend($MainSocket, "Internet" & @CRLF) Do $recv = TCPRecv($MainSocket, 2048) Until StringInStr($recv, ":ppp ifdetach intf=Internet", 2) <> "0" Sleep($ReconnectionDelay) ; Connecting Again ..! Do $recv = TCPRecv($MainSocket, 2048) Until StringInStr($recv, "}=>", 2) <> "0" TCPSend($MainSocket, "ppp ifattach" & @CRLF) Do $recv = TCPRecv($MainSocket, 2048) Until StringInStr($recv, "intf =", 2) <> "0" TCPSend($MainSocket, "Internet" & @CRLF) Do $recv = TCPRecv($MainSocket, 2048) Until StringInStr($recv, ":ppp ifattach intf=Internet", 2) <> "0" TCPCloseSocket($MainSocket) TCPShutdown() If $CurSilentStatus = "Off" Then ; Cheching the Service if Running or NOT $SecondChk = Ping("www.google.com", 1000) If $SecondChk <= 0 Then Sleep($ServiceWaitTime) $SecondChk = Ping("www.google.com", 1000) EndIf ; Displaying The Result If $SecondChk <> "0" Then ; Done TrayTip Starts! $NewIP = _GetIP() TrayTip("IP Snatcher v1.5", "Snatched: " & $NewIP & " ", 5, 17) Sleep(4000) ; Done TrayTip Ends! Else ; Error TrayTip Starts! TrayTip("IP Snatcher v1.5", "No connection established ", 5, 19) Sleep(4000) ; Error TrayTipEnds! EndIf Else Exit EndIf ; ---------------------------- If NOT Connected --------------------------- >> Else If $CurSilentStatus = "Off" Then ; Current Status TrayTip Starts! TrayTip("IP Snatcher v1.3", "Current: " & "Disconnected ", 5, 17) Sleep(2000) ; Current Status TrayTip Ends! ; Snatching Progress TrayTip Starts! TrayTip("IP Snatcher v1.5", "Snatching ... ", 5, 17) ; Snatching Progress TrayTip Ends! EndIf ; Connecting ! TCPStartup() $MainSocket = TCPConnect($Gateway, $Port) Do $recv = TCPRecv($MainSocket, 2048) Until StringInStr($recv, "Username", 2) <> "0" TCPSend($MainSocket, $Username & @CRLF) Do $recv = TCPRecv($MainSocket, 2048) Until StringInStr($recv, "Password", 2) <> "0" TCPSend($MainSocket, $Password & @CRLF) Do $recv = TCPRecv($MainSocket, 2048) Until StringInStr($recv, "}=>", 2) <> "0" TCPSend($MainSocket, "ppp ifattach" & @CRLF) Do $recv = TCPRecv($MainSocket, 2048) Until StringInStr($recv, "intf =", 2) <> "0" TCPSend($MainSocket, "Internet" & @CRLF) Do $recv = TCPRecv($MainSocket, 2048) Until StringInStr($recv, ":ppp ifattach intf=Internet", 2) <> "0" TCPCloseSocket($MainSocket) TCPShutdown() ; Cheching the Service if Running or NOT $SecondChk = Ping("www.google.com", 1000) If $SecondChk <= 0 Then Sleep($ServiceWaitTime) $SecondChk = Ping("www.google.com", 1000) EndIf If $CurSilentStatus = "Off" Then ; Displaying The Result If $SecondChk <> "0" Then ; Done TrayTip Starts! $NewIP = _GetIP() TrayTip("IP Snatcher v1.5", "Snatched: " & $NewIP & " ", 5, 17) Sleep(4000) ; Done TrayTip Ends! Else ; Error TrayTip Starts! TrayTip("IP Snatcher v1.5", "No connection established ", 5, 19) Sleep(4000) ; Error TrayTipEnds! EndIf Else Exit EndIf EndIf ; << -------------------------- End of Processing ---------------------------- ExitThanks for all of you and developer of the great AutoIt Edited March 8, 2008 by drislaam Link to comment Share on other sites More sharing options...
drislaam Posted March 8, 2008 Author Share Posted March 8, 2008 (edited) By the way Here is an image for script on action Edited March 8, 2008 by drislaam Link to comment Share on other sites More sharing options...
Tomb Posted March 8, 2008 Share Posted March 8, 2008 so, what exactly does this do? Link to comment Share on other sites More sharing options...
drislaam Posted March 8, 2008 Author Share Posted March 8, 2008 I am somewhat newbie but after working around 20 hours back to back I could develop this script to grab new IP address for SpeedTouch 510 (E) Using TCP commands. [For downloading issues] Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now