Skip to content

Instantly share code, notes, and snippets.

@TLMcode
Last active December 19, 2015 10:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TLMcode/5940082 to your computer and use it in GitHub Desktop.
Save TLMcode/5940082 to your computer and use it in GitHub Desktop.
CSV to DDL on button press
SetWorkingDir % A_ScriptDir
csvfile = testvars.csv
TestVar2 = ServerVariable1|| ServerVaraible2| ServerVariable3|
; Gui, 1: +AlwaysOnTop
Gui, 1: Font, S9
Gui, 1: Add, Text, CDefault, Select Var1
Gui, 1: Add, DDL, vDDL1
Gui, 1: Add, Text, CDefault, Select Server Variable
Gui, 1: Add, DDL, vDDL2, %TestVar2%
Gui, 1: Add, Button, wp Default gButtonLaunch, Launch
Gui, 1: Add, Button, wp Default, Stop
Gui, 1: Add, Checkbox, Checked vRcon, Use Debug Console
Gui, 1: Add, Text, CDefault, YOUR LAN IP: %A_IPAddress1%
Gui, 1: Add, Button, ys wp gLoadCSV, populate ddl1
Gui, 1: Show, h200 w325, Video Game Server Launcher
return
ButtonLaunch:
Gui, 1: Submit, NoHide
msgbox done
MsgBox, Path/VideoGame.exe %DDL1%%DDL2%
Sleep, 100
if Rcon = 1
MsgBox, Debugconsole.exe
Return
ButtonStop:
Gui, Submit, NoHide
Runwait, taskkill /im VideoGame.exe /f
Runwait, taskkill /im Debugconsole.exe /f
return
LoadCSV:
GUIControl, 1:, DDL1, % CSVtoDDL(csvfile)
return
GuiClose:
ExitApp
CreateCSV(csvfile)
{
If !FileExist(csvfile)
{
Loop 5
FileAppend, % "level" a_index "`,", % csvfile
}
}
CSVtoDDL(csvfile)
{
If !FileExist(csvfile)
CreateCSV(csvfile)
FileRead, csv, % csvfile
Loop, Parse, csv, CSV
ddl.=A_LoopField (A_Index=1?"||":"|")
Return SubStr(ddl,1,-1)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment