Bert Posted February 1, 2010 Share Posted February 1, 2010 (edited) Are you a Coke Code person? You have your friends give you caps? Find yourself every so often having more codes to redeem than the 120 points per week limit will allow? Hate having caps all over the place while you wait for the clock to reset on the MyCokeRewards site? No more worries. You now have a simple locker to enter in your codes for future entry.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.icoCode:expandcollapse popup#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 ;==>_getcountFAQ: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 October 2, 2012 by scullion The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
Delta Posted February 1, 2010 Share Posted February 1, 2010 Nice work Volly I'll be giving this to my mom. She has trash bags full of coke caps and coke can box tops. Question Though. Do you think you could add to the script to have it automatically enter the codes daily? Or would that be against the TOS or law or something? [size="1"]Please stop confusing "how to" with "how do"[/size] Link to comment Share on other sites More sharing options...
Bert Posted February 2, 2010 Author Share Posted February 2, 2010 I don't think it would be against TOS, but I know they built the site in Flash. Automating it is going to be a bitch. You could try automating it using the gadget they offer. I bet one could put the thing inside a GUI to make mouse clicks more stable. The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
JohnOne Posted February 2, 2010 Share Posted February 2, 2010 Nice. Thanks. I'd never heard about this MyCokeRewards. For UK dwellers, this code may possibly be used with the UK offer at cokezone. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Delta Posted February 5, 2010 Share Posted February 5, 2010 I did a little snooping through the widget source code (javascript so its easy to do) and I think I could automate it with AutoIt if I could figure out the whole HTTPS thing. In case anyone want's to have a look see you can grab the widget here. http://badge.ydp.clientapps.yahoo.com/badge/widgets/dl/widget2/my-coke-rewards-widget/gen/My%20Coke%20Rewards%20Widget.widget Just open it with a text editor and scroll about half way down and you will see the javascript. [size="1"]Please stop confusing "how to" with "how do"[/size] Link to comment Share on other sites More sharing options...
Bert Posted February 10, 2010 Author Share Posted February 10, 2010 I looked at that code from the widget. That would take some doing to automate it. The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now