Sign in to follow this  
Followers 0
endy

How can I link a command to MsgBox return value?

8 posts in this topic

Hi, everybody! I think I am the most junior user of the AutoIt. Though have not fully familiarized yet, I have really liked its idea. Well, I started using AutoIt just yesterday, and already became fond of it!

Well, here is my question. Could anybody advise me on how to write a script for the MsgBox return value operation. That is, if "yes" (or "cancel") button is pressed on the message box, then how to make a certain command to be exectuted. Sorry for bothering with this really basic question.

My great thanks for the developers of this excellent pro!

Looking forward for your advice.

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

just put what you want to do in the case depending on the return

#Region --- CodeWizard generated code Start ---
;MsgBox features: Title=Yes, Text=Yes, Buttons=Yes and No, Icon=Question
If Not IsDeclared("iMsgBoxAnswer") Then Dim $iMsgBoxAnswer
$iMsgBoxAnswer = MsgBox(36,"Test Message Box","This is a test of the return value")
Select
   Case $iMsgBoxAnswer = 6;Yes

   Case $iMsgBoxAnswer = 7;No

EndSelect
#EndRegion --- CodeWizard generated code End ---
Edited by gafrost

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

HI,

another simple example would be

$var = MsgBox(1, "Example", "Press a button :-)")

If $var = 1 Then
    MsgBox(0, "OK", "You pressed OK!", 3)
ElseIf $var = 2 Then
    MsgBox(0, "Cancel", "You pressed Cancel!", 3)
EndIf

So long,

Mega


Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
Share on other sites

you can also check the return values, in the helpfile under Msgbox().


[size=20]My File Upload[/size]Register at my site and upload.

Share this post


Link to post
Share on other sites

Dear friends, thanks a lot! I have successfully adopted your advices! AutoIt works great!

By the way, I was thinking to automate some operations related to internet browsing, downloading, etc (I use Internet Explorer). Could you advise if there any info or manual I could refer to?

Thanks again!

All the best!

Share this post


Link to post
Share on other sites

if using beta do a search for Inet.au3 (in this forum) all sorts of functions are available

phil

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

if using beta do a search for Inet.au3 (in this forum) all sorts of functions are available

phil

Hi,

or search for IE.au3. --> http://www.autoitscript.com/forum/index.ph...pe=post&id=3370

So long,

Mega

Edited by th.meger

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
Share on other sites

Thanks a lot! This is extremely helpful!

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