Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
148 changes: 109 additions & 39 deletions AHK/SteamBulkKeyActivator.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
; See the License for the specific language governing permissions and
; limitations under the License.



;Variables> http://ahkscript.org/docs/Variables.htm#Cursor
;Gendocs > https://github.com/fincs/GenDocs
;OutPutDebug http://www.autohotkey.com/docs/commands/OutputDebug.htm
Expand All @@ -26,7 +24,7 @@
License: Apache License, Version 2.0
*/
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
#Warn All, Off ; Disable warnings (error dialog boxes being shown to user)
;#Warn All, Off ; Disable warnings (error dialog boxes being shown to user)
#singleinstance force ;force looping
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
Expand All @@ -35,6 +33,19 @@ SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.

;general methods/functions

;~ ScreenFLow Notes

;~ 1 : Activation 1 basic info: click_btn(2, "next")
;~ 2 : Activation 2 subscriber agreement: click_btn(2, "i agree")
;~ 3 : Activation 3 product key: Enter Key and click_btn(2, "next")
;~ NOW 3 options and different flows (handled in steam_check_if_key_worked())
;~ 4a : Invalid Key or Too many attempts: click_btn(3, "cancel") ; check for link

;~ 4b : Already Owned: click_btn(2, "next") ; fall through case
;~ 4b1 : Install : click_btn(3, "cancel")

;~ 4c : Success : click_btn(3, "finish") ; check for print

steam_activate_key(key){ ;method that takes a string variable (the key) and places it into the key box of steam activator window
if(key = ""){ ;check to make sure key is not empty
applog("we got an empty key ? ignoring this one")
Expand All @@ -47,80 +58,141 @@ steam_activate_key(key){ ;method that takes a string variable (the key) and
log_to_file("`n[" . Time . "] " . "'key' =>" . " '" . key . "'",false)
steam_close_all()
steam_open_activation_window()
steam_move_window()
steam_click_next()
steam_click_next()
steam_activate_product_code_field()
get_button_pos()
steam_click_next() ;or click_btn(2)
steam_click_iagree() ;or click_btn(2)
; steam_activate_product_code_field()
steam_send_input(key)
steam_click_next()
;steam_click_next()
steam_click_iagree() ;or click_btn(2)
steam_wait_until_done()
if(steam_check_if_key_worked()){
applog("[sucessfull] key activated without problems !")
log_to_file(", 'success' => 'true'",false)
;log_to_file(" <---- Activated",false)
}else{
applog("[faillure] key failed to activate !")
log_to_file(", 'success' => 'false' ",false)
;log_to_file(" <---- Failed",false)

}
applog("[end of this key]")
return
}

;mouse and keyboard interactions

get_button_pos() {
; button width = 465 - 374 = 91
buttonwidth := 91
; button height = 387 - 364 = 23
; button x spacing = 11
; button x offset (right) = 476 - 465 = 11
xoffset := 11
; button y offset (bottom) = 400 - 387 = 13
yoffset := 13
precision := 5
;based on above, button locations are:
; button 1 = BACK
; right - (3*xoffset + 2*buttonwidth + precision), bottom - (yoffset + precision)
; button 2 = NEXT, I AGREE
; right - (2*xoffset + buttonwidth + precision), bottom - (yoffset + precision)
; button 3 = CANCEL, FINISH
; right - (xoffset + precision), bottom - (yoffset + precision)
; THUS
steam_activate_window()
WinGetPos, , , wnWidth, wnHeight
global ypos := wnHeight - (yoffset + precision)
global xpos3 := wnWidth - (xoffset + precision)
global xpos2 := xpos3 - (xoffset + buttonwidth)
global xpos1 := xpos2 - (xoffset + buttonwidth)
;Test moving to those co-ordinates
Loop, 3 {
MouseMove, xpos%A_Index%, ypos
;MsgBox, , ,%xpos3% %ypos%
Sleep, 100
}
}

click_btn(num, logmsg="") {
global ypos, xpos1, xpos2, xpos3
MouseClick, left, xpos%num%, ypos
;TrayTip, , % Clicked xpos%num% ypos ;debug message
if (logmsg != "") {
applog(logmsg)
}
}

steam_click_next(){ ;click the next button
steam_activate_window()
MouseClick, left, 320, 575 ;click next
applog("> clicked next [activation]")
;MouseClick, left, 320, 575 ;click next
Send {Tab}
Sleep,100
Send {Space}
;click_btn(2,"> clicked next [activation]")
Sleep,100
return
}
steam_click_iagree(){ ;click the next button
steam_activate_window()
;MouseClick, left, 320, 575 ;click next
;~ Send {Tab}
;~ Sleep,100
;~ Send {Tab}
;~ Sleep,100
;~ Send {Space}
click_btn(2,"> clicked I Agree [activation]")
Sleep,100
return
}
steam_click_cancel(){ ;click the cancel button
steam_activate_window()
MouseClick, left, 422, 568 ;click cancel.
applog("> clicked cancel [activation]")
;MouseClick, left, 422, 568 ;click cancel.
click_btn(2,"> clicked cancel [activation]")
Sleep,100
return
}
steam_click_back(){ ;click the back button
steam_activate_window()
MouseClick, left, 212, 568 ;click back
applog("> clicked back [activation]")
;MouseClick, left, 212, 568 ;click back
click_btn(1,"> clicked back [activation]")
Sleep,100
return
}
steam_click_print(){ ;click the print button
steam_activate_window()
MouseClick, left, 221, 407 ;click print
MouseClick, left, 225, 275 ;click print *VARIABLE*
applog("> clicked print [activation]")
Sleep,100
return
}
steam_install_click_back(){ ;install window click back
steam_activate_install()
MouseClick, left, 212, 568 ;click back
applog("> clicked back [install]")
;MouseClick, left, 212, 568 ;click back
click_btn(1,"> clicked back [install]")
Sleep,100
return

}
steam_install_click_cancel(){ ;install window click cancel
steam_activate_install()
MouseClick, left, 422, 568 ;click cancel.
;MouseClick, left, 422, 568 ;click cancel.
;click_btn(3)
;Send, {Esc}
Send {Tab}
Sleep,100
Send {Tab}
Sleep,100
Send {Space}
applog("> clicked cancel [install]")
Sleep,100
return
}
steam_install_click_next(){ ;install window click next
steam_activate_install()
MouseClick, left, 320, 575 ;click next
applog("> clicked next [install]")
;MouseClick, left, 320, 575 ;click next
click_btn(2,"> clicked next [install]")
Sleep,100
return
}
steam_activate_product_code_field(){ ;activate the product code field
steam_activate_product_code_field(){ ;activate the product code field, maybe not necessary?
steam_activate_window()
MouseClick, left, 40, 190 ;click Product code field
applog("> clicked product code field")
Expand Down Expand Up @@ -207,7 +279,7 @@ steam_close_all(){ ;this will close the activation window (it should not
}
steam_check_if_key_worked(){ ;check if steam key worked
applog("we need to check if the key worked")
if(steam_check_invalid_or_too_many_attempts()){
if(steam_check_invalid_or_too_many_attempts()){ ;4a
applog("product code invalid or to many key tries")
;Steam is whining (to many keys tries, or product code is invalid)
steam_click_cancel()
Expand All @@ -219,26 +291,26 @@ steam_check_if_key_worked(){ ;check if steam key worked
;we need to press the print button & close that window again
applog("checking if this is a new product")
steam_click_print()
if(is_print_window()){
if(is_print_window()){ ;4c
applog("[new product] we activated a new product")
log_to_file(", 'new product' => 'true'",false)
;this means there is a print window & we closed it.
}else{
click_btn(3,"> clicked Finish [activation]")
return true
}else{ ;4b
applog("[duplicate product] we activated a duplicate product")
log_to_file(", 'new product' => 'false'",false)
;this means there is a print window & we closed it.
;this means there is no print window
click_btn(2,"> clicked next [activation]")
steam_check_if_on_install_screen()
click_btn(3,"> clicked Cancel [Install]")
return true
}
steam_click_next() ;we click next (past print screen)
applog("now we need to check if we are on the install screen")
;in order to see if they key worked we need to check if we are on the install screen, if we are press cancel & report that the key worked
steam_check_if_on_install_screen()
steam_install_click_cancel()

}
}
steam_check_invalid_or_too_many_attempts(){ ;check if steam is angry at us
steam_activate_window()
MouseMove, 61, 207 ;move mouse to the invalid link
MouseMove, 61, 207 ;move mouse to the invalid link *VARIABLE*
applog("moved mouse to check if there is an invalid link")
Sleep,100
If(A_Cursor = "Unknown"){
Expand All @@ -253,8 +325,8 @@ steam_check_if_on_install_screen(){ ;check if we are on the install screen
applog("checking if we are on the install window")
;steam_activate_window() <--- does not work, because title changed
steam_activate_install()
WinMove, 100, 100 ;lets move the window to the left.
applog("moved install window to 100,100")
;WinMove, 100, 100 ;lets move the window to the left.
;applog("moved install window to 100,100")
Sleep,100
WinGetTitle, WindowTitle,
StringTrimLeft,gameTitle,WindowTitle,10
Expand Down Expand Up @@ -336,5 +408,3 @@ applog("pressed escape!")
applog(" ----- App End ------")
ExitApp
Return


17 changes: 11 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
#Steam Bulk Key Activator
# Archived
I'm no longer maintaining this repo, check out its forks, or https://store.steampowered.com/account/registerkey



# Steam Bulk Key Activator
=====================

## Activate keys in bulk
######A little macro program that allows you to activate steam keys in bulk
###### A little macro program that allows you to activate steam keys in bulk

Add a keys.txt file in the root directory of the binary/script.
add 1 key per line and save the file.
Expand All @@ -12,16 +17,16 @@ After a successful activation it will cancel the game's installation so it does
Do not touch keyboard and or mouse
you can press escape at any time to cancel the macro

##Download
## Download

![Release](https://raw.githubusercontent.com/colingg/SteamBulkKeyActivator/master/Recources/web/Releases.png)

[You can download the latest release over here](https://github.com/colingg/SteamBulkKeyActivator/releases)

##Demo
## Demo
![Demo](https://raw.githubusercontent.com/colingg/SteamBulkKeyActivator/master/Recources/web/demo.gif)

##VAC anti-cheat concerns
## VAC anti-cheat concerns
This is a script that uses Autohotkey to emulate keyboard and mouse, no reasons to be concerned about VAC. ;)

This script is written in AutoHotKey
Expand All @@ -30,7 +35,7 @@ http://ahkscript.org/

This is a script that automates the repetitive task of activating steam keys. as this does not inject anything whatsoever you don't have to worry about VAC.

##License
## License
Copyright 2014 colingg (colin.gg)

Licensed under the Apache License, Version 2.0 (the "License");
Expand Down