Code:
;
; AutoHotkey Version: 1.x
; Language: English
; Platform: Win9x/NT
; Author: A.N.Other <myemail@nowhere.com>
;
; Script Function:
; Template script (you can customize this template by editing "ShellNew\Template.ahk" in your Windows folder)
;
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
CoordMode mouse, screen
x = 1
Gui, Font, s11 normal
Gui, Add, ListView, x6 y150 w490 h550 Grid -LV0x10 NoSortHdr NoSort AltSubmit Report gSubListView vVarListView, X | Y |Left Button |Middle Button |Right Button |Wheel Up |Wheel Down | Activate Window | Time
Gui, Add, Edit, x56 y40 w70 h20 vrepeat, ; repeat Time
Gui, Add, Edit, w235 vfiletorun ReadOnly
Gui, Add, Text, x65 y20 w50 h20 , Repeat
Gui, Add, Button, x126 y40 w80 h20 , Ok
Gui, Add, Button, x236 y30 w100 h30 , Load
Gui, Add, Button, x346 y30 w100 h30 , Save
Gui, Add, Button, x295 y65 w100 h30 , Browse
Gui, Add, Button, x5 y65 w50 h30 , Run
Gui, Add, Button, x430 y92 w50 h50 ghotkeyx, Set Hotkey
Gui, Add, Button, x205 y5 w100 h20 ,CLEAR
Gui, Add, Text, x5 y110 w50 h30 , Record
Gui, Add, Hotkey, x57 y108 w80 h20 vrecord ,F1
Gui, Add, Text, x150 y110 w50 h30 , Stop
Gui, Add, Hotkey, x190 y108 w80 h20 vstop ,F2
Gui, Add, Text, x300 y110 w50 h30 , Play
Gui, Add, Hotkey, x340 y108 w80 h20 vplay ,F3
Gui, Show, x422 y3 h700 w500 ,MoRe
Hotkey ,F1 ,gui_start
Hotkey ,F2 ,gui_stop
Hotkey ,F3 ,gui_play
WM_LBUTTONDOWN = 0x0201
OnMessage( WM_LBUTTONDOWN, "HandleMessage" )
WM_RBUTTONDOWN = 0x0204
OnMessage( WM_RBUTTONDOWN, "HandleMessage" )
Return
GuiClose:
ExitApp
ButtonLoad:
FileSelectFile ,loadfilex,,,,*.rec
;###############STRING SPLIT#############
FileRead,Mouse_moves, %loadfilex%
StringReplace, Mouse_data, Mouse_moves, `r`n, @, All
StringSplit, Mouse_data_, Mouse_data , @
Loop, %Mouse_data_0% ;mouse_data_0 = lines number
{
StringSplit, Mouse_data_%A_Index%_, Mouse_data_%A_Index% ,|
LV_Add(%A_Index%,Mouse_data_%A_Index%_1,Mouse_data_%A_Index%_2,Mouse_data_%A_Index%_3,Mouse_data_%A_Index%_4,Mouse_data_%A_Index%_5,Mouse_data_%A_Index%_6,Mouse_data_%A_Index%_7,Mouse_data_%A_Index%_8,Mouse_data_%A_Index%_9)
Lv_ModifyCol(1,"Center")
Lv_ModifyCol(2,"Center")
Lv_ModifyCol(3,"Center")
Lv_ModifyCol(4,"Center")
Lv_ModifyCol(5,"Center")
Lv_ModifyCol(6,"Center")
Lv_ModifyCol(7,"Center")
Lv_ModifyCol(8,"Center")
Lv_ModifyCol(9,"Center")
}
;#########################################
Return
ButtonSave:
FileSelectFile ,savefile,S,,,*.rec
IfExist ,%savefile%
{
MsgBox 4,Warning, This file already exist do you want to Overwrite it?
}
IfMsgBox Yes
{
FileDelete %savefile%
ControlGet, List, List, %A_Tab%, SysListView321,MoRe
StringReplace ,List1,List,%A_Tab%,|,All
StringReplace ,List1,List,%A_Tab%,|,All
FileAppend %List1%, %savefile%
}
IfMsgBox No
{
Return
}
Else
{
FileDelete %savefile%
ControlGet, List, List, %A_Tab%, SysListView321,MoRe
StringReplace ,List1,List,%A_Tab%,|,All
StringReplace ,List1,List,%A_Tab%,|,All
FileAppend %List1%, %savefile%
}
Return
ButtonBrowse:
FileSelectFile ,runf,,,,*.rec
GuiControl ,,filetorun,%runf%
Return
ButtonRun:
Gui, submit, nohide
GuiControlGet ,runn,,filetorun
Run %runn%
Return
ButtonOk:
Gui, submit, nohide
FileRead,Mouse_moves, %loadfilex%
StringReplace, Mouse_data, Mouse_moves, `r`n, @, All
StringSplit, Mouse_data_, Mouse_data , @
FileReadLine ,time_out, %loadfilex%, %Mouse_data_0%
StringSplit ,time_out_,time_out,|
repeattimes = %time_out_9%
Return
ButtonCLEAR:
Reload
Return
hotkeyx:
Gui, submit, nohide
GuiControlGet ,record1,,record
GuiControlGet ,stop1,,stop
GuiControlGet ,play1,,play
Hotkey ,%record1%, gui_start
Hotkey ,%stop1%, gui_stop
Hotkey ,%play1%, gui_play
Return
gui_start:
Mouse_moves =
Wheel_up =
Wheel_down =
Time_old := A_TickCount
SetTimer, WatchMouse, Off
SetTimer, WatchMouse, 10
SetTimer, WatchMouse, on
Return
gui_stop:
SetTimer, WatchMouse, Off
ToolTip
Return
gui_play:
Gosub, replay
WinHide
Return
WatchMouse:
Time_Index := A_TickCount - Time_old
MouseGetPos, xpos, ypos
WinGetActiveTitle , zz
GetKeyState, lButt, LButton
GetKeyState, mButt, MButton
GetKeyState, rButt, RButton
;~ Mouse_Data = %xpos%|%ypos%|%lButt%|%mButt%|%rButt%|%Wheel_up%|%Wheel_down%|%zz%|%Time_Index%`r`n
ToolTip, recording
If (xpos<>xpos_old OR ypos<>ypos_old OR Wheel_up OR Wheel_down OR lButt<>Lbutt_old OR mButt<>mButt_old OR rButt<>rButt_old)
{
xpos1 = % "xpos"
ypos1 = % "ypos"
lButt1 = % "lButt"
mButt1 = % "mButt"
Wheel_up1 = % "Wheel_up"
Wheel_down1 = % "Wheel_down"
zz1 = % "zz"
Time_Index1 = % "Time_Index"
LV_Add("",%xpos1%,%ypos1%,%lButt1%,%mButt1%,%rButt1%,%Wheel_up1%,%Wheel_down1%,%zz1%,%Time_Index1%)
xpos_old := xpos
ypos_old := ypos
lButt_old := lButt
mButt_old := mButt
rButt_old := rButt
Wheel_up =
Wheel_down =
}
Lv_ModifyCol(1,"Center")
Lv_ModifyCol(2,"Center")
Lv_ModifyCol(3,"Center")
Lv_ModifyCol(4,"Center")
Lv_ModifyCol(5,"Center")
Lv_ModifyCol(6,"Center")
Lv_ModifyCol(7,"Center")
Lv_ModifyCol(8,"Center")
Lv_ModifyCol(9,"Center")
Return
replay:
ControlGet, List, List, %A_Tab%, SysListView321,MoRe
Loop, Parse, List, | ; Rows are delimited by linefeeds (`n).
{
Loop, Parse, A_LoopField, %A_Tab% ; Fields (columns) in each row are delimited by tabs (A_Tab).
Listview1 = %List1%
}
FileAppend ,%Listview1%,aaa.txt
StringReplace ,List1,List,%A_Tab%,|,All
StringReplace, Mouse_data, List1, `n, @, All
StringSplit, Mouse_data_, Mouse_data , @
Loop, %Mouse_data_0%
StringSplit, Mouse_data_%A_Index%_, Mouse_data_%A_Index% ,|
Data_Index = 1
Data_Index_old := 1
title := Mouse_data_1_8
WinActivate, %title%
Time_old := A_TickCount
SetTimer, Replaytimer, Off
SetTimer, Replaytimer, 10
SetTimer, Replaytimer, On
Return
;********************************************
replaytimer:
Time_Index := A_TickCount - Time_old
Mouse_data_%Data_Index%_9 += 0
If (Time_Index > Mouse_data_%Data_Index%_9)
{
MouseMove, Mouse_data_%Data_Index%_1, Mouse_data_%Data_Index%_2
lButt := Mouse_data_%Data_Index%_3
mButt := Mouse_data_%Data_Index%_4
rButt := Mouse_data_%Data_Index%_5
wheel_up := Mouse_data_%Data_Index%_6
wheel_down := Mouse_data_%Data_Index%_7
If (Mouse_data_%Data_Index_old%_3 <> Mouse_data_%Data_Index%_3)
MouseClick , Left ,,,,, %lButt%
If (Mouse_data_%Data_Index_old%_4 <> Mouse_data_%Data_Index%_4)
MouseClick , middle ,,,,, %mButt%
If (Mouse_data_%Data_Index_old%_5 <> Mouse_data_%Data_Index%_5)
MouseClick , Right ,,,,, %rButt%
If (Mouse_data_%Data_Index%_6)
MouseClick, WheelUp, , , %wheel_up%
If (Mouse_data_%Data_Index%_7)
MouseClick, Wheeldown, , , %wheel_down%
Data_Index_old := Data_Index
Data_Index += 1
If (Data_Index = Mouse_data_0)
{
SetTimer Replaytimer, Off
GuiControlGet ,aaaa,,,repeat
WinShow MoRe
Data_Index = 0
}
}
; x := Mouse_data_%Data_Index%_9
; tooltip %Time_Index%_%A_TickCount% - %Time_old% __%x%
Return
HandleMessage( p_w, p_l, p_m, p_hw )
{
if ( A_GuiControl = "VarListView" )
{
VarSetCapacity( htinfo, 20 )
DllCall( "RtlFillMemory", "uint", &htinfo, "uint", 1, "uchar", p_l & 0xFF )
DllCall( "RtlFillMemory", "uint", &htinfo+1, "uint", 1, "uchar", ( p_l >> 8 ) & 0xFF )
DllCall( "RtlFillMemory", "uint", &htinfo+4, "uint", 1, "uchar", ( p_l >> 16 ) & 0xFF )
DllCall( "RtlFillMemory", "uint", &htinfo+5, "uint", 1, "uchar", ( p_l >> 24 ) & 0xFF )
; LVM_SUBITEMHITTEST
SendMessage, 0x1000+57, 0, &htinfo,, ahk_id %p_hw%
sel_item := ErrorLevel
if ( sel_item = -1 )
return
; LVHT_NOWHERE
if ( *( &htinfo+8 ) & 1 )
%A_GuiControl%@sel_col = 0
else
%A_GuiControl%@sel_col := 1+*( &htinfo+16 )
}
ToolTip
}
SubListView:
if A_GuiEvent in DoubleClick
{
LV_GetText(cel,A_EventInfo,VarListView@sel_col) ;get text in each col and row
InputBox ,Cell, Input Value,,,123,103,,,,, %cel%
content = % "Cell"
;~ ToolTip , Column = %VarListView@sel_col%`, Row = %A_EventInfo%, 10,10
;a eveninfo = row varlistview = col
;Get Text In That Row
LV_GetText(Text1, A_EventInfo, 1)
LV_GetText(Text2, A_EventInfo, 2)
LV_GetText(Text3, A_EventInfo, 3)
LV_GetText(Text4, A_EventInfo, 4)
LV_GetText(Text5, A_EventInfo, 5)
LV_GetText(Text6, A_EventInfo, 6)
LV_GetText(Text7, A_EventInfo, 7)
LV_GetText(Text8, A_EventInfo, 8)
LV_GetText(Text9, A_EventInfo, 9)
Text11 = % "Text1"
Text22 = % "Text2"
Text33 = % "Text3"
Text44 = % "Text4"
Text55 = % "Text5"
Text66 = % "Text6"
Text77 = % "Text7"
Text88 = % "Text8"
Text99 = % "Text9"
If VarListView@sel_col = 1
{
Lv_Modify(A_EventInfo,"",%content%)
}
Else If VarListView@sel_col = 2
{
LV_Modify(A_EventInfo,"",%Text11%, %content%)
}
Else If VarListView@sel_col = 3
{
Lv_Modify(A_EventInfo,"",%Text11%, %Text22%, %content%)
}
Else If VarListView@sel_col = 4
{
Lv_Modify(A_EventInfo,"",%Text11%, %Text22%, %Text33%, %content%)
}
Else If VarListView@sel_col = 5
{
Lv_Modify(A_EventInfo,"",%Text11%, %Text22%, %Text33%, %Text44%, %content%)
}
Else If VarListView@sel_col = 6
{
Lv_Modify(A_EventInfo,"",%Text11%, %Text22%, %Text33%, %Text44%, %Text55%, %content%)
}
Else If VarListView@sel_col = 7
{
Lv_Modify(A_EventInfo,"",%Text11%, %Text22%, %Text33%, %Text44%, %Text55%, %Text66%, %content%)
}
Else If VarListView@sel_col = 8
{
Lv_Modify(A_EventInfo,"",%Text11%, %Text22%, %Text33%, %Text44%, %Text55%, %Text66%, %Text77%, %content%)
}
Else If VarListView@sel_col = 9
{
Lv_Modify(A_EventInfo,"",%Text11%, %Text22%, %Text33%, %Text44%, %Text55%, %Text66%, %Text77%, %Text88%, %content%)
}
}
Return
Hey guys this is More with Gui you can record play load, edit it on list view etc... it's not perfect so pls...