Biskup Posted November 16, 2007 Share Posted November 16, 2007 Hi !I need a program that will automaticaly connect via IE to my router. First of all I must say that I've searched this forum and some other, but still i haven't found what i was looking for. :"> What did I only found is that code:CODE#include <IE.au3>$USERNAME = 'username'$PASSWORD = 'password'$oIE = _IECreate ("192.168.1.1",0,1,1)$oForm = _IEFormGetCollection ($oIE, 0)$oLogin = _IEFormElementGetObjByName($oForm, "login")$oPass = _IEFormElementGetObjByName($oForm,"passwd")_IEFormElementGetObjByName($oLogin,"login")_IEFormElementGetObjByName($oPass,"passwd")_IEFormElementSetValue($oLogin,$USERNAME)_IEFormElementSetValue($oPass,$PASSWORD)_IEFormSubmit($oForm)Unfortunatly it isn't working... I supouse there're some mistakes about object names. I've been tying to catch that names, ( with DebugBar), but when that login form shows up, IE stops. I've made screen shot of it:http://img138.imageshack.us/img138/3200/ierouterlogindv9.jpgPlease advise. Thank you, Biskup Link to comment Share on other sites More sharing options...
PsaltyDS Posted November 16, 2007 Share Posted November 16, 2007 Hi !I need a program that will automaticaly connect via IE to my router. First of all I must say that I've searched this forum and some other, but still i haven't found what i was looking for. :"> What did I only found is that code:Unfortunatly it isn't working... I supouse there're some mistakes about object names. I've been tying to catch that names, ( with DebugBar), but when that login form shows up, IE stops. I've made screen shot of it:http://img138.imageshack.us/img138/3200/ierouterlogindv9.jpgPlease advise. Thank you, BiskupThat login pop up may not be an IE window at all, just an ordinary Windows dialog box. Check it with AU3Info.exe and see. If so, ordinary Win* and Control* functions should take care of it. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
Nevin Posted November 16, 2007 Share Posted November 16, 2007 Yep, I'd suggest what he says. WinActivate("*Silly polish letters here*") then use controlsend to enter the username, password, etc. If you use the AutoIt Window info tool, it will give you information for the controls Link to comment Share on other sites More sharing options...
DaleHohm Posted November 16, 2007 Share Posted November 16, 2007 Just be aware that when this box appears, your script may have lost control until the login box is processed. If this is the case, you may need to find another way to activate the link or button or whatever caused the login to appear. If this is the case, see the 2nd example in the helpfile for _IEAction. Dale Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model Automate input type=file (Related) Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better? IE.au3 issues with Vista - Workarounds SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead? Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble Link to comment Share on other sites More sharing options...
Biskup Posted November 16, 2007 Author Share Posted November 16, 2007 Big thanks guys. But what should i do next? I'm trying to work it out with yours hints and i'm stuck again look: #include <IE.au3> $oIE = _IECreate ("192.168.1.1",0,1,1) ;this is for login WinActivate("Połącz z 192.168.1.1", "") ControlSend("Połącz z 192.168.1.1", "", "Edit2", "Admin") i'm probably making smth stupid, please correct me. Thank you for your patience. Biskup Link to comment Share on other sites More sharing options...
DaleHohm Posted November 16, 2007 Share Posted November 16, 2007 You probably want WinWaitActive instead of WinActivate Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model Automate input type=file (Related) Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better? IE.au3 issues with Vista - Workarounds SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead? Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble Link to comment Share on other sites More sharing options...
Biskup Posted November 16, 2007 Author Share Posted November 16, 2007 (edited) OK, that's good now... But, how about pressing OK button? #include <IE.au3> $oIE = _IECreate ("192.168.1.1",0,1,1) WinWaitActive("Połącz z 192.168.1.1", "") ControlSend("Połącz z 192.168.1.1", "", "Edit2", "admin") WinWaitActive("Połącz z 192.168.1.1", "") ControlSend("Połącz z 192.168.1.1", "", "Edit3", "password") Edited November 16, 2007 by Biskup Link to comment Share on other sites More sharing options...
Nahuel Posted November 16, 2007 Share Posted November 16, 2007 ControlClick("Połącz z 192.168.1.1", "", "Classname or control ID") use autoit Window Info Tool to get the classname or control ID of the button. Link to comment Share on other sites More sharing options...
Biskup Posted November 16, 2007 Author Share Posted November 16, 2007 Thank you ! it works ! but i've got one more question. When I run that script, "Admin" field is blank, and nothing is working... But when I run it again ( and the old script is still in task bar ) it works. Wired.. for me.. why? Biskup Link to comment Share on other sites More sharing options...
Nahuel Posted November 16, 2007 Share Posted November 16, 2007 I don't know. Don't run it twice then Link to comment Share on other sites More sharing options...
Biskup Posted November 16, 2007 Author Share Posted November 16, 2007 hehe but it works fine when i run it twice ! when i run it once it's useless.. thanks once again for help ! Link to comment Share on other sites More sharing options...
Nahuel Posted November 16, 2007 Share Posted November 16, 2007 It's weird... try replacing this: WinWaitActive("Połącz z 192.168.1.1", "") With this: Do Sleep(100) Until WinExists("Polacz z 192.168.1.1") I suppose the problem is that the first script pauses because the window doesn't have focus...? I don't know, but try. Link to comment Share on other sites More sharing options...
Biskup Posted November 16, 2007 Author Share Posted November 16, 2007 unfortunatly still the same problem.. the code: CODE #include <IE.au3> $oIE = _IECreate ("http://192.168.1.1/setup.cgi?todo=debug",0,1,1) Sleep(2000) Do Sleep(100) Until WinExists("Połącz z 192.168.1.1") ControlSend("Połącz z 192.168.1.1", "", "Edit2", "admin") Do Sleep(100) Until WinExists("Połącz z 192.168.1.1") ControlSend("Połącz z 192.168.1.1", "", "Edit3", "pasw") ControlClick("Połącz z 192.168.1.1", "", "Button2") Sleep(5000) Run("telnet 192.168.1.1") WinWait("telnet", "", 2) Send("reboot {ENTER}") it works, but it not closing IE window after all, but im hardly working on it And, it must be run twice.. Biskup Link to comment Share on other sites More sharing options...
Biskup Posted November 17, 2007 Author Share Posted November 17, 2007 Sorry for posting one after one but I need your help one more time. 1. As I said before, running program twice. It's very unreliable and unstable... it often corrupts. Any solution? 2. I can't close TELNET window after all... When I send "reboot" via telnet, the whole connections is corrupt, and i can't close TELNET window... but when i click once LMB it close imidiatly. Any solution for this? CODE: CODE #include <IE.au3> $oIE = _IECreate ("http://192.168.1.1/setup.cgi?todo=debug",0,1,1) Sleep(2000) Do Sleep(100) Until WinExists("Połącz z 192.168.1.1") ControlSend("Połącz z 192.168.1.1", "", "Edit2", "admin") Do Sleep(100) Until WinExists("Połącz z 192.168.1.1") ControlSend("Połącz z 192.168.1.1", "", "Edit3", "pasw") ControlClick("Połącz z 192.168.1.1", "", "Button2") Sleep(500) _IEQuit ($oIE) Sleep(700) Run("telnet 192.168.1.1") WinWait("telnet 192.168.1.1", "", 2) Send("reboot {ENTER}") Sleep(100) WinKill("telnet 192.168.1.1", "") I'd gratefull for any solution ! thanks, Biskup Link to comment Share on other sites More sharing options...
DaleHohm Posted November 17, 2007 Share Posted November 17, 2007 This looks like pretty reasonable code- although I'd be worried about using _IEQuit before the login got processed. I think I'd try an _IELoadwait before the _IEQuit. Can you summarize what is happening again please? Dale Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model Automate input type=file (Related) Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better? IE.au3 issues with Vista - Workarounds SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead? Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble Link to comment Share on other sites More sharing options...
Biskup Posted November 18, 2007 Author Share Posted November 18, 2007 I think I'd try an _IELoadwait before the _IEQuit.Thx Dale... but I'm affraid it is not working. IE does not shut down.. Can you summarize what is happening again please?Sure. 1. I need run this program twice, to make it working: - when I run it; IE is open, the page is load, but that dialog box is still blank. So i'm clicking cancel and i'm closing IE. Program is still running in task bar. - I'm running it again; IE is open, page is load, dialog box is filled, telnet is connected, router is rebooting, BUT: IE doesn't shut down, neither telnet.it's very annoying that i have to run it twice, and also very unstable and unreliable for me. Biskup Link to comment Share on other sites More sharing options...
DaleHohm Posted November 18, 2007 Share Posted November 18, 2007 I would like a more complete summary please. I don't want to have to study all 15 previous replies to understand what is happening. Please start from the beginning and include your current code and screen shots, a description of what happens, what you expect to happen and any theories you have about what is going wrong. Thanks, Dale Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model Automate input type=file (Related) Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better? IE.au3 issues with Vista - Workarounds SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead? Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble Link to comment Share on other sites More sharing options...
Biskup Posted November 19, 2007 Author Share Posted November 19, 2007 Complete summary: I. IdeaProgram is connecting via IE to my wireless router, log in there, enable DEBUG MODE. Next open TELNET, connect to router and reboot it.Here is that LOGIN DIALOG BOX -> Dialog BoxII. Troubles 1. Program doesn't close IE and TELNET after all.2. Program doesn't work when it's run ONCE: - when I run it; IE is open, the page is load, but that dialog box is still blank. So i'm clicking cancel and i'm closing IE. Program is still running in task bar. - I'm running it again; IE is open, page is load, dialog box is filled, telnet is connected, router is rebooting, BUT: IE doesn't shut down, neither telnet. III. SolutionsI have no idea. IV. CodeCODE#include <IE.au3>$oIE = _IECreate ("http://192.168.1.1/setup.cgi?todo=debug",0,1,1)Sleep(2000)Do Sleep(100)Until WinExists("Połącz z 192.168.1.1")ControlSend("Połącz z 192.168.1.1", "", "Edit2", "admin")Do Sleep(100)Until WinExists("Połącz z 192.168.1.1")ControlSend("Połącz z 192.168.1.1", "", "Edit3", "pasw")ControlClick("Połącz z 192.168.1.1", "", "Button2")Sleep(500)_IELoadWait ($oIE)_IEQuit ($oIE)Sleep(700)Run("telnet 192.168.1.1")WinWait("telnet 192.168.1.1", "", 2)Send("reboot {ENTER}")Sleep(100)WinKill("telnet 192.168.1.1", "")I suppose that's all... I'd be gratefull for any solutions. Thank you, Biskup. Link to comment Share on other sites More sharing options...
DaleHohm Posted November 19, 2007 Share Posted November 19, 2007 OK, my guess is that you are having timing issues. Please try this code that will allow you to decide when to move to the next step: #include <IE.au3> $oIE = _IECreate("http://192.168.1.1/setup.cgi?todo=debug", 0, 1, 1) MsgBox(0, "Wait", "Press OK when ready...") ControlSend("Polacz z 192.168.1.1", "", "Edit2", "admin") ControlSend("Polacz z 192.168.1.1", "", "Edit3", "pasw") ControlClick("Polacz z 192.168.1.1", "", "Button2") Sleep(500) _IELoadWait($oIE) _IEQuit($oIE) Run("telnet 192.168.1.1") WinWait("telnet 192.168.1.1", "", 2) Send("reboot {ENTER}") MsgBox(0, "Wait", "Press OK when ready...") WinKill("telnet 192.168.1.1", "") What is the purpose of logging into the webpage if you are just turning around and Quiting it immediately? BTW, this has very little to do with IE and much more to do with standard Win32 interaction... Dale Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model Automate input type=file (Related) Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better? IE.au3 issues with Vista - Workarounds SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead? Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble Link to comment Share on other sites More sharing options...
Biskup Posted November 19, 2007 Author Share Posted November 19, 2007 Still doesn't working. IE's open, but LOGIN & PASW are still empty. #include <IE.au3> $oIE = _IECreate("http://192.168.1.1/setup.cgi?todo=debug", 0, 1, 1) ; here must be smth wrong, I think. MsgBox(0, "Wait", "Press OK when ready...") This's strange... What is the purpose of logging into the webpage if you are just turning around and Quiting it immediately? That link activate DEBUG MODE which is nesesery to connect to router via telnet, to reboot it. There's no other way to connect to this router via telnet or other program. thx, Biskup 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