AutoHotkey Community

It is currently May 24th, 2012, 6:40 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 6 posts ] 
Author Message
PostPosted: February 21st, 2007, 2:51 pm 
Offline

Joined: February 21st, 2007, 2:50 pm
Posts: 3
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

    }
}


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 22nd, 2007, 4:03 am 
Offline

Joined: November 12th, 2005, 10:25 pm
Posts: 73
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...


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 23rd, 2007, 12:10 am 
Offline

Joined: February 21st, 2007, 2:50 pm
Posts: 3
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


Report this post
Top
 Profile  
Reply with quote  
PostPosted: July 20th, 2008, 10:44 am 
Offline

Joined: July 20th, 2008, 7:53 am
Posts: 2
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!


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 20th, 2008, 7:15 pm 
Offline
User avatar

Joined: October 7th, 2006, 8:45 am
Posts: 3328
Location: Simi Valley, CA
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!


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Thanx
PostPosted: July 24th, 2008, 6:02 pm 
Offline

Joined: February 21st, 2007, 2:50 pm
Posts: 3
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


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 11 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group