 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
Mock
Joined: 21 Feb 2007 Posts: 3
|
Posted: Wed Feb 21, 2007 1:51 pm Post subject: Autofill CD-Key & Serial number |
|
|
The main problem now with this script is that CTRL+V never gets detected by some forms used by commercial games , maybe it could be possible to make some focus change some place in the code to make the clipboard buffer change.
It would be nice if somebody have any suggestion of completing this to work with protected forms
| Code: | ; Program used for splitting a serial number into variables and paste each code seperated by "-" when pressing CTRL+V
^w:: ; hot key Ctrl+W for activate script, used when copied serial number to paste buffer
Serial = %Clipboard%
Serperator = -
Replacer = ,
Check = 1
StringReplace, Serialnew, Serial, %Serperator%, %Replacer%, All
; Example #4: Parse a comma separated value (CSV) file:
Loop
{
Loop, parse, Serialnew, CSV
{
clipboard = %A_LoopField%
KeyWait, v, u
if check > %A_Index% ; Used for end loop
{
Clipboard = ;Clear clipboard at end of serial number
exit
}
KeyWait, v, d
check = %A_Index% ; Used for end loop
}
} |
|
|
| Back to top |
|
 |
NiJo
Joined: 12 Nov 2005 Posts: 73
|
Posted: Thu Feb 22, 2007 3:03 am Post subject: |
|
|
Good Idea. But...
Isn't that a complicated way to do something easy?
For example, for almost every software available, doesn't this code do the desired?
| Code: | ^w:: ;Copy Serial and press CTRL+W to Past.
Serial = %Clipboard%
StringSplit, Array, Serial
loop, %Array0%
send, % Array%A_Index%
return |
or even this:
| Code: | ^w:: ;Copy Serial and press CTRL+W to Past.
Serial = %Clipboard%
send, %Serial%
return |
Those would be handy... I would have used them lots in the past...
Can anyone test this? Right now I see no software to test, lol... |
|
| Back to top |
|
 |
Mock
Joined: 21 Feb 2007 Posts: 3
|
Posted: Thu Feb 22, 2007 11:10 pm Post subject: |
|
|
| Why making the script this why is because many programs is made in this way thats it not possible to just copy paste a serial number. typical a serial is split into groups like xxxx - xxxx - xxxx - xxxx where the dashes already is typed and has seperate boxes for the groups like windows cd key f.eks. and my idea of develope this program was to auto detect when a specifik program need a serial. than the macro would auto detect and auto fill it |
|
| Back to top |
|
 |
chinkaling
Joined: 20 Jul 2008 Posts: 2
|
Posted: Sun Jul 20, 2008 9:44 am Post subject: Should Work But Needs Testing!!! :) |
|
|
| Mock wrote: | | Why making the script this why is because many programs is made in this way thats it not possible to just copy paste a serial number. typical a serial is split into groups like xxxx - xxxx - xxxx - xxxx where the dashes already is typed and has seperate boxes for the groups like windows cd key f.eks. and my idea of develope this program was to auto detect when a specifik program need a serial. than the macro would auto detect and auto fill it |
I know it's been a while, but this serial key thing has always been in the back of my mind. Anyhow, I finally took the time to do something about it and upon researching if it already existed I found only this. So, here's what I did:
| Code: | ;Autofill Serial Key
^v::
Serial = %Clipboard% ;Retrieves cd/serial key from clipboard
StringReplace, NewSerial, Serial, -, , All ;Removes all dashes (the most common separator)
if NewSerial is digit ;Checks to see if the resulting string is only numerical
SendInput, %NewSerial% ;Simulates typing the keystrokes of the serial key
else ;If the string is not pure numbers,
{ ;it probably has spaces as separators
StringReplace, NewSerial, Serial, %A_Space%, , All ;So, I remove remaining spaces
SendInput, %NewSerial% ;Now, it should work for both dashes and spaces
}
return |
It seems like you (Mock) are confusing the "Send" (or "SendInput" in my case) function with "pasting". Send and SendInput is simulation of keystrokes... So, it imitates you typing in the serial number (only at a much faster rate if using SendInput). If I'm not mistaken, I'm pretty sure every single program or game automatically moves on to the next box once one fills up (preventing copy and paste but not keystrokes). If I am wrong, it wouldn't be hard changing my script to include TABs to move onto the next box.
Anyhow, I'm pretty sure my script is flawless (at least for my uses?). Unfortunately, all the programs I use are open source binaries and it would probably be a lot of trouble to uninstall a game and reinstall it just to test it out! So, if anyone can easily test it out, please give it a go! |
|
| Back to top |
|
 |
[VxE]
Joined: 07 Oct 2006 Posts: 3254 Location: Simi Valley, CA
|
Posted: Sun Jul 20, 2008 6:15 pm Post subject: |
|
|
I had an old scriptlet like this kicking around my hd. | Code: | ~^c::
sleep 1000
If StrLen(clipboard) < 16 || StrLen(clipboard) > 52
return
Hotkey, 4, spit4, on ; spits out 4 characters at a time
Hotkey, 5, spit5, on ; spits out 5 characters at a time
Hotkey, 3, spitall, on ; go ahead... guess...
InternalCounter = 0
StringSplit, clip, clipboard,, -_.~%A_Space%
return
Spitall:
Spit5:
Spit4:
StringMid, size, A_ThisLabel, 5, 1
StringReplace, size, size, a, 99
Loop %size%
{
InternalCounter++
char := clip%InternalCounter%
SendInput %char%
If InternalCounter >= %clip0%
break
}
If InternalCounter >= %clip0%
{
Hotkey, 3, off
Hotkey, 4, off
Hotkey, 5, off
}
return | Suffice to say that I use quite a bit of software where those key codes are easily copied to the clipboard. _________________ Ternary (a ? b : c) guide TSV Table Manipulation Library
Post code inside [code][/code] tags! |
|
| Back to top |
|
 |
Mock
Joined: 21 Feb 2007 Posts: 3
|
Posted: Thu Jul 24, 2008 5:02 pm Post subject: Thanx |
|
|
thanx VxE
Ill try and see if it also works with the games where my script didnt work. it seemed like they blocked my type of script. because it worked with other games |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|