Sign in to follow this  
Followers 0
closeupman

Msgbox

8 posts in this topic

I'm trying to react to a message box, so I can auto close it if the user doesn't do it after a set time period. But i'm unable to get to it. I've tried both send and controlclick.

Code Snippet:

if not (@error=0) then

;either cancel was clicked, so exit script

;since user too lazy to find browser

;or some other error, so just exit

msgbox(0,"Exiting","Unable to continue, This program will automatically end in 4 seconds(or you can press OK now).")

sleep(4000)

ControlClick("Exiting","","Button1")

;Send("{SPACE}")

exit

endif

Here is what I got from AutoItSpy:

( classname=#32770 )

Class: Button1

Text: OK

Thanks,

David :idiot:

Share this post


Link to post
Share on other sites

msgbox(0,"Exiting","Unable to continue, This program will automatically end in 4 seconds(or you can press OK now).", 20)

Set to close in 20 seconds by extra parameter.

Is this what you wanted?

Share this post


Link to post
Share on other sites

msgbox(0,"Exiting","Unable to continue, This program will automatically end in 4 seconds(or you can press OK now).", 20)

Set to close in 20 seconds by extra parameter.

Is this what you wanted?

<{POST_SNAPBACK}>

Yes, thanks. I think too complicated sometimes.

However, my trying to control it(with send or control click) brought a point up. Is it not considered a window by autoit?

Share this post


Link to post
Share on other sites

It is considered a window. But while a dialog is open the script pauses.

Share this post


Link to post
Share on other sites

It is considered a window. But while a dialog is open the script pauses.

<{POST_SNAPBACK}>

thanks for the info Sugi

Share this post


Link to post
Share on other sites

Make a GUI with the new unstable release, you can control that... (script doesn't pause)


Offering any help to anyone (to my capabilities of course)Want to say thanks? Click here! [quote name='Albert Einstein']Only two things are infinite, the universe and human stupidity, and I'm not sure about the former.[/quote][quote name='Wolvereness' date='7:35PM Central, Jan 11, 2005']I'm NEVER wrong, I call it something else[/quote]

Share this post


Link to post
Share on other sites

Make a GUI with the new unstable release, you can control that... (script doesn't pause)

<{POST_SNAPBACK}>

ok, thanks Wolvereness.

I was just making an auto-email check script.

I was bringing up a msgbox in case the browserpath to the internet browser wasn't found. If user clicked cancel I brought up a msgbox saying as above(re:code snippet).

Once, I get more familiar w/Autoit I will. I wanted to use AutoIt to do training demos and/or interactive, but seems like there's no way to get where the shortcut on the windows menu would be (e.g. start, programs, word) how would i know where to click the mouse, since it can be at different places on different computers. I think I'll have to stick w/Director for the demo's and anything that needs to be generalized for any computer.

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

Try this (return value of msgbox combined with cancel box)

While 1
   $x = 1;- Some stuff leading to 'blah'
   If $x = 1 Then
      If MsgBox(5 + 48 + 256 + 4096 + 262144, 'title', 'remark') = 2 Then
         Exit
      Else
         ContinueLoop
      EndIf
   EndIf
WEnd
-Don't forget even msgbox has a return value

Some VERY GOOD ADVICE:

Next time just say EXACTLY what your doing, then say what you want. People might be able to do it in a completely different but better way.

Also: I didn't understand that first snippet, try using the ""

Edited by Wolvereness

Offering any help to anyone (to my capabilities of course)Want to say thanks? Click here! [quote name='Albert Einstein']Only two things are infinite, the universe and human stupidity, and I'm not sure about the former.[/quote][quote name='Wolvereness' date='7:35PM Central, Jan 11, 2005']I'm NEVER wrong, I call it something else[/quote]

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
Sign in to follow this  
Followers 0