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!