да таже хрень. вроде нашёл на старом буке с xp но у меня не работает в win7, попробуй Add(MainForm,2953706,203,84) { Width=519 Height=357 Caption="Macro recorder" Position=1 } Add(InlineCode,38704,203,203) { WorkPoints=#27:doRecord=Записывает события|25:doPlay=Проигрывает запись|47:doStop=Останавливает запись или воспроизведение|35:doSaveStream=Сохраняет стрим в файл|39:doLoadStrream=Загружает запись из файла| EventPoints=#56:OnStateChange=Событие происходит при изменении состояния| VarPoints=#52:State=Состояние: запись, воспроизведение или простой| DataPoints=#77:SpeedFactor=Значение скорости замедления воспроизведения в процентах от 0-100|41:FileName=Имя файла для сохранения в стрим| Code=#80:{*******************************************************************************|80: HiAsm stamp component builder v0.7 (autor - andrestudio <andrestudio@list.ru>)|28: Component - Macro recorder|14: Version - IC|21: Autor - andrestudio|30: E-mail - andrestudio@list.ru|45: Create - четверг, 16. Апрель 2015, 10:55:57|76: Description: Macro recorder (запись/воспроизведение событий клавиатуры и |21: мыши.)|80:*******************************************************************************}|0:|15:unit HiAsmUnit;|0:|9:interface|0:|29:uses Windows,Kol,Share,Debug;|0:|4:type|52: TRecorderState = (rsIdle, rsRecording, rsPlaying);|68: TStateChangeEvent = procedure(NewState: TRecorderState) of object;|0:|25: PRecorder = ^TRecorder;|26: TRecorder = object(TObj)|9: private|24: EventMsg: TEventMsg;|27: FState: TRecorderState;|21: FStream: PStream;|24: HookHandle: THandle;|22: BaseTime: Integer;|26: FSpeedFactor: Integer;|21: FPaused: Boolean;|38: FOnStateChange: TStateChangeEvent;|51: procedure SetSpeedFactor(const Value: Integer);|52: procedure SetState(const Value: TRecorderState);|8: public|32: destructor Destroy; virtual;|41: procedure DoPlay(Continued: Boolean);|40: procedure DoRecord(Append: Boolean);|21: procedure DoStop;|19: procedure Play;|19: procedure Stop;|20: procedure Pause;|22: procedure Recorde;|73: property SpeedFactor: Integer read FSpeedFactor write SetSpeedFactor;|87: property OnStateChange: TStateChangeEvent read FOnStateChange write FOnStateChange;|47: property State: TRecorderState read FState;|42: property Stream: PStream read FStream;|6: end;|0:|4:type|0:|28: THiAsmClass = class(TDebug)|10: private|27: { Var methods variable }|55: { Состояние: запись, воспроизведение или простой }|19: fState: TData;|0:|9: public|17: { Data points}|58: { Значение скорости замедления в процентах от 0-100 }|28: SpeedFactor: THI_Event;|41: { Имя файла для сохранения в стрим }|25: FileName: THI_Event;|0:|19: { Event points }|30: OnStateChange: THI_Event;|0:|13: { Events }|51: { Событие происходит при изменении состояния }|56: procedure _OnStateChange(NewState: TRecorderState);|0:|14: { Methods }|27: { Записывает события }|50: procedure doRecord(var dt: TData; idx: Word);|27: { Проигрывает запись }|48: procedure doPlay(var dt: TData; idx: Word);|49: { Останавливает запись или воспроизведение }|48: procedure doStop(var dt: TData; idx: Word);|31: { Сохраняет стрим в файл }|54: procedure doSaveStream(var dt: TData; idx: Word);|34: { Загружает запись из файла }|55: procedure doLoadStrream(var dt: TData; idx: Word);|0:|20: { Var procedure }|55: { Состояние: запись, воспроизведение или простой }|47: procedure State(var dt: TData; idx: Word);|0:|6: end;|2: |32:function NewRecorder: PRecorder;|0:|3:var|27: TheRecorder: PRecorder; |0:|14:implementation|0:|14:uses Messages;|0:|81:function PlayProc(Code: Integer; Undefined: WPARAM; P: LParam): LResult; stdcall;|5:begin|14: Result := 0;|18: if Code < 0 then|72: Result := CallNextHookEx(TheRecorder.HookHandle, Code, Undefined, P)|6: else|7: begin|16: case Code of|14: HC_SKIP:|13: begin|73: if TheRecorder.FStream.Position < TheRecorder.FStream.Size then|15: begin|77: TheRecorder.FStream.Read(TheRecorder.EventMsg, SizeOf(EventMsg));|112: TheRecorder.EventMsg.Time := TheRecorder.SpeedFactor * (Integer(TheRecorder.EventMsg.Time) div 100);|99: TheRecorder.EventMsg.Time := Integer(TheRecorder.EventMsg.Time) + TheRecorder.BaseTime;|13: end|14: else|41: TheRecorder.SetState(rsIdle);|12: end;|17: HC_GETNEXT:|13: begin|63: Result := TheRecorder.EventMsg.Time - GetTickCount();|28: if Result < 0 then|24: Result := 0;|48: PEventMsg(P)^ := TheRecorder.EventMsg;|12: end;|8: else|44: PEventMsg(P)^ := TheRecorder.EventMsg;|74: Result := CallNextHookEx(TheRecorder.HookHandle, Code, Undefined, P)|8: end;|6: end;|4:end;|0:|83:function RecordProc(Code: Integer; Undefined: WPARAM; P: LParam): LResult; stdcall;|5:begin|14: Result := 0;|18: if Code < 0 then|72: Result := CallNextHookEx(TheRecorder.HookHandle, Code, Undefined, P)|6: else|7: begin|16: case Code of|16: HC_ACTION:|13: begin|48: TheRecorder.EventMsg := PEventMsg(P)^;|97: TheRecorder.EventMsg.Time := Integer(TheRecorder.EventMsg.Time) - TheRecorder.BaseTime;|88: TheRecorder.FStream.Write(TheRecorder.EventMsg, SizeOf(TheRecorder.EventMsg));|12: end;|0:|22: HC_SYSMODALON: ;|21: HC_SYSMODALOFF:|8: end;|6: end;|4:end;|0:|0:|32:function NewRecorder: PRecorder;|5:begin|27: if TheRecorder = nil then|7: begin|24: New(Result, Create);|38: Result.FStream := NewMemoryStream;|51: Result.FSpeedFactor := 100; //100: normal speed|28: Result.FPaused := False;|5: end|6: else|26: Result := TheRecorder;|9: //FAIL;|4:end;|0:|29:destructor TRecorder.Destroy;|5:begin|9: DoStop;|15: FStream.Free;|12: inherited;|4:end;|0:|25:procedure TRecorder.Play;|5:begin|18: doPlay(FPaused);|4:end;|0:|25:procedure TRecorder.Stop;|5:begin|19: FPaused := False;|9: doStop;|4:end;|0:|26:procedure TRecorder.Pause;|5:begin|18: FPaused := True;|9: doStop;|4:end;|0:|28:procedure TRecorder.Recorde;|5:begin|20: doRecord(FPaused);|4:end;|0:|47:procedure TRecorder.DoPlay(Continued: Boolean);|5:begin|25: if State <> rsIdle then|8: Exit|31: else if FStream.Size = 0 then|8: Exit|6: else|7: begin|25: if not Continued then|31: FStream.Seek(0, spBegin);|45: FStream.Read(EventMsg, SizeOf(EventMsg));|80: HookHandle := SetWindowsHookEx(WH_JOURNALPLAYBACK, @PlayProc, HInstance, 0);|26: if HookHandle = 0 then|10: Exit|8: else|9: begin|33: BaseTime := GetTickCount();|26: SetState(rsPlaying);|8: end;|6: end;|4:end;|0:|46:procedure TRecorder.DoRecord(Append: Boolean);|5:begin|25: if State <> rsIdle then|8: Exit|6: else|7: begin|22: if not Append then|9: begin|24: FStream.Size := 0;|33: BaseTime := GetTickCount();|7: end|8: else|9: begin|25: EventMsg.Time := 0;|30: if FStream.Size > 0 then|11: begin|51: FStream.Seek(-SizeOf(EventMsg), SpCurrent);|61: FStream.Read(TheRecorder.EventMsg, SizeOf(EventMsg));|10: end;|49: BaseTime := GetTickCount() - EventMsg.Time;|8: end;|80: HookHandle := SetWindowsHookEx(WH_JOURNALRECORD, @RecordProc, HInstance, 0);|26: if HookHandle = 0 then|10: Exit|8: else|9: begin|28: SetState(rsRecording);|8: end;|6: end;|4:end;|0:|27:procedure TRecorder.DoStop;|5:begin|19: SetState(rsIdle);|4:end;|0:|57:procedure TRecorder.SetSpeedFactor(const Value: Integer);|5:begin|19: if Value > 0 then|26: FSpeedFactor := Value;|4:end;|0:|58:procedure TRecorder.SetState(const Value: TRecorderState);|5:begin|57: if (Value = rsIdle) and (HookHandle <> THandle(0)) then|7: begin|36: UnHookWindowsHookEx(HookHandle);|29: HookHandle := THandle(0);|6: end;|25: if Value <> FState then|7: begin|20: FState := Value;|36: if Assigned(FOnStateChange) then|28: FOnStateChange(FState)|6: end;|4:end;|0:|46:{ Событие происходит при изменении состояния }|37:procedure THiAsmClass._OnStateChange;|5:begin|19: case NewState of |52: rsIdle : _hi_onEvent(OnStateChange, 'Stop');|54: rsRecording: _hi_onEvent(OnStateChange, 'Record');|52: rsPlaying: _hi_onEvent(OnStateChange, 'Play');|6: end;|4:end;|0:|22:{ Записывает события }|31:procedure THiAsmClass.doRecord;|20:var Append: Boolean;|5:begin|46: TheRecorder.OnStateChange := _OnStateChange;|22: TheRecorder.Recorde;|4:end;|0:|22:{ Проигрывает запись }|29:procedure THiAsmClass.doPlay;|23:var Continued: Boolean;|16: sf: Integer;|5:begin|40: sf := ReadInteger(dt,SpeedFactor,100);|32: TheRecorder.SpeedFactor := sf;|19: TheRecorder.Play;|4:end;|0:|44:{ Останавливает запись или воспроизведение }|29:procedure THiAsmClass.doStop;|5:begin|19: TheRecorder.Stop;|4:end;|0:|26:{ Сохраняет стрим в файл }|35:procedure THiAsmClass.doSaveStream;|5:begin|0:|4:end;|0:|29:{ Загружает запись из файла }|36:procedure THiAsmClass.doLoadStrream;|5:begin|0:|4:end;|0:|50:{ Состояние: запись, воспроизведение или простой }|28:procedure THiAsmClass.State;|5:begin|0:|4:end;|0:|14:initialization|21: TheRecorder := nil;|29: TheRecorder := NewRecorder;|12:finalization|19: TheRecorder.Free;|0:|4:end.| link(OnStateChange,14419608:doWork2,[(325,209)(325,132)]) link(SpeedFactor,11249542:Position,[]) } Add(Button,14556701,105,203) { Left=10 Top=20 Width=70 Height=40 Caption="Record" link(onClick,38704:doRecord,[]) } Add(Button,9311543,105,238) { Left=10 Top=110 Width=70 Height=40 Caption="Play" link(onClick,38704:doPlay,[(156,244)(156,216)]) } Add(Button,6327246,105,273) { Left=10 Top=65 Width=70 Height=40 Caption="Stop" link(onClick,38704:doStop,[(168,279)(168,223)]) } Add(Edit,14711492,364,147) { Left=100 Top=175 Width=390 Text="" } Add(Button,16000168,259,84) { Left=435 Top=205 Caption="Clear" link(onClick,12245490:doEvent1,[]) } Add(Hub,12245490,315,84) { link(onEvent1,12008161:doClear,[]) link(onEvent2,14419608:doWork1,[(345,97)]) } Add(UpDown,11249542,203,147) { Left=55 Top=175 Width=25 Height=25 Max=100 Position=100 link(onPosition,6982431:doText,[]) } Add(Label,6982431,259,147) { Left=10 Top=175 Width=37 Height=28 Font=[MS Sans Serif,14,1,0,1] Caption="100" } Add(RichEdit,12008161,364,77) { Left=100 Top=20 Width=390 Height=140 Font=[MS Sans Serif,12,1,0,1] } Add(TrackBar,12007277,266,280) { Left=15 Top=240 Width=475 Max=100 TickCount=5 ThumbLength=24 link(onPosition,15824276:doPosition,[]) } Add(ProgressBar,15824276,329,280) { Left=20 Top=290 Width=465 } Add(HubEx,14419608,341,126) { Angle=1 link(onEvent,14711492:doText,[(345,153)]) }
Редактировалось 1 раз(а), последний 2019-01-23 20:24:37
|