title: AutoHotKey GUI button send variable
body: <p>I have a GUI menu in AutoHotKey that I am having trouble with. The GUI has three buttons named  "Red", "Blue" and "Green". </p>
  
  <p>When the user clicks on say, "Red", an action happens. If the user clicks on say, "Blue", a different action happens.</p>
  
  <p>The loop is started with the F4 key, but a different thing should loop depending on which button was pressed: Red, Blue or Green.</p>
  
  <p>This is the script I have so far: </p>
  
  <pre><code>Gui, Add, Tab, x366 y377 w-100 h-400 , Tab1
  Gui, Add, Picture, x6 y7 w320 h90 , C:\IMAGEFILEHERE
  Gui, Add, Text, x46 y147 w140 h40 , Spawning Team
  Gui, Add, Button, x206 y117 w120 h20 , Red
  Gui, Add, Button, x206 y147 w120 h20 , Blue
  Gui, Add, Button, x206 y177 w120 h20 , Green
  Gui, Show, x436 y230 h208 w336, SCRIPTNAME
  
  Loop 
  { 
    If run = 
    {
    sleep,250 
    continue
  }
    Else 
    { 
  if (Team = "Red") ; If Red is selected, run this part
  {
      ACTION1HERE
  }
  if (Team = "Blue") ; If Blue is selected, run this part
  {
      ACTION2HERE
  }
  if (Team = "Green") ; If Green is selected, run this part
  {
      ACTION3HERE
  }
    } 
  } 
  return 
  
  F4:: 
  If run =  
    run = 1 
  Else 
    run = 
  return
  
  
  ButtonRed:
  Team = Red.
  MsgBox The value in the variable named Team is %Team%.
  Return
  
  ButtonBlue:
  Team = Blue.
  MsgBox The value in the variable named Team is %Team%.
  Return
  
  ButtonGreen:
  Team = Green.
  MsgBox The value in the variable named Team is %Team%.
  Return
  </code></pre>
  
  <p>The problem is that the button being pressed is not being detected by the if statement.</p>
  
  <p>Any help is much appreciated! ^_^ I am quite new to AHK. </p>