Sign in to follow this  
Followers 0
bforrestall

Msgbox

7 posts in this topic

Hello,

I am very new to this and I want to get the return code from what button was clicked on in a message box.

What I want is a MsgBox with an OK and CANCEL button. If use clicks OK then script with proceed, if CANCEL is clicked then END.

Simple I am sure ......

Thanks!

Bill

Share this post


Link to post
Share on other sites



Hello,

I am very new to this and I want to get the return code from what button was clicked on in a message box.

What I want is a MsgBox with an OK and CANCEL button. If use clicks OK then script with proceed, if CANCEL is clicked then END.

Simple I am sure ......

Thanks!

Bill

Hi,

maybe this is a simple example.

$return = MsgBox(1, "Choose", "OK or cancel")
If $return = 1 Then
    MsgBox(0, "", "ok")
ElseIf $return = 2 Then
    MsgBox(0, "", "Cancel")
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

Hello,

I am very new to this and I want to get the return code from what button was clicked on in a message box.

What I want is a MsgBox with an OK and CANCEL button. If use clicks OK then script with proceed, if CANCEL is clicked then END.

Simple I am sure ......

Thanks!

Bill

First you have to assign a variable to the msgbox then check that variable afterwards.

$MsgBox = MsgBox(1, "Test", "Test")

Switch $MsgBox
    Case 1
        MsgBox(0, "Response", "You clicked 'OK'.")
    Case 2
        MsgBox(0, "Response", "You clicked 'Cancel'.")
EndSwitch

Share this post


Link to post
Share on other sites

#Region --- CodeWizard generated code Start ---
;MsgBox features: Title=Yes, Text=Yes, Buttons=OK and Cancel, Icon=Question
If Not IsDeclared("iMsgBoxAnswer") Then Dim $iMsgBoxAnswer
$iMsgBoxAnswer = MsgBox(33,"Message Box Test","This is a test")
Select
   Case $iMsgBoxAnswer = 1;OK

   Case $iMsgBoxAnswer = 2;Cancel

EndSelect
#EndRegion --- CodeWizard generated code End ---


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

#5 ·  Posted (edited)

From the help file

Button......Return

Pressed....Value

OK-----------1

CANCEL-----2

ABORT------3

RETRY-------4

IGNORE-----5

YES----------6

NO-----------7

TRY AGAIN-10

CONTINUE--11

Edited by BigDod


Get Beta versions Here Get latest SciTE editor Here AutoIt 1-2-3 by Valuater - A great starting point.

Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Share this post


Link to post
Share on other sites

If MsgBox(1, 'title', 'Select OK to proceed') = 2 Then Exit

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

A Question, if I use : MsgBox(3,

$msgbox_ = MsgBox(3, "codename48", "File Exists. OVERVRITE?")

Then none of the examples hire work..because...?

yes I need 3 buttons. ( OK, NO, Append )

Edited by goldenix

My Projects:[list][*]Guide - ytube step by step tut for reading memory with autoitscript + samples[*]WinHide - tool to show hide windows, Skinned With GDI+[*]Virtualdub batch job list maker - Batch Process all files with same settings[*]Exp calc - Exp calculator for online games[*]Automated Microsoft SQL Server 2000 installer[*]Image sorter helper for IrfanView - 1 click opens img & move ur mouse to close opened img[/list]

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