Amazon GiftCard Redeemer (Autohotkey Script)


SUBMITTED BY: kristiansja

DATE: Dec. 23, 2015, 8:47 p.m.

FORMAT: autohotkey

SIZE: 1.8 kB

HITS: 808

  1. #NoEnv
  2. SetWorkingDir %A_ScriptDir%
  3. ;=============================
  4. Pwb := ComObjCreate("InternetExplorer.Application")
  5. Pwb.Visible := True
  6. Return
  7. ;=============================
  8. !z::
  9. ;==============
  10. IfNotExist, AmazonCodes.txt
  11. Return
  12. FileRead, e, EnteredCodes.txt
  13. FileRead, c, AmazonCodes.txt
  14. StringReplace, c, c, `r`n, ^, All
  15. StringSplit, ca, c, ^
  16. Loop, %ca0%
  17. {
  18. d := ca%A_Index%
  19. StringSplit, da, d, |
  20. Code := da1
  21. If A_Index = 1
  22. Msgbox, %Code%
  23. IfInString, e, %Code%
  24. Continue
  25. Pwb.Document.getElementsByName("claimCode")[0].value := Code
  26. Pwb.Document.getElementsByName("applytoaccount")[0].click()
  27. IELoad(Pwb)
  28. Sleep, 1000
  29. filedelete, html.txt
  30. html := Pwb.Document.DocumentElement.innerHTML
  31. fileappend, %html%, html.txt
  32. IfNotInString, html, gift card has been applied to your account
  33. {
  34. Msgbox, 64, Amazon Enterer, Failed to enter the code...
  35. Pwb.Navigate("https://www.amazon.com/gp/gc/payment")
  36. IELoad(Pwb)
  37. Continue
  38. }
  39. FileAppend, %Code%`r`n, EnteredCodes.txt
  40. Pwb.Navigate("https://www.amazon.com/gp/css/gc/payment/view-gc-balance?ie=UTF8&ref_=gc_lp_wl3_atya_red_new2")
  41. IELoad(Pwb)
  42. Sleep, 1000
  43. }
  44. Return
  45. ;=============================
  46. IELoad(Pwb) ;You need to send the IE handle to the function unless you define it as global.
  47. {
  48. If !Pwb ;If Pwb is not a valid pointer then quit
  49. Return False
  50. Loop ;Otherwise sleep for .1 seconds untill the page starts loading
  51. Sleep,100
  52. Until (Pwb.busy)
  53. Loop ;Once it starts loading wait until completes
  54. Sleep,100
  55. Until (!Pwb.busy)
  56. Loop ;optional check to wait for the page to completely load
  57. Sleep,100
  58. Until (Pwb.Document.Readystate = "Complete")
  59. Return True
  60. }

comments powered by Disqus