m16318

How to get a return (@error) value from _IEGetObjById ?

3 posts in this topic

Hi to all,

I am having a small issue where I can't get an error return from _IEGetObjById.

In short, my code is searching for the button (links) on the website.

When it clicks on all buttons I need to get an error value so I can close do/until.

My code/solution looks like this;

Do

                $o_click = _IEGetObjById($oIE,"ctl01_WithdrawButton")
                Sleep(1000)

                _IEAction($o_click,"click")
                Sleep(1000)



                MouseClick("Left",448,333)
                Sleep(500)
                Send($sendMessage)

                $o_click1 = _IEGetObjById($oIE,"RequestCommentsPopup_popupButton_1")
                Sleep(1000)

                _IEAction($o_click1,"click")
                Sleep(1000)


                $o_click3 = _IEGetObjById($oIE,"IncidentWithdrawnInfo_popupButton_0")
                Sleep(1000)

                _IEAction($o_click3,"click")
                Sleep(1000)


            Until(_IEGetObjById <> "ctl01_WithdrawButton")

            MsgBox(0,"","Nothing left to click")

This is working, however, the webpage throws some unexpected error at the end which I am trying to avoid.

So I need something like Until(_IEGetObjById = @error) 

Thanks!

Share this post


Link to post
Share on other sites



You have a do loop.  The until could be used to stop it (assuming you are sure you would get an error).  If it does not error it would be an infinite loop.

Do 
; do stuff
Until @ error <> 0

For that reason, a better way may be to have something inside the loop that looks for errors at each stage

If @error <> 0 then 
; do stuff
Endif

 


Build your own poker game with AutoIt: pokerlogic.au3 | Learn To Program Using FREE Tools with AutoIt

Share this post


Link to post
Share on other sites

Thanks, I will try that :)

Share this post


Link to post
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