Sign in to follow this  
Followers 0
zocker30

If-Then-Change Variable

3 posts in this topic

#1 ·  Posted (edited)

Hello,

i just started a script which should do the following :

1.) inputbox , where u write one of three things ( 1,2,3 )

2.) A If function changes the value of a variable

If $inputbox = "1" then

$Answer = 1

elseif $inputbox = "2" then

$Answer = 2

elseif $inputbox = "3" then

$Answer = 3

3.) Calculate 1 + $Answer and make a massagebox !

Thanks for your Help and Time

Edited by zocker30

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Here is a small example:

$value = InputBox("...", "...")
If Not StringIsInt($value) Then Exit MsgBox(0, "", "No integer given")
MsgBox(0, "", 1 + $value)
Edited by ProgAndy

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

How about this?

Local $inputbox, $Answer

$inputbox = "4" ; <<<<<< change this number to test

Select
Case $inputbox = "1"
  $Answer = 1
  MsgBox(64, "Answer", "Answer = " & $Answer)
Case $inputbox = "2"
  $Answer = 2
  MsgBox(64, "Answer", "Answer = " & $Answer)
Case $inputbox = "3"
  $Answer = 3
  MsgBox(64, "Answer", "Answer = " & $Answer)
Case Else
  MsgBox(64, "Answer", "Unknown Parameter")
EndSelect
Edited by Chimaera

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