Jump to content

Msg box return issue


Recommended Posts

I just started with AutoIt and I've searched the forums/helpfiles but I can't seem to fin the answer to this simple question... It's probably fight under my nose and I can't see the forest for the trees... :">

Here's my script (it's very simple):

MsgBox( 4, "What should I open?", "'Yes' opens notepad and 'no' opens media player")

If Return = 6 Then
Run("notepad.exe")

ElseIf Return = 7 Then
Run("wmplayer.exe")

EndIf

I get the error:

If Return = 6 Then
If ^ ERROR
Error: Error in exp[b][/b]ression.

If I take out the "Return =", both buttons execute notepad.

I know it has to be something obvious... I just can't see it. (prolly thinking too hard...)

Edited by Paradigm
Link to comment
Share on other sites

  • Developers

$rc = MsgBox( 4, "What should I open?", "'Yes' opens notepad and 'no' opens media player")

If $Rc= 6 Then
    Run("notepad.exe")
ElseIf $rc = 7 Then
    Run("wmediaplayer.exe")
Else 
    ; something else was clicked
EndIf

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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