마우스, 키보드 레코더

관리자 | 2016.04.22 10:50 | 조회 2240

스크립트에 대한 설명: http://www.autohotkey.com/forum/topic52983.html&highlight=recording
에서 퍼온 글입니다.





<--------------------------------------------- AHK 스크립트 내용 --------------------------------------------->

;http://www.autohotkey.com/forum/topic52983.html&highlight=recording
;~ This is my first script and don't have much experience so that it may have some mistakes or some errors.
;~ Just test and give your opinion. I need more your help. Thanks :D
;~ Setting
SetKeyDelay,30
kenter:=chr(10)
ath=1
waitup=0
waitstop=0
waitplay=0
rep=0
Min2=0
CoordMode,Mouse,Screen
SetBatchLines,-1
#NoEnv
#SingleInstance,off

;~ Tray Menu
Menu,tray,NoStandard
Menu,tray,add,Record/Pause,Rec
Menu,tray,add,Play,Play
Menu,tray,add
menu,tray,add,Show
menu,tray,add,Hide
Menu,tray,disable,show
menu,tray,add,Exit,guiclose
Menu,tray,default,Show

Menu,File,add,Open...,ope
Menu,File,add,Save as...,sav
Menu,File,add,Exit,Guiclose

Menu,Help,Add,Help
Menu,Gui,add,File,:File
Menu,Gui,add,Help,:Help
Gui,menu,Gui
Gui, Font, CC0C0C0 ,
Gui,color,5D69BA,FFFFFF
Gui, Add, Button, x6 y10 w50 h30 vrec gRec, Record/Pause
Gui, Add, Button, x56 y10 w50 h30 gPlay, Play
Gui, Add, button, x156 y10 w50 h30 gClearAll, Clear All
Gui, Add, Button, x26 y330 w50 h30 gAdd, Add
Gui, Add, groupbox, x256 y10 w180 h130 , Hotkey
Gui, Add, Hotkey, x336 y30 w55 h20 vhrec, F1
Gui, Add, Hotkey, x336 y50 w55 h20 vhplay, F2
Gui, Add, Hotkey, x336 y70 w55 h20 vhbreak, F3
Gui, Add, Hotkey, x336 y90 w55 h20 vhclear, F4
Gui, Add, Hotkey, x336 y110 w55 h20 vhshow, F5
Gui, Add, Text, x266 y30 w70 h20 , Record/Pause
Gui, Add, Text, x266 y50 w70 h20 , Play
Gui, Add, Text, x266 y70 w70 h20 , Stop
Gui, Add, Text, x266 y90 w70 h20 , Clear
Gui, Add, Button, x391 y30 w30 h100 +0x1000, Set
Gui, Add, groupbox, x256 y140 w180 h110 , Setting
Gui, Add, checkbox, x266 y160 w160 h20 vath gath +Checked, Auto hide
Gui, Add, Checkbox, x266 y200 w160 h20 gmpos vmpos, Show the mouse postion
Gui, Add, Checkbox, x266 y180 w160 h20 vclear gclear, Clear data before recording
Gui, Add, CheckBox, x266 y290 w70 h20 grep vrep, Repeat
Gui, Add, Edit, x336 y290 w42 h20 +Number vrepn +Disabled c5D69BA,
Gui, Add, UpDown, x376 y290 w18 h20 Range1-999999,
Gui, Add, GroupBox, x256 y250 w180 h110 , Advance
Gui, Add, Button, x266 y270 w150 h20 goptimize, << Optimize moving
Gui, Add, Text, x266 y110 w70 h20 , Show
Gui, Add, CheckBox, x266 y220 w160 h20 gato vato, Auto optimize moving
Gui, Add, ListView, x6 y50 w230 h280 +NoSortHdr -LV0x10 vListview, No|Type|Info
Gui, Add, Edit, x266 y330 w120 h20 +Disabled vmmt c5D69BA vMid1,
Gui, Add, CheckBox, x266 y310 w150 h20 vMid_button gMid_button, Mid Button replace by text
Gui, Add, Button, x376 y330 w30 h20 +Disabled vMid3, ...
Gui, Add, StatusBar, x346 y330 w30 h20 , Current line :0
Gui, Add, Button, x86 y330 w50 h30 gChange, Change
Gui, Add, Button, x146 y330 w50 h30 gRemove, Remove
Gui, Add, Button, x106 y10 w50 h30 , Stop
Gui, Add, button, x206 y10 w40 h30 gMin vMin, <<
Gui +LastFound
ID:=WinActive(A)
Gui, Show, h388 w452, Mouse Recorder (demo version) created by ___x@___
Gui, 2:+owner1
Gui,2: Add, Text, x96 y100 w80 h20 , Mouse Button:
Gui,2: Add, Text, x16 y100 w70 h20 , Coord Mouse:
Gui,2: Add, Text, x16 y120 w10 h20 , X:
Gui,2: Add, Text, x16 y140 w10 h20 , Y:
Gui,2: Add, DropDownList, x96 y120 w80 h21 +R3 vM1, Left|Right|Mid
Gui,2: Add, Edit, x26 y120 w60 h20 vM2 +Number,0
Gui,2: Add, Edit, x26 y140 w60 h20 vM3 +Number,0
Gui,2: Add, GroupBox, x6 y90 w180 h80 ,
Gui,2: Add, GroupBox, x6 y30 w180 h40 ,
Gui,2: Add, Edit, x46 y40 w130 h20 vK1, Keys
Gui,2: Add, Text, x16 y40 w30 h20 , Keys:
Gui,2: Add, Radio, x6 y10 w180 h20 vR_Key gchange2, Key:
Gui,2: Add, Radio, x6 y70 w180 h20 vR_Mouse gchange2, Mouse
Gui,2: Add, Button, x26 y180 w50 h20 , OK
Gui,2: Add, Button, x116 y180 w50 h20 , Cancel
gosub,ButtonSet
Return
Button...:
Gui +OwnDialogs
Last_line=0
FileSelectFile,Temp,,,,Text file(*.txt)
If Temp=
   Return
Loop,Read,%Temp%
Last_line:=A_Index
If !Last_line
{
   MsgBox,48,ERROR!,Can't read the text file.
   Return
}
Return
Mid_text:
FileReadLine,Temp,%Sfile%,%Start_line%
Send {Raw}%Temp%
Start_line++
If Start_line>%Last_line%
Start_line=1
Return
Mid_button:
GuiControlGet,Mid_button,,Mid_button
GuiControl,Enable%Mid_button%,Mid3
Return
GuiClose:
ExitApp
Return
ato:
GuiControlGet,ato,,ato
Return
optimize:
Count=0
Loop,% LV_GetCount()-1
{
   Count++
   LV_GetText(Line1a,Count,2)
   LV_GetText(Line1b,Count,3)
   LV_GetText(Line2a,Count+1,2)
   LV_GetText(Line2b,Count+1,3)
   if (line1a=line2a) && (line1b=line2b)
   {
      LV_Delete(Count)
      Count--
   }
}
Gosub,Sort
Return
mpos:
GuiControlGet,mpos,,mpos
if mpos
   SetTimer,pos,1
Else
   SetTimer,pos,off
ToolTip
Return
pos:
MouseGetPos,xp,yp
ToolTip,x: %xp% `n y: %yp%
Return
rep:
GuiControlGet,rep,,rep
if rep
   GuiControl,enable,repn
Else GuiControl,enable0,repn
Return
tip:
SetTimer,tip,Off
TrayTip
Return
Return
show:
gui,show
Menu,tray,disable,Show
Menu,tray,enable,Hide
Return
hide:
gui,hide
Menu,tray,disable,Hide
Menu,tray,enable,Show
Return
clear:
GuiControlGet,clear,,clear
Return
ButtonSet:
GuiControlGet,hrec,,hrec
GuiControlGet,hplay,,hplay
GuiControlGet,hbreak,,hbreak
GuiControlGet,hclear,,hclear
GuiControlGet,hshow,,hshow

Hotkey,%hrec_old%,Rec,off UseErrorLevel
Hotkey,%hrec%,Rec,on UseErrorLevel
hrec_old:=hrec

Hotkey,%hplay_old%,Play,off UseErrorLevel
Hotkey,%hplay%,Play,on UseErrorLevel
hplay_old:=hplay

Hotkey,%hbreak_old%,lstop,off UseErrorLevel
Hotkey,%hbreak%,lstop,on UseErrorLevel
hbreak_old:=hbreak

Hotkey,%hclear_old%,ClearAll,off UseErrorLevel
Hotkey,%hclear%,ClearAll,on UseErrorLevel
hclear_old:=hclear

Hotkey,%hshow_old%,show,off UseErrorLevel
Hotkey,%hshow%,show,on UseErrorLevel
hshow_old:=hshow
Return
lstop:
lstop=1
waitpause=0
Return
ath:
GuiControlGet,ath,,ath
Return
ope:
gui +OwnDialogs
FileSelectFile,file,,%root%,Open,Mouse Record File(*.mrc)
if file=
   Return
SplitPath,file,,root,ext
if ext<>mrc
   Return
Loop,Read,%file%
{
   StringSplit,Temp,A_loopReadLine,|
   LV_Add("",Temp1,Temp2,Temp3)
   }
Gosub,Stop_record
Return
sav:
gui +OwnDialogs
FileSelectFile,file,S16,%root%,Save,Mouse Record File(*.mrc)
if file=
   Return
SplitPath,file,,root,,file
FileDelete,%file%
Loop % LV_GetCount()
{
   LV_GetText(Temp,A_Index,1)
   LV_GetText(Temp2,A_Index,2)
   LV_GetText(Temp3,A_Index,3)
   FileAppend,% Temp "|" Temp2 "|" Temp3 "`n",%root%\%file%.mrc
   }
Return
ClearAll:
LV_Delete()
Return
Return
Return
Rec:
if waitplay
   Goto Pause_loop
if waitstop
   goto,Stop_record
Gosub,hide
if clear
   LV_Delete()
TrayTip,,Recording...
SetTimer,tip,300
SetTimer,getpos,1
SetTimer,key,1
GuiControl,,rec,Stop
waitstop=1
Return
Stop_record:
   waitstop=0
   SetTimer,getpos,off
   SetTimer,key,Off
    Gosub,checkdata
   if ato
      Gosub optimize
   GuiControl,,rec,Record
   GuiControl,Enable,Play
   guicontrolget,ath,,ath
   if not ath
      Gosub,show
   TrayTip,,Stopping Recording...
   SetTimer,tip,700
Return
Pause_loop:
lpause=1
Return
Play:
If  waitplay
   Goto Pause_loop
if waitstop
   Return
Gosub,hide
waitplay=1
lstop=0
lpause=0
GuiControlGet,Sfile,,Mid1
TrayTip,,Playing...
SetTimer,tip,700
BlockInput,MouseMove
If waitpause
   Goto,resume
crep=1
loop:
Start_line=1
Count=1
resume:
loop,% LV_GetCount()
   {
      if lstop
         Break
      If lpause
       {
         waitpause=1
         Break
         }
      LV_GetText(Temp,Count,2)
      LV_GetText(Temp2,Count,3)
      if Temp=Key
      {
         Send {%Temp2%}
         Count++
         Continue
      }
      StringSplit,pos,Temp2 ,%A_Space%
      Mousemove,pos1,pos2,0
       if pos3
        if not waitup3
        {
         MouseClick,Left,pos1,pos2,,0,D
         waitup3=1
         SetTimer,Left,1
      }
       if pos4
        if not waitup4
        {
         MouseClick,right,pos1,pos2,,0,D
         waitup4=1
         SetTimer,Right,1
      }
        if pos5
        if not waitup5
        {  
         if Mid_button
         Gosub Mid_text
         Else
         MouseClick,Middle,pos1,pos2,,0,D
         waitup5=1
         SetTimer,Mid,1
      }
   Count++
   SB_SetText("Current line :" Count)
   }
If !waitpause && !lstop
if rep
{
   GuiControlGet,repn,,repn
   if crep>=%repn%
   Goto,out
   crep++
   Goto,loop
}
out:
BlockInput,MouseMoveOff
waitplay=0
lstop=0
lpause=0
TrayTip,,Stopping Playing...
SetTimer,tip,700
if not ath
   Gosub,show
Return
;~ MouseClick:
Left:
if pos3
   Return
waitup3:=0
MouseClick,Left,pos1,pos2,,0,U
SetTimer,Left,Off
Return
Right:
if pos4
   Return
waitup4:=0
MouseClick,right,pos1,pos2,,0,U
SetTimer,Right,Off
Return
Mid:
if pos5
   Return
waitup5:=0
MouseClick,m,pos1,pos2,,0,U
SetTimer,Mid,Off
Return
;--------------------
getpos:
LButton:=GetKeyState("LButton","P")
RButton:=GetKeyState("RButton","P")
MButton:=GetKeyState("MButton","P")
MouseGetPos,x1,y1,win,con,1
if win=%ID%
{
   LButton=0
   MButton=0
   RButton=0
   }
LV_Add("","","Mouse",x1 A_space y1 A_space LButton A_space RButton A_space MButton A_space WheelUp A_space WheelDown)
Return
key:
Input,C_Key,I V L1 M,{BS}{%hrec%}{%hplay%}{%hshow%}{%hbreak%}
If ErrorLevel Contains EndKey
If ErrorLevel=EndKey:Backspace
C_Key=BS
Else Return
if C_Key=%kenter%
C_Key=Enter
if C_Key=%A_space%
C_Key=Space
LV_Add("","","Key",C_Key)
Return
checkdata:
kt=0
ok=0
Count=0
Loop,% LV_GetCount()
{
   Count++
   LV_GetText(key,Count,2)
   If key=Key
   {
      If kt=1
         If !ok
         {
            Loop % Last-First+1
               LV_Delete(First)
            Count:=First
         }
      First:=Count+1
      LV_GetText(Line1,First,3)  
      Last=
      kt=1
      ok=0
      Continue
   }
   If kt=1
   {
      LV_GetText(Line2,Count,3)
      If Line2=
      Break
      If Line1=%Line2%
         Last:=Count
      Else ok=1
   }
}
Gosub,sort
Return
sort:
Loop,% LV_GetCount()
   LV_Modify(A_Index,"",A_Index)
Return
Change:
Status=Change
Row:=LV_GetNext()
If !Row
   Return
LV_GetText(Temp2,Row,2)
LV_GetText(Temp3,Row,3)
If Temp2=Key
{
   GuiControl,2:,R_Key,1
   GuiControl,2:,K1,%Temp3%
}
Else
{
   GuiControl,2:,R_Mouse,1
   StringSplit,Temp,Temp3,%A_space%
   GuiControl,2:,M2,%Temp1%
   GuiControl,2:,M3,%Temp2%
   If Temp3
   GuiControl,2: Choose,M1,1
   If Temp4
   GuiControl,2: Choose,M1,2
   If Temp5
   GuiControl,2: Choose,M1,3
}
Gosub,change2
Gui,2: Show,h209 w199,Change
Gui,+disabled
Return
change2:
GuiControlGet,Temp,2:,R_Key
GuiControl,2: Enable%Temp%,K1
GuiControl,2: Disable%Temp%,M1
GuiControl,2: Disable%Temp%,M2
GuiControl,2: Disable%Temp%,M3
Return
Remove:
LV_Delete(LV_GetNext())
Gosub,sort
Return
2ButtonOK:
Gui,2: submit,NoHide
If !M1
M1=0 0 0
Else If M1=Left
M1=1 0 0
Else If M1=Right
M1=0 1 0
Gui,1: Default
If Status=Change
If R_Key
LV_Modify(Row,"","","Key",K1)
Else
LV_Modify(Row,"","","Mouse",M2 A_Space M3 A_Space M1)
If Status=Add
If R_Key
LV_Insert(Row,"","","Key",K1)
Else
LV_Insert(Row,"","","Mouse",M2 A_Space M3 A_Space M1)
Gosub,sort
2GuiClose:
2ButtonCancel:
Gui, 1:-Disabled
Gui,2: Hide
Return
Add:
Status=Add
Gui,1: +Disabled
Gui,2: Show,h209 w199,Add
Row:=LV_GetNext()+1
Return
Min:
If !Min2
{
GuiControl,,Min,>>
Min2:=!Min2
Gui,Show,h70 w251
Return
}
GuiControl,,Min,<<
Min2:=!Min2
Gui,Show,h388 w452
Return
Help:
MsgBox This is just a demo version!`n You can only record mouse and single keys.
Return
;~ Created by ___x@___

twitter facebook me2day 요즘
11개(1/1페이지)
오토마우스
번호 제목 글쓴이 조회 날짜
11 오토핫키 단축키 사용방법 : 관리자 1837 2016.04.25 15:31
10 복사한 내용 지우는 소스 관리자 1479 2016.04.25 15:08
9 LOOP 특정 창에서 정지 시키기 관리자 1579 2016.04.22 12:04
8 네/이/버 사이트 검색 하는 방법 관리자 1529 2016.04.22 12:00
7 오토핫키 단축키 및 활용 안내 관리자 1662 2016.04.22 11:59
>> 마우스, 키보드 레코더 사진 첨부파일 관리자 2241 2016.04.22 10:50
5 마우스 녹화 스크립트 소스 입니다. 관리자 1845 2016.04.22 10:39
4 마우스 좌표를 정해서 마우스 클릭 하는 방법 관리자 1652 2016.04.22 10:24
3 랜덤으로 마우스 클릭을 원합니다. 첨부파일 관리자 1655 2016.04.22 09:45
2 랜덤 마우스 활용법 1 관리자 1525 2016.04.22 09:43
1 오트핫키 사이트 입니다. 설치도 간단하고 활용도 높음. 첨부파일 관리자 1562 2016.04.22 09:39