Jump to content

Tennis - Mix doubles team gen


JayHawkfl
 Share

Recommended Posts

Super simple super quick script I made to randomize teams for mixed doubles. Haven't coded for a while so it felt good to write anything. 

 

#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <SliderConstants.au3>
#include <WindowsConstants.au3>
#include <MsgBoxConstants.au3>
#include <Array.au3>
#include <Excel.au3>

Local $arraySize = 2
local $array1[50] = ["Doug","Julio"]
local $array2[50] = ["Hannah","Sheila"]
Local $oBook

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Doubles Team Mixer", 615, 438, 192, 124)
$Bachround = GUICtrlCreatePic("C:\Users\a607150\Pictures\2.jpg",0,0,615,438)
$Input1 = GUICtrlCreateInput("", 64, 128, 121, 175)
$Input2 = GUICtrlCreateInput("", 364, 128, 121, 175)
$Button1 = GUICtrlCreateButton("Serve",216,140,121,42)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
         Case $Button1
            $array1 = GUICtrlRead($input1)
            $array1 = StringSplit($array1,",")
            $array2 = GUICtrlRead($input2)
            $array2 = StringSplit($array2,",")
            _ArrayDelete($array1,0)
            _ArrayDelete($array2,0)
            _ArrayShuffle($array2)
            $oBook = _Excel_Open(Default, Default, Default, Default, True)
            $oWorkBook = _Excel_BookNew($oBook, 1)
            _Excel_RangeWrite($oWorkBook,$oWorkBook.activesheet,"Guys","A1")
            _Excel_RangeWrite($oWorkBook,$oWorkBook.activesheet,"Gals","B1")
            _Excel_RangeWrite($oWorkBook,$oWorkBook.activesheet,$array1,"A2")
            If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeWrite Example 2", "Error writing $array1 to worksheet." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
            _Excel_RangeWrite($oWorkBook,$oWorkBook.activesheet,$array2,"B2")
    EndSwitch
WEnd

 

Thanks for your time

 

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

×
×
  • Create New...