Skip to content

Instantly share code, notes, and snippets.

@Nasawa
Created November 5, 2016 22:36
Show Gist options
  • Save Nasawa/256503d347061bfd70e9cd4dd5bb855c to your computer and use it in GitHub Desktop.
Save Nasawa/256503d347061bfd70e9cd4dd5bb855c to your computer and use it in GitHub Desktop.
Used in conjunction with Clipt, allows you to rapidly add games to Steam Big Picture Mode using keys (such as from Humble Bundle) copied on one computer and pasted on another.
var clip = require('copy-paste').global();
var socket = require('socket.io-client')(process.argv[2]);
var id = undefined;
if(process.argv[3])
id = process.argv[3];
socket.on('connect', function () { console.log("socket connected"); });
socket.on('id', function(i)
{
if(!id)
id = i;
console.log("My id is: " + id);
var clipContents = clip.paste();
setInterval(function()
{
if(clipContents != clip.paste())
{
clipContents = clip.paste();
socket.emit('message', id + "", clipContents);
console.log(clipContents);
}
}, 100);
})
#steamkey.ahk
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
Loop
{
OnClipboardChange:
Send, {Enter}
Sleep 200
Send, ^v
Sleep 200
Send, {Down}
Send, {Down}
Send, {Enter}
Sleep 500
Send, {Enter}
Return
}
^.::
Send, {Enter}
Sleep 200
Send, ^v
Sleep 200
Send, {Down}
Send, {Down}
Send, {Enter}
Sleep 500
Send, {Enter}
Return
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment