|     Inicio    |   |         |  |   FOROS      |  |      |      
   Elastix - VoIP B4A (Basic4Android) App inventor 2 PHP - MySQL
  Estación meteorológica B4J (Basic4Java) ADB Shell - Android Arduino
  Raspberry Pi Visual Basic Script (VBS) FireBase (BD autoactualizable) NodeMCU como Arduino
  AutoIt (Programación) Visual Basic Cosas de Windows Webs interesantes
Translate:
Búsqueda en este sitio:


.

Autoit en español
Aplicaciones con Autoit - Juan Antonio Villalpando

-- Tutorial de iniciación a Autoit --

Volver al índice del tutorial

____________________________

26.- Select Case. If ... Then.

___________________________________________
1.- Select Case. EndSelect.

-

Select Case. EndSelect.
				   
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Case - Juan A. Villalpando", 420, 396, 192, 132)
$Group1 = GUICtrlCreateGroup("Países", 80, 40, 273, 249)
$Radio1 = GUICtrlCreateRadio("España.", 112, 72, 145, 33)
$Radio2 = GUICtrlCreateRadio("México.", 112, 112, 137, 25)
$Radio3 = GUICtrlCreateRadio("Colombia.", 112, 152, 137, 25)
$Radio4 = GUICtrlCreateRadio("Argentina.", 112, 184, 97, 33)
$Radio5 = GUICtrlCreateRadio("Chile.", 112, 224, 105, 33)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Button1 = GUICtrlCreateButton("Elige un país y pulsa este botón.", 80, 312, 273, 41)
GUISetState(@SW_SHOW)
; Juan A. Villalpando - KIO4.COM
#EndRegion ### END Koda GUI section ###


While 1
$msg = GuiGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop

Case $msg = $Button1
        ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
        Select
            Case GUICtrlRead($Radio1) =  $GUI_CHECKED
                MsgBox(0, "España.", "La capital de España es Madrid.")
            Case GUICtrlRead($Radio2) =  $GUI_CHECKED
                MsgBox(0, "México.", "La capital de México es Ciudad de México.")
            Case GUICtrlRead($Radio3) =  $GUI_CHECKED
                MsgBox(0, "Colombia.", "La capital de Colombia es Bogotá.")
            Case GUICtrlRead($Radio4) =  $GUI_CHECKED
                MsgBox(0, "Argentina.", "La capital de Argentina es Buenos Aires.")
            Case GUICtrlRead($Radio5) =  $GUI_CHECKED
                MsgBox(0, "Chile.", "La capital de Chile es Santiago.")
       EndSelect
       ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

EndSelect
Wend
Exit

___________________________________________
2.- If... Then... ElseIf.

If ... Then ElseIf.
				   
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Case - Juan A. Villalpando", 420, 396, 192, 132)
$Group1 = GUICtrlCreateGroup("Países", 80, 40, 273, 249)
$Radio1 = GUICtrlCreateRadio("España.", 112, 72, 145, 33)
$Radio2 = GUICtrlCreateRadio("México.", 112, 112, 137, 25)
$Radio3 = GUICtrlCreateRadio("Colombia.", 112, 152, 137, 25)
$Radio4 = GUICtrlCreateRadio("Argentina.", 112, 184, 97, 33)
$Radio5 = GUICtrlCreateRadio("Chile.", 112, 224, 105, 33)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Button1 = GUICtrlCreateButton("Elige un país y pulsa este botón.", 80, 312, 273, 41)
GUISetState(@SW_SHOW)
; Juan A. Villalpando - KIO4.COM
#EndRegion ### END Koda GUI section ###


While 1
$msg = GuiGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop

    Case $msg = $Button1
        ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
            if GUICtrlRead($Radio1) =  $GUI_CHECKED Then
                MsgBox(0, "España.", "La capital de España es Madrid.")
            ElseIf GUICtrlRead($Radio2) =  $GUI_CHECKED Then
                MsgBox(0, "México.", "La capital de México es Ciudad de México.")
            ElseIf GUICtrlRead($Radio3) =  $GUI_CHECKED Then
                MsgBox(0, "Colombia.", "La capital de Colombia es Bogotá.")
            ElseIf GUICtrlRead($Radio4) =  $GUI_CHECKED Then
                MsgBox(0, "Argentina.", "La capital de Argentina es Buenos Aires.")
            ElseIf GUICtrlRead($Radio5) =  $GUI_CHECKED Then
                MsgBox(0, "Chile.", "La capital de Chile es Santiago.")
       EndIf
       ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

EndSelect
Wend
Exit

___________________________________________
3.- If... Then...

If ... Then
				   
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Case - Juan A. Villalpando", 420, 396, 192, 132)
$Group1 = GUICtrlCreateGroup("Países", 80, 40, 273, 249)
$Radio1 = GUICtrlCreateRadio("España.", 112, 72, 145, 33)
$Radio2 = GUICtrlCreateRadio("México.", 112, 112, 137, 25)
$Radio3 = GUICtrlCreateRadio("Colombia.", 112, 152, 137, 25)
$Radio4 = GUICtrlCreateRadio("Argentina.", 112, 184, 97, 33)
$Radio5 = GUICtrlCreateRadio("Chile.", 112, 224, 105, 33)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Button1 = GUICtrlCreateButton("Elige un país y pulsa este botón.", 80, 312, 273, 41)
GUISetState(@SW_SHOW)
; Juan A. Villalpando - KIO4.COM
#EndRegion ### END Koda GUI section ###


While 1
$msg = GuiGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop

Case $msg = $Button1
        ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
        if GUICtrlRead($Radio1) =  $GUI_CHECKED Then MsgBox(0, "España.", "La capital de España es Madrid.")
        if GUICtrlRead($Radio2) =  $GUI_CHECKED Then MsgBox(0, "México.", "La capital de México es Ciudad de México.")
        if GUICtrlRead($Radio3) =  $GUI_CHECKED Then MsgBox(0, "Colombia.", "La capital de Colombia es Bogotá.")
        if GUICtrlRead($Radio4) =  $GUI_CHECKED Then MsgBox(0, "Argentina.", "La capital de Argentina es Buenos Aires.")
        if GUICtrlRead($Radio5) =  $GUI_CHECKED Then MsgBox(0, "Chile.", "La capital de Chile es Santiago.")
        ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

EndSelect
Wend
Exit

_________________

- Mi correo:
juana1991@yahoo.com
- KIO4.COM - Política de cookies. Textos e imágenes propiedad del autor:
© Juan A. Villalpando
No se permite la copia de información ni imágenes.
Usamos cookies propias y de terceros que entre otras cosas recogen datos sobre sus hábitos de navegación y realizan análisis de uso de nuestro sitio.
Si continúa navegando consideramos que acepta su uso. Acepto    Más información