Jump to content

Reboot Modem in IE8?


 Share

Recommended Posts

Hello all,

I am making a program that will restart my modem by doing the following steps:

1:Navigate IE8 to "192.168.0.1"

2:Clicking on the "Utilities" button

3:Clicking the "Reboot" button

4:Clicking the "OK" button

So far I've made it to step 1(

#include <IE.au3>

$IE = _IECreate("192.168.0.1")

)

for step 2 I've tried something like this:(

$Form = _IEFormElementGetObjByName($IE,"realpage")

$Utilities = _IEFormElementGetObjByName($Form,"Utilities")

$Utilities.click

)

But this just gives me an error message saying:

--> IE.au3 V2.4-0 Error from function _IEFormElementGetObjByName, $_IEStatus_InvalidObjectType

--> IE.au3 V2.4-0 Error from function _IEFormElementGetObjByName, $_IEStatus_InvalidDataType

C:\Users\Smith Family\Desktop\Adam\Programming\Autoit Projects\Test.au3 (63) : ==> Variable must be of type "Object".:

$Utilities.click

$Utilities^ ERROR

Help???

Edited by shredder2794
Link to comment
Share on other sites

If you use _IEFormElementGetObjByName then the first parameter (in your case $IE) must be a form element. At the moment you are using the browser/document element. You can use _IEGetObjByName which is not form element specific.

For a click, you can use _IEAction($obj, "click") and your code will not crash when it fails. 8) After a click, the _IE library does not assume that navigation happens. So you want to use _IELoadWait function to pause your script until page loading is complete.

As a last note, be aware that if the element you are trying to get via _IEGetObjByName is in a frame (my Linksys router uses frames) then you need to get the correct frame first via _IEFrame* (or similar), then use _IEGetObjByName on the frame object.

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...