Jump to content

How can I link a command to MsgBox return value?


endy
 Share

Recommended Posts

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.

Link to comment
Share on other sites

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.

 

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

Link to comment
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!

Link to comment
Share on other sites

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

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