pixartist Posted January 24, 2006 Share Posted January 24, 2006 I'm currently trying to create a script that records all your mouse and keyboard actions, and writes another script, which then replays them this is NOT intended to be a keylogger! (i'm the only one using my pc...so i wouldn't even need that) but it's a recording programm expandcollapse popup; ^ Ctrl ! Alt + Shift # Win $log = "" $timcalc = 0 $calcTime = 0 $mSpeed = 0 $leftMDown = 0 $rightMDown = 0 $sleeptime = 0 Dim $keys[106] Dim $oldpos[8] $fName = InputBox ( "Save", "Save Replay to") While 1 $calcstart = TimerInit() $sleeptime = $sleeptime + $calcTime $pos = mousegetPos() if $oldpos[0] <> $pos[0] OR $oldpos[1] <> $pos[1] then $log = $log & "mouseMove(" & $pos[0] & "," & $pos[1] & ", " & $mSpeed & ")" & @CRLF $oldpos = $pos RS() endif if _isPressed(01) AND $leftMDown == 0 then $leftMDown = 1 $log = $log & "mouseDown('left')" & @CRLF RS() endif if _isPressed(01) == 0 AND $leftMDown == 1 then $leftMDown = 0 $log = $log & "mouseUp('left')" & @CRLF RS() endif if _isPressed(02) AND $rightMDown == 0 then $rightMDown = 1 $log = $log & "mouseDown('right')" & @CRLF RS() endif if _isPressed(02) == 0 AND $rightMDown == 1 then $rightMDown = 0 $log = $log & "mouseUp('right')" & @CRLF RS() endif toggleKey("30",31,"0") toggleKey("31",32,"1") toggleKey("32",33,"2") toggleKey("33",34,"3") toggleKey("34",35,"4") toggleKey("35",36,"5") toggleKey("36",37,"6") toggleKey("37",38,"7") toggleKey("38",39,"8") toggleKey("39",40,"9") toggleKey("41",41,"a") toggleKey("42",42,"b") toggleKey("43",43,"c") toggleKey("44",44,"d") toggleKey("45",45,"e") toggleKey("46",46,"f") toggleKey("47",47,"g") toggleKey("48",48,"h") toggleKey("49",49,"i") toggleKey("4A",50,"j") toggleKey("4B",51,"k") toggleKey("4C",52,"l") toggleKey("4D",53,"m") toggleKey("4E",54,"n") toggleKey("4F",55,"o") toggleKey("50",56,"p") toggleKey("51",57,"q") toggleKey("52",58,"r") toggleKey("53",59,"s") toggleKey("54",60,"t") toggleKey("55",61,"u") toggleKey("56",62,"v") toggleKey("57",63,"w") toggleKey("58",64,"x") toggleKey("59",65,"y") toggleKey("5A",66,"z") toggleKey("08",6,"{BACKSPACE}") toggleKey("09",7,"{TAB}") toggleKey("0D",9,"{ENTER}") toggleKey("10",10,"") toggleKey("11",11,"{^}") toggleKey("12",12,"{ALT}") toggleKey("13",13,"{PAUSE}") toggleKey("14",14,"{CAPSLOCK}") toggleKey("1B",15,"{ESCAPE}") toggleKey("20",16,"{SPACE}") toggleKey("21",17,"{PGUP}") toggleKey("22",18,"{PGDN}") toggleKey("23",19,"{END}") toggleKey("24",20,"{HOME}") toggleKey("25",21,"{LEFT}") toggleKey("26",22,"{UP}") toggleKey("27",23,"{RIGHT}") toggleKey("28",24,"{DOWN}") toggleKey("2A",25,"{PRINT}") toggleKey("2D",26,"{INS}") toggleKey("2E",27,"{DELETE}") $calcTime = TimerDiff ( $calcstart ) Wend Exit Func RS() $log = $log & "sleep(" & $sleeptime & ")" & @CRLF $sleeptime = 0 EndFunc Func toggleKey($key,$number, $logE) if _isPressed($key) AND $keys[$number] == 0 then RS() $keys[$number] = 1 $mods = "" if $keys[10] == 1 then $mods = "+" endif if $keys[11] == 1 then $mods = $mods & "^" endif if $keys[12] == 1 then $mods = $mods & "!" endif $log = $log & "Send('"& $mods & $logE & "')" & @CRLF endif if _isPressed($key) == 0 AND $keys[$number] == 1 then RS() $keys[$number] = 0 endif EndFunc Func _IsPressed($hexKey) ; $hexKey must be the value of one of the keys. ; _IsPressed will return 0 if the key is not pressed, 1 if it is. ; $hexKey should entered as a string, don't forget the quotes! ; (yeah, layer. This is for you) Local $aR, $bO $hexKey = '0x' & $hexKey $aR = DllCall("user32", "int", "GetAsyncKeyState", "int", $hexKey) If Not @error And BitAND($aR[0], 0x8000) = 0x8000 Then $bO = 1 Else $bO = 0 EndIf Return $bO EndFunc ;==>_IsPressed #cs 01 Left mouse button 02 Right mouse button 04 Middle mouse button (three-button mouse) 05 Windows 2000/XP: X1 mouse button 06 Windows 2000/XP: X2 mouse button 08 BACKSPACE key 09 TAB key 0C CLEAR key 0D ENTER key 10 SHIFT key ;10 11 CTRL key 12 ALT key 13 PAUSE key 14 CAPS LOCK key 1B ESC key 20 SPACEBAR 21 PAGE UP key 22 PAGE DOWN key 23 END key 24 HOME key ;20 25 LEFT ARROW key 26 UP ARROW key 27 RIGHT ARROW key 28 DOWN ARROW key 29 SELECT key 2A PRINT key 2B EXECUTE key 2C PRINT SCREEN key 2D INS key 2E DEL key ;30 30 0 key 31 1 key 32 2 key 33 3 key 34 4 key 35 5 key 36 6 key 37 7 key 38 8 key 39 9 key ;40 41 A key 42 B key 43 C key 44 D key 45 E key 46 F key 47 G key 48 H key 49 I key 4A J key ;50 4B K key 4C L key 4D M key 4E N key 4F O key 50 P key 51 Q key 52 R key 53 S key 54 T key ;60 55 U key 56 V key 57 W key 58 X key 59 Y key 5A Z key 5B Left Windows key 5C Right Windows key 60 Numeric keypad 0 key 61 Numeric keypad 1 key;70 62 Numeric keypad 2 key 63 Numeric keypad 3 key 64 Numeric keypad 4 key 65 Numeric keypad 5 key 66 Numeric keypad 6 key 67 Numeric keypad 7 key 68 Numeric keypad 8 key 69 Numeric keypad 9 key 6A Multiply key 6B Add key ;80 6C Separator key 6D Subtract key 6E Decimal key 6F Divide key 70 F1 key 71 F2 key 72 F3 key 73 F4 key 74 F5 key 75 F6 key ;90 76 F7 key 77 F8 key 78 F9 key 79 F10 key 7A F11 key 7B F12 key 7C-7F F13 key - F16 key 80H-87H F17 key - F24 key 90 NUM LOCK key 91 SCROLL LOCK key;100 A0 Left SHIFT key A1 Right SHIFT key A2 Left CONTROL key A3 Right CONTROL key A4 Left MENU key A5 Right MENU key #ce Func OnAutoItExit() $file = FileOpen($fName & ".au3", 1) FileWrite($file, $log) FileClose($file) EndFunc the Problem is, that the script runs too slow. It happenes, that a keypress or mouseclick is not recorded. do you have an idea how to dramaticly increase the speed? my only idea would be to hook into active windows and get the keystrokes and clicks from there, but i'm not sure how to to that with autoIt!? thanks Link to comment Share on other sites More sharing options...
ChrisL Posted January 24, 2006 Share Posted January 24, 2006 There is a recorder in Scite which you can download in the downloads section of this site [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire Link to comment Share on other sites More sharing options...
pixartist Posted January 24, 2006 Author Share Posted January 24, 2006 thats cool, but i'd still be interested if it's possible to do that with autoIt! (downloading scite now) Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted January 24, 2006 Moderators Share Posted January 24, 2006 You're wanting to make a 'key logger'? They aren't welcomed here, per the creator of AutoIt. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
pixartist Posted January 24, 2006 Author Share Posted January 24, 2006 this is NOT intended to be a keylogger! (i'm the only one using my pc...so i wouldn't even need that) but it's a recording programm Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted January 24, 2006 Moderators Share Posted January 24, 2006 'Intended' and 'Is' are 2 different things... Doesn't matter, I'm saying... is it intended to record... mouse movements / key strokes / or anything else... then in fact it 'is' a keylogger. Doesn't matter your intentions honorable or non honorable. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
pixartist Posted January 24, 2006 Author Share Posted January 24, 2006 so should i delete this`? the scite recorder is a keylogger too if you see it like that... Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted January 24, 2006 Moderators Share Posted January 24, 2006 so should i delete this`?the scite recorder is a keylogger too if you see it like that...Then you have all your needs taken care of it would seem. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now