This one took me a little while as I had trouble outputting the selection to the text file, but its working now so here's the code
#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <GuiComboBoxEx.au3>
$Form1 = GUICreate("Form1", 197, 66, 192, 124)
$Label1 = GUICtrlCreateLabel("Choose number:", 10, 12, 93, 17)
$Combo1 = GUICtrlCreateCombo("Choose here...", 106, 10, 81, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
GUICtrlSetData(-1, "225|226|227|228|229|230")
$Button1 = GUICtrlCreateButton("Start", 50, 32, 97, 25)
Global $file = FileOpen('c:\ChangeMe.txt', 0)
GUISetState(@SW_SHOW)
While 1
$chosen = GUICtrlRead($Combo1)
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
$chosen = GUICtrlRead($Combo1)
Switch $chosen
Case "225"
$LogStore = FileRead($file)
FileClose($file)
$file = FileOpen('c:\ChangeMe.txt', 2)
FileClose($file)
$file = FileOpen('c:\ChangeMe.txt', 1)
FileWrite($file, "225 - "& @CRLF)
FileWrite($file, $LogStore & @CRLF)
Case "226"
$LogStore = FileRead($file)
FileClose($file)
$file = FileOpen('c:\ChangeMe.txt', 2)
FileClose($file)
$file = FileOpen('c:\ChangeMe.txt', 1)
FileWrite($file, "226 - "& @CRLF)
FileWrite($file, $LogStore & @CRLF)
Case "227"
$LogStore = FileRead($file)
FileClose($file)
$file = FileOpen('c:\ChangeMe.txt', 2)
FileClose($file)
$file = FileOpen('c:\ChangeMe.txt', 1)
FileWrite($file, "227 - "& @CRLF)
FileWrite($file, $LogStore & @CRLF)
Case "228"
$LogStore = FileRead($file)
FileClose($file)
$file = FileOpen('c:\ChangeMe.txt', 2)
FileClose($file)
$file = FileOpen('c:\ChangeMe.txt', 1)
FileWrite($file, "228 - "& @CRLF)
FileWrite($file, $LogStore & @CRLF)
Case "229"
$LogStore = FileRead($file)
FileClose($file)
$file = FileOpen('c:\ChangeMe.txt', 2)
FileClose($file)
$file = FileOpen('c:\ChangeMe.txt', 1)
FileWrite($file, "229 "& @CRLF)
FileWrite($file, $LogStore & @CRLF)
Case "230"
$LogStore = FileRead($file)
FileClose($file)
$file = FileOpen('c:\ChangeMe.txt', 2)
FileClose($file)
$file = FileOpen('c:\ChangeMe.txt', 1)
FileWrite($file, "230 - "& @CRLF)
FileWrite($file, $LogStore & @CRLF)
EndSwitch
Endswitch
WEnd
No comments:
Post a Comment