How it works:
The locker simply checks your code to make sure it has the proper characters entered as well as the correct length. If correct, the code is saved to a text file. You have a button to view the file to enter in your codes later if you like. A simple counter is also available to tell you how many codes you have.
Screenshot:
Icon for download:
Coke can.ico 83.19K
120 downloadsCode:
AutoIt
#include <GUIConstants.au3> #include <EditConstants.au3> #include <Misc.au3> Dim $g, $LC, $c $dll = DllOpen("user32.dll") $fO = FileOpen("caps.txt", 1) ;makes caps.txt file if not already there FileClose($fO) _getcount() $Form1 = GUICreate("Coke Code Locker", 510, 72, 193, 115) $Input1 = GUICtrlCreateInput("", 24, 24, 185, 21, $ES_UPPERCASE) $Button1 = GUICtrlCreateButton("Enter", 224, 22, 80, 24, 0) GUICtrlSetBkColor($Button1, 0xFF0000) $Button2 = GUICtrlCreateButton("View List", 320, 22, 80, 24, 0) $count = GUICtrlCreateLabel("# of Codes: " & $c, 415, 27) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $Button1 _RR() Case $Button2 ShellExecute("caps.txt", "", @ScriptDir, "edit") GUICtrlSetState($Input1, $GUI_FOCUS) Case $GUI_EVENT_CLOSE Exit EndSwitch If _IsPressed("0D", $dll) Then If WinActive($Form1) Then Do Sleep(10) Until _IsPressed("0D", $dll) = 0 Sleep(100) _RR() Sleep(100) EndIf EndIf WEnd Func _msg() MsgBox(16, "Error!", "Wrong number of characters entered!" & @CRLF & "Count is " & $LC) EndFunc ;==>_msg Func _RR() $g = GUICtrlRead($Input1) $LC = StringLen($g) $sst = StringRegExp($g, "[^1234567890ABFHJKLMNPRTVWX]", 0) Select Case $LC < 12 Or $LC = 13 Or $LC = 14 Or $LC > 15 _msg() Case $sst = 1 MsgBox(16, "Error", "Improper character entered") GUICtrlSetState($Input1, $GUI_FOCUS) Case Else _enter() EndSelect EndFunc ;==>_RR Func _enter() $f = FileOpen("caps.txt", 1) $j = FileWriteLine($f, $g) GUICtrlSetData($Input1, "") FileClose($f) $c = $c + 1 GUICtrlSetData($count, "# of Codes: " & $c) GUICtrlSetState($Input1, $GUI_FOCUS) EndFunc ;==>_enter Func _getcount() ;number of codes in locker. $file = FileOpen("caps.txt", 0) $c = 0 While 1 $line = FileReadLine($file) $len = StringLen($line) If @error = -1 Then ExitLoop If $len = 0 Then ExitLoop $c = $c + 1 WEnd FileClose($file) EndFunc ;==>_getcount
FAQ:
1. Question: Is this a Coke Code Generator or anything to do with a Coke Code Generator?
Answer: No. That I will not do.
2. Question: can you make it auto upload the codes?
Answer: If you wish to improve the code so it does it.....feel free.
Edited by scullion, 02 October 2012 - 05:31 PM.





