Jump to content

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Find out more here. X
X


Photo

MyCokeReward Code Locker


  • Please log in to reply
5 replies to this topic

#1 DarthCookieMonster

DarthCookieMonster

    I ate your mom's cookie. Nom Nom Nom...

  • MVPs
  • 11,710 posts

Posted 01 February 2010 - 04:22 PM

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:
cokelocker.JPG

Icon for download:
Attached File  Coke can.ico   83.19KB   136 downloads

Code:
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.

The Vollatran project
_____


msg-108-0-96549500-1409901790.png
Obi didn't believe me when I told him the dark side has milk and cookies....








#2 Delta

Delta

    Oh Dear...

  • Active Members
  • PipPipPipPipPipPip
  • 612 posts

Posted 01 February 2010 - 11:20 PM

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?
Please stop confusing "how to" with "how do"

#3 DarthCookieMonster

DarthCookieMonster

    I ate your mom's cookie. Nom Nom Nom...

  • MVPs
  • 11,710 posts

Posted 02 February 2010 - 03:11 AM

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
_____


msg-108-0-96549500-1409901790.png
Obi didn't believe me when I told him the dark side has milk and cookies....


#4 JohnOne

JohnOne

    John

  • Active Members
  • PipPipPipPipPipPip
  • 12,709 posts

Posted 02 February 2010 - 01:03 PM

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
 
 
OMG! Women are the cows of people.


#5 Delta

Delta

    Oh Dear...

  • Active Members
  • PipPipPipPipPipPip
  • 612 posts

Posted 05 February 2010 - 01:34 AM

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.
Please stop confusing "how to" with "how do"

#6 DarthCookieMonster

DarthCookieMonster

    I ate your mom's cookie. Nom Nom Nom...

  • MVPs
  • 11,710 posts

Posted 10 February 2010 - 07:42 PM

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

The Vollatran project
_____


msg-108-0-96549500-1409901790.png
Obi didn't believe me when I told him the dark side has milk and cookies....





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users