Jump to content

Interacting with IE


 Share

Recommended Posts

Hi everyone, total nubee here sadly, I have been looking at automating a data entry system we use each day, the page has a button that needs pressing etc. So I decided to use googs page as my test to setup a script that will do what I want and learn at the same time, after reading and trying for the last week or so I have sort of got it working but it has a few issues.

I want to find the browser window and the button to push, heres my code so far (very basic)

#include <GUIConstantsEx.au3>

Opt("GUIOnEventMode", 1)
$mainwindow = GUICreate("Update tool", 260, 100)
GUISetOnEvent($GUI_EVENT_CLOSE, "killit")
GUICtrlCreateLabel("Do you want to start the updating?", 30, 10)
$okbutton = GUICtrlCreateButton("Yes", 70, 50, 60)
GUICtrlSetOnEvent($okbutton, "goforit")
$cancelbutton = GUICtrlCreateButton("Cancel", 140, 50, 60)
GUICtrlSetOnEvent($cancelbutton, "killit")
GUISetState(@SW_SHOW)

While 1
  Sleep(1000)
WEnd

Func goforit()
    While 1
        Sleep(3000)
        ;ControlClick("Google - Windows Internet Explorer", "", "[class:submit; text:I'm Feeling Lucky]")
        MouseClick("left", 1000, 356)
        Sleep(3000)
        MouseClick("left", 550, 220)
    WEnd
EndFunc

Func killit()
    Exit
    EndFunc

As you can see the mouse coordinates are entered manually which means the browser MUST be the same size and position on the screen, not good, so I was trying to use controlclick but it doesn't find the window, thats the second problem, first problem is the while loop goforit() I need to stop the process when Cancel is clicked currently it doesn't stop after it has started as it cant get out of the loop.

Am I on the right track?

How do I break the loop?

How do I get controlclick to work for the above?

Thanks in advance to anyone who helps

Link to comment
Share on other sites

I'm sorry, but may you explain, what you need of "While" loop?

I have been looking at automating a data entry system we use each day, the page has a button that needs pressing etc.

If you have a one button, the loop doesn't need.

Edited by Crystall

Hello World!

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