Jump to content

A message box (#32770) that doesnt always display


Recommended Posts

Hey guys quick question, im loving autoit so far learning lots and suprisingly excelled at it considering i have no experience in it at all. There is one thing i need some help on though, sometimes i process that is run displays a prompt box if a condition is met by the process, but a condition isn' always met by the process so the prompt box is not always displayed. I just wondered whats the best way for me to interact with the box if it appears if not carry on with the rest of the autoit script, is it a loop of somesort? Any help would be greatyl appreciated peeps! :-)

Edited by simpleraison
Link to comment
Share on other sites

Hi simpleraison,

Do you mead sth. like

If $condition = 1 Then 
   MsgBox()
EndIf

Regards,

Hannes

:graduated:

This is the code i am using to currently:

WinWaitActive("[CLASS:#32770]", "", 1000000000000000000000000000)
ControlClick("", '', 'OK')

So at the moment the code waits for the box to appear/active and then it clicks ok and moves on to the rest of the process. How do i encapsulate this with the code you provided?, so that this is only executed if the box appears and if it does not it just carries on, because as i said the box doesn't always appear only sometimes depending on the data.

Link to comment
Share on other sites

This is the code i am using to currently:

WinWaitActive("[CLASS:#32770]", "", 1000000000000000000000000000)
ControlClick("", '', 'OK')

So at the moment the code waits for the box to appear/active and then it clicks ok and moves on to the rest of the process. How do i encapsulate this with the code you provided?, so that this is only executed if the box appears and if it does not it just carries on, because as i said the box doesn't always appear only sometimes depending on the data.

Any input on this peeps?
Link to comment
Share on other sites

If WinExists("your title") Then
   ;your code
Endif
;your other code

Thanks for this i think that it will work a treat, im just adding it to the code now! Dude how do i add a time into that for the script to wait before going into the then statement? I only want about 15 seconds as i know that box doesnt take that long to come up?
Link to comment
Share on other sites

Thanks for this i think that it will work a treat, im just adding it to the code now! Dude how do i add a time into that for the script to wait before going into the then statement? I only want about 15 seconds as i know that box doesnt take that long to come up?

Ok just added it like this:

If WinWaitActive("[CLASS:#32770]", "", 10) then
ControlClick("", '', 'OK')
Endif

So used WinWaitActive instead of WinExists! Does that look right John?

Link to comment
Share on other sites

Its as easy to test as it is to answer.

Get into the habit of testing your code.

Yeah i know i know its just the process take about 10 minutes to get to that perticular part of the process hence the reason i asked! I'll run it and see what happens! thanks alot anyway as i know that has sent me on the right path!

Link to comment
Share on other sites

Its as easy to test as it is to answer.

Get into the habit of testing your code.

Oh and i just changed it back to WinExists as its probably better then WinWaitActive as that will be waiting for the window to become active and thats not always the case! I hope im right!

Link to comment
Share on other sites

Just make a little script to run alongside and use as your test window, its no big headache.

sleep(8000)

guicreate("GUI")
guisetstate()
while 1
     Sleep(10)
wend

put and exit function in it.

Or simply use a notepad window or something.

Edited by JohnOne

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

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