"Mouse Keyboard Recorder" v2.1

Source: Internet
Author: User
Tags abs allkeys strlen trim

This is a simple mouse keyboard recorder, more than the AutoScriptWriter.exe AHK comes in handy.

;--------------------------------------
;  "Mouse Keyboard Recorder" v2.1 by Feiyue;  This script belongs to the Fool Type Automation script generator, than;  Ahk self-brought AutoScriptWriter.exe easy to use;  Instructions for use:;;  1. Clicking or dragging the mini-window will not be recorded when recording.  2, automatic recording mouse, keyboard operation and the current window;;  3. Click the lower left CTRL key to record the mouse movement;     4. To use absolute coordinates, the script can be executed automatically; Two places in paragraph;
Coordmode, Mouse semicolon cancel;--------------------------------------#NoEnv Suspend, on Menu, Tray, add Menu, Tray, add, Show hidden window
  menu, Tray, Default, Show hidden window Menu, Tray, Click, 1;---------------------Gui, +lastfound +alwaysontop-minimizebox +owner +hwndgui_id +e0x08000000 GUI, Margin, the GUI, Font, S12 GUI, Add, Button, g start or pause recording, start | pause gui, ADD, Button, x+0 g view and Repair Change record, view Gui, Add, Button, x+0 G save script, save GUI, Add, Button, x+0 G run script, run GUI, Show, NA, mouse keyboard recorder OnMessage (0x201, "Wm_lbutto Ndown "); Cancel these two places to record the absolute coordinates of the semicolon; Coordmode, Mouse Runfileadd: = "; Coordmode, Mouse "Return wm_lbuttondown (); The blank position of the mini window can also be dragged {listlines, Off if (A_gui=1 and a_guicontrol= ") PostMessage, 0xa1, 2} Guiclose:gui, Hide if! A_issuspended Gosub, start or pause recording ReTurn Show hidden window: ifwinexist, ahk_id%gui_id% Gosub, guiclose else GUI, show, NA Return start or pause recording: Suspend SetHotKey (! a_issuspended) SetTimer, crawl the current window,%! A_issuspended? : "Off", -10 Gui, Show, NA,% "Mouse keyboard recorder". (! A_issuspended?  "" In the Video "": "") return crawl Current window: Listlines, Off Critical if (Mouseongui) and Getkeystate ("Lbutton", "P") return Mousegetpos,,, mouse_id mouseongui:= (mouse_id=gui_id) if!
    Mouseongui {id:=winexist ("A") if (id=oldid) Return wingettitle, TT Wingetclass, TC if (tt= "" and Tc= "") Return oldid:=id wingettext, txt tx:= "", Len:=0 Loop, Parse, txt, ' n, ' r if StrLen (V:=trim (A_loopfield)) >l En tx:=v, Len:=strlen (v) ifwinnotexist, ahk_id%id%,%tx% tx=; Truncate the title and text, and correct the ANSI version of the error tt:=cut (TT), Tx:=cut (TX); Code correction title and text Tt:=zhuanyi (TT), Tx:=zhuanyi (TX) tt.=tc= ""? "": "Ahk_class" TC tt.=tx= ""? "": "", "%" "" TX Log (), logs.= "winwait,%" "" tt "" "nifwinnotactive". ",,, W InActivate ' nwinwaitactive ' Nsleep, ' n '} retuRN Cut (s,n=50) {s:=substr (s,1,50) GUI, 22:destroy GUI, 22:add, Edit Guicontrol, $:, Edit1,%s% Guicontrolget, R, A:, Edit1 Gui, 22:destroy Return, r=s?

S:substr (S,1,-1)} Zhuanyi (s) {S:=regexreplace (S, "[" ""] "," $0$0 ") Return, Strreplace (S,"; "," ";")} Viewing and modifying records:; Can view, modify the current record and run the script Suspend, Permit if! A_issuspended Gosub, start or Pause recording log () GUI, +disabled GUI, 11:destroy GUI, 11:+lastfound +alwaysontop-minimizebox +owner1 G UI, 11:font, S12 Cblue GUI, 11:add, button, w250 gchange GUI, 11:add, button, x+0 wp Gview GUI, 11:add, button, x+0 WP gCl Ear, empty (recoverable) GUI, 11:add, Edit, XM w750 h500 hscroll-wrap gui, 11:show, view and modify "current record" GUI, 11:default Gosub, view GUI, 1:d Efault winwaitclose,% "ahk_id" winexist () GUI, 11:destroy GUI,-disabled Return Change:guicontrolget, R,, Button1 if I Nstr (R, "current record") {guicontrolget, logs, Edit1 oldid:=logs= ""?
"": oldid} else {guicontrolget, S,, Edit1 f=%a_temp%\~test1.tmp filedelete,%f% fileappend,%s%,%f% s=}Gui, Hide Return View:guicontrolget, R,, Button1 if InStr (R, "current record") {f=%a_temp%\~test1.tmp FileRead, S,%f% Guico Ntrol, Button1, save run script Modify Guicontrol, Button2, run script-current record Gui, show, view and modify "Run script"} else {s:=logs Guicontrol ,, Button1, save current record modification Guicontrol, Button2, current record-run script Gui, show, view and modify "current record"} Guicontrol, Edit1,%s% Guicontrol , Focus, Edit1 s= Return Clear:guicontrolget, S,, Edit1 if s= s:=clears else clears:=s, s:= "" Guicontrol, Edit1,%s % Guicontrol, Focus, Edit1 s= Return save script:; Save the current record to run the script and empty the record Suspend, Permit if! A_issuspended Gosub, start or pause the video Gui, +owndialogs MsgBox, 4100, confirm replace, to save the current record to run the script.
' n ' n can view and modify the current record first. GUI, Hide GUI, Show, NA IfMsgBox, Yes log () else Return f=%a_temp%\~test1.tmp; The playback script can pause logs:= "#NoEnv ' n#singleinstance force ' n ' runfileadd by" pause ". "' N ' n ' Logs" ' Nreturn ' n ' npause:: Pause ' n ' filedelete,%f% fileappend,%logs%,%f% logs:=oldid:= "" Return Run Script:; Run the last saved run script Suspend, Permit if! a_issuspended Gosub, start or pause the recording f=%a_temp%\~test1.tmp ifexist,%f% Run,%a_ahkpath%/r/f "%f%", Useerrorlevel Return;--------------------- -------------SetHotKey (f:=1) {; set all hotkeys static AllKeys, filter:= ""; You can filter used hotkeys, comma-delimited if allkeys= {; filter will be associated with LS Hift, Lcontrol, Lalt and other conflicts of s:= "| Shift| control| alt| | "; Fill the main keyboard with the keypad virtual key code the same causes the missing s.= "| home| end| pgup| pgdn| Left| Right| up| down| ins| del|
    Numpadenter| " Loop, 254 {k:=getkeyname ("VK"). Format ("{: 02X}", A_index)) if StrLen (k) =1 Stringlower, K, K S.=instr (S, "|" K "|")?
    "": K "|"}
    S:=trim (SubStr (S,instr (S, "| |)"), "|") Allkeys:=regexreplace (S, "Control", "Ctrl")} f:=f?
   "On": "Off" Loop, Parse, AllKeys, | ; If A_loopfield not in%filter% Hotkey, ~*%a_loopfield%, Logkey,%f% useerrorlevel} logkey:; Response Hotkey Ifequal, Mouseongui, 1, Return Critical k:=substr (a_thishotkey,3); These keys use independent labels to avoid multi-threaded variable contamination if K contains Shift,ctrl,alt,win,button if Islabel (k) Goto,%k%; The processing QQ Chinese Input method automatically sends the left and right key to adjust the cursor situation if (k="Numpadleft" | | k= "Numpadright") and! Getkeystate (k, "P") Return log (k= "" "| | K= ";"? "'" K:strlen (k) =1? K: "{" K "}") Return LShift:RShift:LCtrl:; Click the lower left CTRL key to record the mouse movement RCtrl:LAlt:RAlt:LWin:RWin:log ("{" K "Down}") Critical, Off keywait,%a_thislabel% Critical K:=a_ Thislabel log ("{" K "up}") if (k= "Lctrl") and InStr (a_thishotkey,k) {mousegetpos, mx, my logs.= "' Nsleep," Nmousem Ove, ". MX "," my "' Nsleep," n "re:=" i) Send, \{lctrl down\} (' Nsleep, ' n '). "Send,")? \{lctrl up\} ' nsleep, + ' n ' logs:=regexreplace (logs,re)} Return LButton:RButton:MButton:MouseGetPos, MX, M y; Relative coordinates can be used when pressed Coordmode, Mouse mousegetpos,%k%x,%k%y%k%x-=mx,%k%y-=my log ("MouseClick," SubStr (k,1,1) "," MX "," my ", ,, D ") Critical, Off keywait,%a_thislabel% Critical k:=a_thislabel mousegetpos, MX, my; Use absolute coordinates when releasing, lest the window change mx-=%k%x, my-=%k%y log ("MouseClick," SubStr (k,1,1) "," MX "," my ",,, U") Return log (k:= "") {; Record function global logs s:=substr (LOGS,INSTR (logs, "' N", 0,0) +1); Gets the last row of data if k=; Add delay {settimer, Sendok, Off logs.= s= ""? "": "' nsleep, + ' n '} else if InStr (k," MouseClick "); Click in place to merge press up {Stringsplit, a, S, ',,%a_space% Stringsplit, B, K, ',,%a_space% if INSTR (S, "MouseClick") =1 A
    nd (a7= "D" and b7= "U") and (A2=B2) and Abs (A3-B3) +abs (A4-B4) < 5 logs:=substr (logs,1,-5) "' Nsleep, + ' n" else log (), logs.=k} else {if InStr (s, "Send") =1 and StrLen (s) < logs.=k else lo g (), logs.= "Send," "K SetTimer, Sendok," "Return Sendok:log () return};------------script end----------- -

;

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.