#NoTrayIcon #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Icon=..\IDE\Resources\img\FSPACTIONSRECORDER.ico #AutoIt3Wrapper_UseX64=n #AutoIt3Wrapper_Res_Description=FSPActionsRecorder #AutoIt3Wrapper_Res_Fileversion=1.0.0.0 #AutoIt3Wrapper_Res_ProductVersion=1,0,0,0 #AutoIt3Wrapper_Res_LegalCopyright=© 2012 LeCoindAide.com #AutoIt3Wrapper_Res_Language=1036 #AutoIt3Wrapper_Res_requestedExecutionLevel=asInvoker #AutoIt3Wrapper_Run_Obfuscator=y #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #Region AutoIt3Wrapper directives section #EndRegion #include #include #Include #cs ---------------------------------------------------------------------------- AutoIt Version : 3.3.8.1 Auteur: TT22 Fonction du Script : Converti des actions de l'utilisateur en script FSProg. #ce ---------------------------------------------------------------------------- Dim $Key[88][2] = [["41","a"],["42","b"],["43","c"],["44","d"],["45","e"],["46","f"],["47","g"],["48","h"],["49","i"],["4A","j"], _ ["4B","k"],["4C","l"],["4D","m"],["4E","n"],["4F","o"],["50","p"],["51","q"],["52","r"],["53","s"],["54","t"], _ ["55","u"],["56","v"],["57","w"],["58","x"],["59","y"],["5A","z"], _ ["60","0"],["61","1"],["62","2"],["63","3"],["64","4"],["65","5"],["66","6"],["67","7"],["68","8"],["69","9"], _ ["30","0"],["31","1"],["32","2"],["33","3"],["34","4"],["35","5"],["36","6"],["37","7"],["38","8"],["39","9"], _ ["5B","{win}"],["09","{tab}"],["11","{ctrl}"],["12","{alt}"],["1B","{esc}"],["2C","{print}"],["0D","{enter}"],["08","{bs}"],["2E","{del}"],["14","{caps}"], _ ["20","{space}"],["26","{up}"],["28","{down}"],["25","{left}"],["27","{right}"],["6D","{less}"],["6B","{plus}"],["6A","{mult}"],["6F","{divi}"], _ ["70","{f1}"], ["71","{f2}"],["72","{f3}"],["73","{f4}"],["74","{f5}"],["75","{f6}"],["76","{f7}"],["77","{f8}"],["78","{f9}"],["79","{f10}"], _ ["7A","{f11}"],["7B","{f12}"],["13","{pause}"],["21","{pup}"],["22","{pdown}"],["23","{end}"],["24","{home}"],["29","{sel}"],["2D","{ins}"],["6C","{sep}"], _ ["90","{numlock}"],["91","{scroll}"]] $Gui = GUICreate("FSP Actions Recorder",500,500) GUISetBkColor(0xCCCCCC,$Gui) $Img = GUICtrlCreatePic(@ScriptDir&"\Resources\img\FSPARLOGO.bmp",150,20,200,200) $ButtonStart = GUICtrlCreateButton("Commencer l'enregistrement",100,225,300,50) $CheckBoxMouseClic = GUICtrlCreateCheckbox("Enregistrer les clics",50,295,400,20) GUICtrlSetState($CheckBoxMouseClic, $GUI_CHECKED) $CheckBoxMouseMoveClic = GUICtrlCreateCheckbox("Déplacer la souris à l'endroit du clic",50,325,400,20) GUICtrlSetState($CheckBoxMouseMoveClic, $GUI_CHECKED) $CheckBoxMouseMove = GUICtrlCreateCheckbox("Enregistrer le déplacement de la souris sans clic (déconseillé)",50,355,400,20) $CheckBoxKeys = GUICtrlCreateCheckbox("Enregistrer les touches",50,385,400,20) GUICtrlSetState($CheckBoxKeys, $GUI_CHECKED) $CheckBoxMultiKeys = GUICtrlCreateCheckbox("Enregistrer les combinaisons de deux touches",50,415,400,20) GUICtrlSetState($CheckBoxMultiKeys, $GUI_CHECKED) $CheckBoxMoveWindow = GUICtrlCreateCheckbox("Enregistrer les actions sur les fenêtres",50,445,400,20) GUICtrlSetState($CheckBoxMoveWindow, $GUI_CHECKED) $CheckBoxHideGUI = GUICtrlCreateCheckbox("Cacher la fenêtre pendant l'enregistrement",50,475,400,20) GUICtrlSetState($CheckBoxHideGUI, $GUI_CHECKED) $About = GUICtrlCreateLabel(" !",480,0,20,30) GUICtrlSetFont($About,15,Default,Default,"Arial Black") GUICtrlSetColor($About,0xFF0000) $TimerAbout = TimerInit() $AboutColor = 0xFF0000 GUISetState(@SW_SHOW,$Gui) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $ButtonStart ExitLoop Case $About MsgBox(48,"FSP Actions Recorder","Attention !"&@CRLF&@CRLF&"Ce logiciel ne detecte pas les touches suivantes :"&@CRLF&"{apps} Touche Applications"&@CRLF&"{mail} Touche raccourci Mail"&@CRLF&"{media} Touche raccourci Media"&@CRLF&"{app1} Touche raccourci Application1"&@CRLF&"{app2} Touche raccourci Application2"&@CRLF&"{attn} Touche Attn") EndSwitch If TimerDiff($TimerAbout) >= 500 Then If $AboutColor = 0xFF0000 Then GUICtrlSetColor($About,0x000000) $AboutColor = 0x000000 ElseIf $AboutColor = 0x000000 Then GUICtrlSetColor($About,0xFF0000) $AboutColor = 0xFF0000 EndIf $TimerAbout = TimerInit() EndIf WEnd If _IsChecked($CheckBoxMouseClic) Then $_SAVE_CLICK = True Else $_SAVE_CLICK = False EndIf If _IsChecked($CheckBoxMouseMoveClic) Then $_MOVE_CLICK = True Else $_MOVE_CLICK = False EndIf If _IsChecked($CheckBoxMouseMove) Then $_MOVE_MOUSE = True Else $_MOVE_MOUSE = False EndIf If _IsChecked($CheckBoxKeys) Then $_SAVE_KEYS = True Else $_SAVE_KEYS = False EndIf If _IsChecked($CheckBoxMultiKeys) Then $_SAVE_MULTI_KEYS = True Else $_SAVE_MULTI_KEYS = False EndIf If _IsChecked($CheckBoxMoveWindow) Then $_SAVE_WINDOW = True Else $_SAVE_WINDOW = False EndIf If _IsChecked($CheckBoxHideGUI) Then $_HIDE_GUI = True Else $_HIDE_GUI = False EndIf GUICtrlDelete($Img) GUICtrlDelete($ButtonStart) GUICtrlDelete($CheckBoxMouseClic) GUICtrlDelete($CheckBoxMouseMoveClic) GUICtrlDelete($CheckBoxMouseMove) GUICtrlDelete($CheckBoxKeys) GUICtrlDelete($CheckBoxMultiKeys) GUICtrlDelete($CheckBoxMoveWindow) GUICtrlDelete($CheckBoxHideGUI) GUICtrlDelete($About) $ButtonStop = GUICtrlCreateButton("Arrêter l'enregistrement",100,10,300,50) $EditCode = GUICtrlCreateEdit("// Script créé à partir du logiciel FSP Actions Recorder..."&@CRLF&@CRLF,10,70,480,420,0x0800+0x00200000) GUICtrlSetFont($EditCode,Default,Default,Default,"Lucida Console") If $_HIDE_GUI Then GUISetState(@SW_HIDE,$Gui) $GuiHide = GUICreate("FSP Actions Recorder (caché)",50,50,0,0,0x80000000) $ImgHide = GUICtrlCreatePic(@ScriptDir&"\Resources\img\FSPARLOGO.bmp",0,0,50,50) ToolTip("Cliquez ici pour arrêter l'enregistrement",50,50,"FSP Actions Recorder",1,1) GUISetState(@SW_SHOW,$GuiHide) WinSetOnTop($GuiHide,"",1) $ToolTipTimer = TimerInit() EndIf $GlobalTimer = TimerInit() $OldMousePos = MouseGetPos() $OldActivateWindowPos = WinGetPos(_GetActivateWindow(1)) $OldWindowsTitle = _StringParser(_GetActivateWindow()) While 1 If $_HIDE_GUI Then If GUIGetMsg() = $ImgHide Then ExitLoop If TimerDiff($ToolTipTimer) >= 3000 Then ToolTip("") Else If GUIGetMsg() = $ButtonStop Then ExitLoop EndIf If $_MOVE_MOUSE Then $MousePos = MouseGetPos() If $MousePos[0] <> $OldMousePos[0] Or $MousePos[1] <> $OldMousePos[1] Then GUICtrlSetData($EditCode,GUICtrlRead($EditCode)&"sleep("&Round(TimerDiff($GlobalTimer))&")"&@CRLF&"mMove("&$MousePos[0]&","&$MousePos[1]&",0)"&@CRLF&@CRLF) $OldMousePos = MouseGetPos() $GlobalTimer = TimerInit() _GUICtrlEdit_Scroll($EditCode,3) EndIf EndIf If _IsPressed("01") And $_SAVE_CLICK Then $MousePos = MouseGetPos() If $_MOVE_CLICK Then GUICtrlSetData($EditCode,GUICtrlRead($EditCode)&"sleep("&Round(TimerDiff($GlobalTimer))&")"&@CRLF&"mLeft("&$MousePos[0]&","&$MousePos[1]&",0)"&@CRLF&@CRLF) Else GUICtrlSetData($EditCode,GUICtrlRead($EditCode)&"sleep("&Round(TimerDiff($GlobalTimer))&")"&@CRLF&"mLeft(0,0,+)"&@CRLF&@CRLF) EndIf $GlobalTimer = TimerInit() _GUICtrlEdit_Scroll($EditCode,3) While (_IsPressed("01")) If $_SAVE_WINDOW Then $ActivateWindowPos = WinGetPos(_GetActivateWindow(1)) If IsArray($ActivateWindowPos) Then If $ActivateWindowPos[0] <> $OldActivateWindowPos[0] Or $ActivateWindowPos[1] <> $OldActivateWindowPos[1] Then GUICtrlSetData($EditCode,GUICtrlRead($EditCode)&"sleep("&Round(TimerDiff($GlobalTimer))&")"&@CRLF&"wSetPos("&_StringParser(_GetActivateWindow())&","&$ActivateWindowPos[0]&","&$ActivateWindowPos[1]&")"&@CRLF&@CRLF) $OldActivateWindowPos = WinGetPos(_GetActivateWindow(1)) $GlobalTimer = TimerInit() _GUICtrlEdit_Scroll($EditCode,3) EndIf If $ActivateWindowPos[2] <> $OldActivateWindowPos[2] Or $ActivateWindowPos[3] <> $OldActivateWindowPos[3] Then GUICtrlSetData($EditCode,GUICtrlRead($EditCode)&"sleep("&Round(TimerDiff($GlobalTimer))&")"&@CRLF&"wSetSize("&_StringParser(_GetActivateWindow())&","&$ActivateWindowPos[2]&","&$ActivateWindowPos[3]&")"&@CRLF&@CRLF) $OldActivateWindowPos = WinGetPos(_GetActivateWindow(1)) $GlobalTimer = TimerInit() _GUICtrlEdit_Scroll($EditCode,3) EndIf EndIf EndIf WEnd ElseIf _IsPressed("01") And Not $_SAVE_CLICK Then While (_IsPressed("01")) If $_SAVE_WINDOW Then $ActivateWindowPos = WinGetPos(_GetActivateWindow(1)) If IsArray($ActivateWindowPos) Then If $ActivateWindowPos[0] <> $OldActivateWindowPos[0] Or $ActivateWindowPos[1] <> $OldActivateWindowPos[1] Then GUICtrlSetData($EditCode,GUICtrlRead($EditCode)&"sleep("&Round(TimerDiff($GlobalTimer))&")"&@CRLF&"wSetPos("&_StringParser(_GetActivateWindow())&","&$ActivateWindowPos[0]&","&$ActivateWindowPos[1]&")"&@CRLF&@CRLF) $OldActivateWindowPos = WinGetPos(_GetActivateWindow(1)) $GlobalTimer = TimerInit() _GUICtrlEdit_Scroll($EditCode,3) EndIf If $ActivateWindowPos[2] <> $OldActivateWindowPos[2] Or $ActivateWindowPos[3] <> $OldActivateWindowPos[3] Then GUICtrlSetData($EditCode,GUICtrlRead($EditCode)&"sleep("&Round(TimerDiff($GlobalTimer))&")"&@CRLF&"wSetSize("&_StringParser(_GetActivateWindow())&","&$ActivateWindowPos[2]&","&$ActivateWindowPos[3]&")"&@CRLF&@CRLF) $OldActivateWindowPos = WinGetPos(_GetActivateWindow(1)) $GlobalTimer = TimerInit() _GUICtrlEdit_Scroll($EditCode,3) EndIf EndIf EndIf WEnd EndIf If _IsPressed("02") And $_SAVE_CLICK Then $MousePos = MouseGetPos() If $_MOVE_CLICK Then GUICtrlSetData($EditCode,GUICtrlRead($EditCode)&"sleep("&Round(TimerDiff($GlobalTimer))&")"&@CRLF&"mRight("&$MousePos[0]&","&$MousePos[1]&",0)"&@CRLF&@CRLF) Else GUICtrlSetData($EditCode,GUICtrlRead($EditCode)&"sleep("&Round(TimerDiff($GlobalTimer))&")"&@CRLF&"mRight(0,0,+)"&@CRLF&@CRLF) EndIf $GlobalTimer = TimerInit() _GUICtrlEdit_Scroll($EditCode,3) While (_IsPressed("02")) WEnd EndIf If $_SAVE_KEYS Then For $i = 0 To UBound($Key) - 1 Step 1 If _IsPressed($Key[$i][0]) Then If Not $_SAVE_MULTI_KEYS Then GUICtrlSetData($EditCode,GUICtrlRead($EditCode)&"sleep("&Round(TimerDiff($GlobalTimer))&")"&@CRLF&"kSend("&$Key[$i][1]&")"&@CRLF&@CRLF) $GlobalTimer = TimerInit() _GUICtrlEdit_Scroll($EditCode,3) $Timer = TimerInit() While (_IsPressed($Key[$i][0])) If TimerDiff($Timer) >= 300 Then ExitLoop WEnd Else $ClassicPush = True $Timer = TimerInit() While (_IsPressed($Key[$i][0])) If TimerDiff($Timer) >= 300 Then $ClassicPush = False ExitLoop EndIf WEnd If $ClassicPush Then GUICtrlSetData($EditCode,GUICtrlRead($EditCode)&"sleep("&Round(TimerDiff($GlobalTimer))&")"&@CRLF&"kSend("&$Key[$i][1]&")"&@CRLF&@CRLF) $GlobalTimer = TimerInit() _GUICtrlEdit_Scroll($EditCode,3) Else GUICtrlSetData($EditCode,GUICtrlRead($EditCode)&"sleep("&Round(TimerDiff($GlobalTimer))&")"&@CRLF&"kDown("&$Key[$i][1]&")"&@CRLF&@CRLF) $GlobalTimer = TimerInit() _GUICtrlEdit_Scroll($EditCode,3) While (_IsPressed($Key[$i][0])) For $j = 0 To UBound($Key) -1 Step 1 If _IsPressed($Key[$j][0]) And $i <> $j Then GUICtrlSetData($EditCode,GUICtrlRead($EditCode)&"sleep("&Round(TimerDiff($GlobalTimer))&")"&@CRLF&"kSend("&$Key[$j][1]&")"&@CRLF&@CRLF) $GlobalTimer = TimerInit() _GUICtrlEdit_Scroll($EditCode,3) While (_IsPressed($Key[$i][0]) And _IsPressed($Key[$j][0])) WEnd EndIf Next WEnd GUICtrlSetData($EditCode,GUICtrlRead($EditCode)&"sleep("&Round(TimerDiff($GlobalTimer))&")"&@CRLF&"kUp("&$Key[$i][1]&")"&@CRLF&@CRLF) $GlobalTimer = TimerInit() _GUICtrlEdit_Scroll($EditCode,3) EndIf EndIf EndIf Next EndIf If $OldWindowsTitle <> _StringParser(_GetActivateWindow()) Then $WinTitle = _StringParser(_GetActivateWindow()) If $WinTitle <> "0" Then GUICtrlSetData($EditCode,GUICtrlRead($EditCode)&"sleep("&Round(TimerDiff($GlobalTimer))&")"&@CRLF&"wActivate("&$WinTitle&")"&@CRLF&@CRLF) $OldWindowsTitle = $WinTitle $GlobalTimer = TimerInit() _GUICtrlEdit_Scroll($EditCode,3) EndIf EndIf WEnd If $_HIDE_GUI Then GUIDelete($GuiHide) ToolTip("") GUISetState(@SW_SHOW,$Gui) EndIf $Script = GUICtrlRead($EditCode) GUICtrlDelete($EditCode) $EditCode = GUICtrlCreateEdit($Script,10,70,480,420) GUICtrlSetFont($EditCode,Default,Default,Default,"Lucida Console") GUICtrlSetBkColor($EditCode,0xF0F0F0) GUICtrlDelete($ButtonStop) $ButtonSave = GUICtrlCreateButton("Enregistrer le script",100,10,300,50) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $ButtonSave $Script = GUICtrlRead($EditCode) $File = FileSaveDialog("Enregistrer le script...",Default,"Fichiers FSProg (*.fsp)|Tous les fichiers (*.*)",Default,".fsp",$Gui) If Not @error Then $File = _ParseFile($File) If FileExists($File) Then If MsgBox(4+48+256,"FSProg Actions Recorder","Attention, ce fichier existe déjà !"&@CRLF&"Voulez-vous le remplacer ?") = 6 Then FileDelete($File) If FileWrite($File,$Script) Then MsgBox(64,"FSProg Actions Recorder",'Votre fichier a été enregistré comme "'&$File&'".') Else MsgBox(16,"FSProg Actions Recorder","Votre fichier n'a pas été enregistré.") EndIf EndIf Else If FileWrite($File,$Script) Then MsgBox(64,"FSProg Actions Recorder",'Votre fichier a été enregistré comme "'&$File&'".') Else MsgBox(16,"FSProg Actions Recorder","Votre fichier n'a pas été enregistré.") EndIf EndIf EndIf EndSwitch WEnd Func _ParseFile( $File) Local $iSplit = StringSplit($File,"\") If Not StringInStr($iSplit[$iSplit[0]],".") Then Return $File & ".fsp" EndIf Return $File EndFunc Func _IsChecked($control) ; regarder si une radio/check box est activée/cochée Return BitAND(GUICtrlRead($control), $GUI_CHECKED) = $GUI_CHECKED EndFunc ;==>_IsChecked Func _GetActivateWindow( $Flag = 0); $Flag = 1 pour le titre / 0 pour le HWND. $WinList = WinList() For $i = 1 To $WinList[0][0] Step 1 If BitAND(WinGetState($WinList[$i][1]),8) Then Return $WinList[$i][$Flag] Next Return 0 EndFunc Func _StringParser( $String) Local $Chars[16][2] = [["{{}","{"],["{}}","}"], _ ["{d}","$"],["{v}",","],["{p}",";"],["{u}","_"],["{po}","("],["{pc}",")"], _ ["{plus}","+"],["{less}","-"],["{mult}","*"],["{divi}","/"],["{modu}","%"], _ ["{em}","!"],["{and}","&"],["{vb}","|"]] For $i = 0 To UBound($Chars) - 1 Step 1 $String = StringReplace($String,$Chars[$i][1],$Chars[$i][0]) Next If $String = "" Then Return "0" Return $String EndFunc