Sign in to follow this  
Followers 0
cad29

msgbox please help

13 posts in this topic

Hi i need help with my little program what i what i do is i have a msgbox when he click yes it should display you click yes and if they click no it should display you click no

Program that i have is

#include <GUIConstants.au3>

msgbox(4,"Please click yes or no","Please click yes or no")

but the problem is i dont know how to continue thanks for the help in adavanced

Share this post


Link to post
Share on other sites



$msg = msgbox(4,"Please click yes or no","Please click yes or no")
If  $msg = 6 Then
    MsgBox(0,"", "You answered yes")
Else
    MsgBox(0,"", "You answered no")
EndIf



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

Thanks Bigdod it work your the man

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Another version

$msg = msgbox(4,"Please click yes or no","Please click yes or no")
If  $msg = 6 Then
    MsgBox(0,"", "You answered yes")
ElseIf $msg = 7 Then
    MsgBox(0,"", "You answered no")
EndIf

Incase there are more than 2 buttons.

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

Or even:

Switch MsgBox(4,"Please click yes or no","Please click yes or no")
    Case 6
        MsgBox(0,"", "You answered yes")
    Case 7
        MsgBox(0,"", "You answered no")
EndSwitch


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

Is there anyway to change the location of the message box?because it is being default into the center can i change it to be on the top most?thanks a lot

Share this post


Link to post
Share on other sites

Is there anyway to change the location of the message box?because it is being default into the center can i change it to be on the top most?thanks a lot

Instructions in the helpfile show you how to make it topmost.

The moving issue ... there are a couple of work around UDF's in the Scripts and Scraps forum.


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

Instructions in the helpfile show you how to make it topmost.

The moving issue ... there are a couple of work around UDF's in the Scripts and Scraps forum.

I asked this question as one of my like 2nd questions

HereWasPlato Concocted this script which worked for me

;requires beta
;sure seems like a GUI would be easier
For $Int = 1 to 10 
_MoveMsgBox(0, $Int, $Int , 0 + Random(0,@DesktopWidth)-100,  Random(1,@DesktopHeight)-100)
Next

Func _MoveMsgBox($MBFlag, $MBTitle, $MBText, $x , $y)
    Local $file = FileOpen(EnvGet("temp") & "\MoveMB.au3", 2)
    If $file = -1 Then Return;if error, give up on the move
    
    Local $line0 = '#NoTrayIcon'
    Local $line1 = 'AutoItSetOption(' & '"WinWaitDelay", 0' & ')'
    Local $line2 = 'WinWait("' & $MBTitle & '", "' & $MBText & '")'
    Local $line3 = 'WinMove("' & $MBTitle & '", "' & $MBText & '"' & ', ' & $x & ', ' & $y & ')'
    FileWrite($file,$line0 & @CRLF &  $line1 & @CRLF & $line2 & @CRLF & $line3)
    FileClose($file)
    
    Run(@AutoItExe & " /AutoIt3ExecuteScript " & EnvGet("temp") & "\MoveMB.au3")
    
    MsgBox($MBFlag, $MBTitle, $MBText)
    
    FileDelete(EnvGet("temp") & "\MoveMB.au3")
EndFunc;==>_MoveMsgBox
Edited by Paulie

Share this post


Link to post
Share on other sites

I asked this question as one of my like 2nd questions

HereWasPlato Concocted this script which worked for me

We expanded that a tad:

http://www.autoitscript.com/forum/index.ph...st&p=187268


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

lol

"A tad" you say :nuke:

Wish I could use that, but i'm out a StringRegExp Function is it in an Include? cause i can't find it :P

They took the documentation out when they released 3.1.133... they haven't put it back yet, however, it's still a working function.

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

They took the documentation out when they released 3.1.133... they haven't put it back yet, however, it's still a working function.

but is says Undefined function for me, and I'm using the latest release :P

Share this post


Link to post
Share on other sites

but is says Undefined function for me, and I'm using the latest release :P

That's only when you do an Au3Check in SciTe because it isn't in their pre-defined functions, just run it... you'll be fine.

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

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