Jump to content

Recommended Posts

Posted

Hi,

I've got the following Msgbox:

MsgBox(4, "Beginning SAP 7.20 upgrade...", "Please wait, starting SAP 7.20 upgrade.")

I put the flag 4 (see http://www.autoitscript.com/autoit3/docs/functions/MsgBox.htm for reference) with the expectation that clicking "Yes" would proceed, and "Non" would cancel or close. I've also tried this with flag 1.

The problem I have is that regardless of which button is pressed, they all just proceed on to the next step, as though I had clicked "Yes". Why is this? Is my syntax wrong or am I expecting too much from this function?

Thanks for any insight!

Posted (edited)

Try this & then have a look at the Return Values in the Help File under Msgbox() >>

Global $iReturn

$iReturn = MsgBox(4, "Beginning SAP 7.20 upgrade...", "Please wait, starting SAP 7.20 upgrade.")
If $iReturn = 6 Then ; Yes was selected.
    MsgBox(64, "MsgBox()", "Yes was selected!")
EndIf
Edited by guinness

UDF List:

  Reveal hidden contents

Updated: 22/04/2018

Posted

There is a part missing from your script: the part handling different answers from your message box.

Whenever you need such a msgBox, you'll be better using the "Code Wizard" from SciTE/Tools.

A proper code (generated by above mentioned app) will be like this:

#Region --- CodeWizard generated code Start ---
;MsgBox features: Title=Yes, Text=Yes, Buttons=Yes and No, Icon=None
If Not IsDeclared("iMsgBoxAnswer") Then Local $iMsgBoxAnswer
$iMsgBoxAnswer = MsgBox(4,"My Title","My Text")
Select
    Case $iMsgBoxAnswer = 6 ;Yes

    Case $iMsgBoxAnswer = 7 ;No

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

Just fill in the action needed for each answer.

SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

Posted

  On 7/27/2011 at 12:10 AM, 'guinness said:

Try this & then have a look at the Return Values in the Help File under Msgbox() >>

$iReturn = MsgBox(4, "Beginning SAP 7.20 upgrade...", "Please wait, starting SAP 7.20 upgrade.")
If $iReturn = 6 Then ; Yes was selected.
    MsgBox(64, "MsgBox()", "Yes was selected!")
EndIf

Got it! Thank you so much - you explained it perfectly, and I was able to understand the documentation after seeing your code. Thanks for the quick response and help!

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...