Sign in to follow this  
Followers 0

MyCokeReward Code Locker

6 posts in this topic

#1 ·  Posted (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.



Icon for download:

Coke can.ico


#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
$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)
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $Button1
        Case $Button2
            ShellExecute("caps.txt", "", @ScriptDir, "edit")
            GUICtrlSetState($Input1, $GUI_FOCUS)
        Case $GUI_EVENT_CLOSE
    If _IsPressed("0D", $dll) Then
        If WinActive($Form1) Then
            Until _IsPressed("0D", $dll) = 0

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)
        Case $LC < 12 Or $LC = 13 Or $LC = 14 Or $LC > 15
        Case $sst = 1
            MsgBox(16, "Error", "Improper character entered")
            GUICtrlSetState($Input1, $GUI_FOCUS)
        Case Else
EndFunc ;==>_RR

Func _enter()
    $f = FileOpen("caps.txt", 1)
    $j = FileWriteLine($f, $g)
    GUICtrlSetData($Input1, "")
    $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
EndFunc ;==>_getcount


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

Share this post

Link to post
Share on other sites

#2 ·  Posted

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]

Share this post

Link to post
Share on other sites

#3 ·  Posted

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.

Share this post

Link to post
Share on other sites

#5 ·  Posted

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.

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]

Share this post

Link to post
Share on other sites

#6 ·  Posted

I looked at that code from the widget. That would take some doing to automate it.

Share this post

Link to post
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
Sign in to follow this  
Followers 0