Jump to content

Moving to part of an Internet Explorer page


Jarv
 Share

Recommended Posts

Hi,

this is my first project using this tool and wondered if someone could help or point me in the correct direction?

Basically I am trying to automate a setting on a NetGear router which uses a web interface. I have managed to get logged in to it using the following -

run ("c:\program files\internet explorer\iexplore.exe http://192.168.0.1")

winwait ("Connect to 192.168.0.1")

send ("admin")

send ("{tab}")

send ("MYPASSWORD")

send ("{enter}")

However I am having a bit of fun with the next bit and may be going the wrong way about it. What I am trying to get to is an option down the left hand side called "Remote Management". Now I know I can get to this by pressing {tab} 25 times.. So I do this after a -

winwait ("NETGEAR Router - Microsoft Internet Explorer")

winactivate ("NETGEAR Router - Microsoft Internet Explorer")

and then send 25 tabs!

However it must be a timing issue because a different number of tabs actually get sent.

Anyway apart from that is there a better way of doing this? Can you somehow search for the etxt "Remote Management" to get to it?

thanks for your help!

Link to comment
Share on other sites

Hi,

this is my first project using this tool and wondered if someone could help or point me in the correct direction?

Basically I am trying to automate a setting on a NetGear router which uses a web interface. I have managed to get logged in to it using the following -

run ("c:\program files\internet explorer\iexplore.exe http://192.168.0.1")

winwait ("Connect to 192.168.0.1")

send ("admin")

send ("{tab}")

send ("MYPASSWORD")

send ("{enter}")

However I am having a bit of fun with the next bit and may be going the wrong way about it. What I am trying to get to is an option down the left hand side called "Remote Management". Now I know I can get to this by pressing {tab} 25 times.. So I do this after a -

winwait ("NETGEAR Router - Microsoft Internet Explorer")

winactivate ("NETGEAR Router - Microsoft Internet Explorer")

and then send 25 tabs!

However it must be a timing issue because a different number of tabs actually get sent.

Anyway apart from that is there a better way of doing this? Can you somehow search for the etxt "Remote Management" to get to it?

thanks for your help!

You can take this with a grain of salt; I am no expert with autoit.

However, I have found that a lot of times you have to pause with the sleep() command between tab sends. I think autoit sends the tab characters faster than IE responds to them and they get lost. Something like

$iSleep = 100

Send("{TAB}")

Sleep($iSleep)

Send("{TAB}")

Send($iSleep)

etc...

You can change the $iSleep constant to increase or decrase the pause time.

Also, sometimes you can get there quicker going backwards (with a shift-Tab) than by going forward.

I hope this helps.

rp

Link to comment
Share on other sites

Hi,

this is my first project using this tool and wondered if someone could help or point me in the correct direction?

Basically I am trying to automate a setting on a NetGear router which uses a web interface. I have managed to get logged in to it using the following -

run ("c:\program files\internet explorer\iexplore.exe http://192.168.0.1")

winwait ("Connect to 192.168.0.1")

send ("admin")

send ("{tab}")

send ("MYPASSWORD")

send ("{enter}")

However I am having a bit of fun with the next bit and may be going the wrong way about it. What I am trying to get to is an option down the left hand side called "Remote Management". Now I know I can get to this by pressing {tab} 25 times.. So I do this after a -

winwait ("NETGEAR Router - Microsoft Internet Explorer")

winactivate ("NETGEAR Router - Microsoft Internet Explorer")

and then send 25 tabs!

However it must be a timing issue because a different number of tabs actually get sent.

Anyway apart from that is there a better way of doing this? Can you somehow search for the etxt "Remote Management" to get to it?

thanks for your help!

Look at the various _IE* functions of the IE.au3 UDF in the help file.

You can apply values directly to input tags, for example, with _IEFormElementSetValue().

>_<

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

You can take this with a grain of salt; I am no expert with autoit.

However, I have found that a lot of times you have to pause with the sleep() command between tab sends. I think autoit sends the tab characters faster than IE responds to them and they get lost. Something like

rp

Hi, just to let you know the sleeps made all the difference.. I am just going to have a read through the help files to see if some of the IE functions will work better. Problem I have is on one version of the router the number of TABS is slightly different..

thanks

Link to comment
Share on other sites

Something to look at... how many tabs is it if you go backwards sometimes it is shorter... Also with a code of

Send("{tab 25}")
Can be faster than
Send("{tab}")
Sleep(500)
Send("{tab}")
Sleep(500)
Send("{tab}")

and if the router varies then there must be a way of knowing this. If you can determine what router it is than something like

If $router = 1 then
$tab_count = 25
else
$tab_count = 22
endif
send("{tab " & $tab_count & "}")
Link to comment
Share on other sites

and if the router varies then there must be a way of knowing this. If you can determine what router it is than something like

If $router = 1 then
$tab_count = 25
else
$tab_count = 22
endif
send("{tab " & $tab_count & "}")

I should have thought of this.. I was thinking there was no way of working out which model of router it is.. However I just noticed when the initial login dialogue box comes up it has a title bar of "Connecting to 192.168.0.1" whichever model it is. However in the dialog text it does say the model - for instance "NETGEAR DG834G". I ran AU3INFO.EXE and this does show as text.. I havent fully looked in the help yet but I presuming I could set a variable based on this text?

Thanks for all the help

Link to comment
Share on other sites

I should have thought of this.. I was thinking there was no way of working out which model of router it is.. However I just noticed when the initial login dialogue box comes up it has a title bar of "Connecting to 192.168.0.1" whichever model it is. However in the dialog text it does say the model - for instance "NETGEAR DG834G". I ran AU3INFO.EXE and this does show as text.. I havent fully looked in the help yet but I presuming I could set a variable based on this text?

Thanks for all the help

Seem to have sussed a bit of this myself.. However I can have 3 or 4 models of router.. I have just created a basic script that justs puts a message box up. I am guessing without "goto" I should put the rest of my script within this somehow?

run ("c:\program files\internet explorer\iexplore.exe http://192.168.0.1")

winwait ("Connect to 192.168.0.1")

If WinExists("Connect to 192.168.0.1", "NETGEAR DG834G") Then

MsgBox(0, "", "This is a DG834G")

ElseIf WinExists("Connect to 192.168.0.1", "NETGEAR DG834PN ") Then

Msgox(0, "", "This is a DG834PN")

EndIf

So where the Msgox box is (and I will have a couple more) should I write all my script?

Link to comment
Share on other sites

Jarv,

I would recommend looking at the IE functions as well. You can also usually "find" text on a page, and then "tab" to the nearest field from there. (Old trick) That may negate your need to have options for multiple routers. The IE functions may also help negate your need for too many options.

Hope to help,

Jarvis

P.S. Your screen name...I get call Jarv at times mostly when I was younger, but still by a couple of friends that knew me back then. How'd you come up with it? (your screenname)

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Link to comment
Share on other sites

Jarv,

I would recommend looking at the IE functions as well. You can also usually "find" text on a page, and then "tab" to the nearest field from there. (Old trick) That may negate your need to have options for multiple routers. The IE functions may also help negate your need for too many options.

Hope to help,

Jarvis

P.S. Your screen name...I get call Jarv at times mostly when I was younger, but still by a couple of friends that knew me back then. How'd you come up with it? (your screenname)

Just shows the different ways to skin a cat.. Having done all of this work tabbing down to different pages in the framed based layout I was just looking at the methods of using IE and just happened to right click on one of the options. Quite why I was thinking it was so complex I dont know but of course each page just had an address also. So instead of having to tab (*25) to the remote management option I just open Internet Explorer with http://192.168.0.1/remotemg.htm

remotemg.htm is also standard across the different routers so I dont even think I need to check the model!..

I wonder if someone could still point me to the best way of finding some text now in a IE page - I would like to know for future reference..

Also when using If, then, else I would just like to know how this should be coded. Ie. there are no gotos so do you do all of the coding in between each if, then etc? Or can you "go" to another section to do this coding?

Second to final question .. I now need to flick to a second page (http://192.168.0.1/s_status.htm). I could close IE and open it again with this address. However I think I can use _IENavigate but this dosent seem to work.

I am just using _IENaviagte (http://192.168.0.1/s_status.htm)

PS - Jarvis. Jarv derives from my mothers surname which was made part of my whole name. It is the name everyone calls me from childhood and still does - in fact most people dont know by real name and just call me this!..

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...