Jump to content

My first Script, can u help me improve it?


Papo
 Share

Recommended Posts

Hi everyone.

I am very new to AutoIt. I discovered it when i was trying to find an automated way to reset my router (that doesn't support telnet...). This is my code but I've been getting a few minor issues with it.

Run ("C:\Program Files\Internet Explorer\iexplore.exe")
WinWaitActive("Google - Windows Internet Explorer")
MouseMove (172,36,0)
MouseClick ("left")
Send ("http://192.168.0.1")
Send ("{enter}")
WinWaitActive ("D-LINK SYSTEMS, INC | WIRELESS ROUTER | LOGIN - Windows Internet Explorer")
MouseMove (820,332,0)
MouseClick ("left")
Send ("admin")
Send ("{Tab}")
Send ("****")
Send ("{enter}")
WinWaitActive("D-LINK SYSTEMS, INC | WIRELESS ROUTER | SETUP - Windows Internet Explorer")
MouseMove (1026,246,0)
MouseClick ("left")
WinWaitActive("D-LINK SYSTEMS, INC | WIRELESS ROUTER | STATUS - Windows Internet Explorer")
MouseMove(979,574,0)
MouseClick("left")
Sleep(2000)
MouseMove(821,389,0)
MouseClick("left")
WinWaitActive("D-LINK SYSTEMS, INC | WIRELESS ROUTER | STATUS - Windows Internet Explorer")
Sleep (5000)
MouseMove (903,570,0)
MouseClick("left")
Sleep(5000)
MouseMove(841,390,0)
MouseClick("left") 
MouseMove(1662,6,0)
MouseClick("left")

This was made to reset my router every time my program finishes a download so theres no wait time for me. Movemoents are set on a widescreen 1680*1050 and I am in Windows Vista Ultimate 32 Bit.

When I leave this on over night if anything pops up it halts everything. If firefox has an update (like it did last night...) or if my anti virus starts a scan. it tends to get in the way and everything stops..

Is there a simple solution to this? Like maybe set it to load on top of any window or (sounds complicated) make it run in the background without any windows popping up? If so how can i do this?

THanks for all your help I'm really enjoying learning about this program and its abilities.

Link to comment
Share on other sites

  • Moderators

You might try your hand at the _IE functions in the help file.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Thank you SmOke for the response. It is very much appreciated.

I took another look into the help file and i found this

#include <IE.au3>
; Hide the browser window to demonstrate sending text to invisible window
_IEAction($oIE, "invisible")

This looks like what i need but i wasn't sure on a few things.

Does "_IEAction($oIE, "invisible")" need to be inputed before I run iexplorer.exe or after, or does that load it?

Also If I can get it to run "Invisible", will the script still be interupted say if a user is browsing through the computer?

Thanks again, your responses are very much appreciated.

-David

Link to comment
Share on other sites

Thank you SmOke for the response. It is very much appreciated.

I took another look into the help file and i found this

#include <IE.au3>
; Hide the browser window to demonstrate sending text to invisible window
_IEAction($oIE, "invisible")

This looks like what i need but i wasn't sure on a few things.

Does "_IEAction($oIE, "invisible")" need to be inputed before I run iexplorer.exe or after, or does that load it?

Also If I can get it to run "Invisible", will the script still be interupted say if a user is browsing through the computer?

Thanks again, your responses are very much appreciated.

-David

You would set invisible after you create the browser window. Like this...

$sURL = "http://192.168.0.1"
$oIE = _IECreate($sURL, 0, 0, 0)
_IEAction($oIE, "invisible")

The only way it would work uninterupted would be to use _IE functions in place of your mouse move coords, and send keys. For instance using Control* commands instead of send keys to login. and _IELinkClickByText instead of mouse coords to click links.

Edited by Klexen
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...