#Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Icon=..\..\..\..\..\Multimédia\Visuel\Images, Photos\1. Moi\Pouf\Pouf Icone\Ico\Pouf 64.ico #AutoIt3Wrapper_Compression=0 #AutoIt3Wrapper_Res_Language=3084 #AutoIt3Wrapper_Run_Tidy=y #AutoIt3Wrapper_Res_LegalCopyright=Sagesse Inc. #AutoIt3Wrapper_Outfile=M:\Backup\Portable\Autoit\1. Coding in here\gif2\Gestionnaire d'émoticone du Pouf.exe #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include #include #include #include #include #include ;Variables Global $gifwidth, $gifheight, $STATUS = 1 ; Options Opt("GUIOnEventMode", 1) Opt("WinTitleMatchMode", 2) Opt("SendKeyDelay", 1) ; Hotkeyset for Hide/Show HotKeySet("{F10}", "HIDE") ; Gui Create $titre = "Gestionnaire d'émoticone du Pouf" Local $w = 400, $h = 500 $gui = GUICreate($titre, $w, $h, -1, -1) GUICtrlCreateTab(10, 10, $w - 20, $h - 80) GUICtrlCreateButton("Quitter", 330, $h - 40, 70, 30) GUICtrlSetOnEvent(-1, "button") $renommer = GUICtrlCreateButton("Renommer", 10, $h - 70, 70, 30) GUICtrlSetOnEvent(-1, "button") GUICtrlSetState($renommer, $GUI_DISABLE) $checkbox = GUICtrlCreateCheckbox("Activer les options", 90, $h - 25) GUICtrlSetOnEvent(-1, "button") $installer = GUICtrlCreateButton("Installer", 10, $h - 40, 70, 30) GUICtrlSetOnEvent(-1, "button") GUICtrlSetState($installer, $GUI_DISABLE) $backup = GUICtrlCreateButton("Backup", 90, $h - 70, 70, 15) GUICtrlSetOnEvent(-1, "button") GUICtrlSetState($backup, $GUI_DISABLE) $restore = GUICtrlCreateButton("Restore", 90, $h - 55, 70, 15) GUICtrlSetOnEvent(-1, "button") GUICtrlSetState($restore, $GUI_DISABLE) $delete = GUICtrlCreateButton("Delete", 90, $h - 40, 70, 15) GUICtrlSetOnEvent(-1, "button") GUICtrlSetState($delete, $GUI_DISABLE) GUISetOnEvent($GUI_EVENT_CLOSE, "close") ; Variables utilisées pour la création des onglets et de leurs contenu $Dir = @ScriptDir & "\" $Folders = _FileListToArray($Dir, "*", 2) ; Dossiers If _ArrayFindAll($Folders, "Backup") <> -1 Then _ArrayDelete($Folders, _ArraySearch($Folders, "Backup")) _ArrayInsert($Folders, 1, "") EndIf If _ArrayFindAll($Folders, "Favoris") <> -1 Then _ArrayDelete($Folders, _ArraySearch($Folders, "Favoris")) _ArrayInsert($Folders, 1, "Favoris") EndIf For $i = 1 To $Folders[0] $endgifw = 24 $endgifh = 40 $maxheight = 0 $Files = _FileListToArray($Dir & $Folders[$i], "*.gif", 1) $reset = 0 If $Folders[$i] <> "Install" Then GUICtrlCreateTabItem($Folders[$i]) EndIf For $j = 1 To (UBound($Files) - 1) $filename = StringTrimRight($Files[$j], 4) If $j = (UBound($Files)) Then Else _moche($Dir & $Folders[$i] & "\" & $Files[$j]) $maxheight = max($maxheight, $gifheight) ;MsgBox(0,$j & " rangée #" & $line,$maxheight) EndIf Select Case $endgifw + $gifwidth > $w - 10 $endgifw = 24 $reset = 1 $endgifh = $endgifh + $maxheight + 15 ; MsgBox(0,$j & " rangée #" & $line,$maxheight) EndSelect Select Case $endgifh + $gifheight > $h - 111 GUICtrlCreateTabItem("...") $endgifw = 24 $endgifh = 40 $maxheight = 0 EndSelect $gif = _GUICtrlCreateGIF($Dir & $Folders[$i] & "\" & $Files[$j], $endgifw, $endgifh) $BUTTON = GUICtrlCreateButton($filename, $endgifw, $endgifh + $gifheight, $gifwidth - 10, 15) ; $yy + son coefficient pour que le bouton soit sous les émoticones. GUICtrlSetFont(-1, 1) GUICtrlSetOnEvent($BUTTON, "smiley") GUICtrlSetTip(-1, $filename) $endgifw = $gifwidth + $endgifw Select Case $reset = 1 $reset = 0 $maxheight = $gifheight EndSelect Next Next GUICtrlCreateTabItem("") ;important - finishes off the tab controls GUISetState(@SW_SHOW) While 1 Sleep(100) WEnd Func smiley() $a = ControlGetText($gui, "", @GUI_CtrlId) ClipPut($a) WinActivate("Conversation", "") Send("^v") EndFunc ;==>smiley Func close() If Not ProcessExists("msnmsgr.exe") Then Exit ElseIf ProcessExists("msnmsgr.exe") Then HIDE() EndIf EndFunc ;==>close Func button() $guibutton = ControlGetText($gui, "", @GUI_CtrlId) Switch $guibutton Case "Quitter" Exit Case "Renommer" Renommer() Case "Installer" installer() Case "Backup" Backup() Case "Restore" Restore() Case "Delete" Delete() Case "Activer les options" If _IsChecked($checkbox) Then GUICtrlSetState($renommer, $GUI_ENABLE) GUICtrlSetState($installer, $GUI_ENABLE) GUICtrlSetState($backup, $GUI_ENABLE) GUICtrlSetState($restore, $GUI_ENABLE) GUICtrlSetState($delete, $GUI_ENABLE) Else GUICtrlSetState($renommer, $GUI_DISABLE) GUICtrlSetState($installer, $GUI_DISABLE) GUICtrlSetState($backup, $GUI_DISABLE) GUICtrlSetState($restore, $GUI_DISABLE) GUICtrlSetState($delete, $GUI_DISABLE) EndIf EndSwitch EndFunc ;==>button Func HIDE() If WinActive($titre) Then GUISetState(@SW_HIDE, $gui) $STATUS -= 1 _ReduceMemory() ElseIf Not WinActive($titre) Then GUISetState(@SW_SHOW, $gui) $STATUS += 1 _ReduceMemory() EndIf EndFunc ;==>HIDE Func _ReduceMemory() Local $dll = DllOpen("kernel32.dll") Local $ai_GetCurrentProcessId = DllCall($dll, 'int', 'GetCurrentProcessId') Local $ai_Handle = DllCall($dll, 'int', 'OpenProcess', 'int', 0x1f0fff, 'int', False, 'int', $ai_GetCurrentProcessId[0]) Local $ai_Return = DllCall("psapi.dll", 'int', 'EmptyWorkingSet', 'long', $ai_Handle[0]) DllCall($dll, 'int', 'CloseHandle', 'int', $ai_Handle[0]) DllClose($dll) Return $ai_Return[0] EndFunc ;==>_ReduceMemory Func installer() Opt("WinTitleMatchMode", 2) Opt("SendKeyDelay", 10) $Dir = @ScriptDir & "\" $Files = _FileListToArray($Dir, "*.gif", 1) ; Dossiers ShellExecute("msnmsgr.exe") If Not WinActive("Windows Live Messenger") Then WinActivate("Windows Live Messenger") EndIf WinWaitActive("Windows Live Messenger") Send("!O") Sleep(500) Send("C") $Folders = _FileListToArray($Dir, "*", 2) ; Dossiers For $i = 1 To $Folders[0] $Files = _FileListToArray($Dir & $Folders[$i], "*.gif", 1) For $j = 1 To (UBound($Files) - 1) $filesname = StringTrimRight($Files[$j], 4) WinWaitActive("Émoticônes") Send("!C") Sleep(300) Send("!R") WinWaitActive("Sélectionnez") ControlSend("Sélectionnez", "", "Edit1", $Dir & $Folders[$i] & "\" & $Files[$j] & "{ENTER}") WinWaitActive("Ajouter") ControlSend("Ajouter", "", "Edit2", $filesname) Sleep(300) Send("{ENTER}") Next Next Sleep(300) Send("{ENTER}") EndFunc ;==>installer Func Renommer() $Dir = @ScriptDir & "\" $Folders = _FileListToArray($Dir, "*", 2) ; Dossiers For $i = 1 To $Folders[0] $Files = _FileListToArray($Dir & $Folders[$i], "*.gif", 1) For $j = 1 To (UBound($Files) - 1) $filename = StringLeft($Files[$j], 3) FileMove($Dir & $Folders[$i] & "\" & $Files[$j], $Dir & $Folders[$i] & "\renaming\" & $Files[$j], 9) $fol = StringLeft($Folders[$i], 3) $fol = StringReplace($fol, " ", "#") FileMove($Dir & $Folders[$i] & "\renaming\" & $Files[$j], $Dir & $Folders[$i] & "\" & $fol & $j + 9 & ".gif") DirRemove($Dir & $Folders[$i] & "\renaming\") Next Next EndFunc ;==>Renommer Func Backup() $email = _FileListToArray(@UserProfileDir & "\AppData\Local\Microsoft\Messenger\", "*", 2) DirCopy(@UserProfileDir & "\AppData\Local\Microsoft\Messenger\" & $email[1] & "\ObjectStore\CustomEmoticons", @ScriptDir & "\Backup\", 1) EndFunc ;==>Backup Func Restore() $email = _FileListToArray(@UserProfileDir & "\AppData\Local\Microsoft\Messenger\", "*", 2) DirCopy(@ScriptDir & "\Backup\", @UserProfileDir & "\AppData\Local\Microsoft\Messenger\" & $email[1] & "\ObjectStore\CustomEmoticons", 1) MsgBox(0, "", @UserProfileDir & "\AppData\Local\Microsoft\Messenger\" & $email[1] & "\ObjectStore\CustomEmoticons") EndFunc ;==>Restore Func Delete() If ProcessExists("msnmsgr.exe") Then $msnstatus = 1 ProcessClose("msnmsgr.exe") EndIf $email = _FileListToArray(@UserProfileDir & "\AppData\Local\Microsoft\Messenger\", "*", 2) DirRemove(@UserProfileDir & "\AppData\Local\Microsoft\Messenger\" & $email[1] & "\ObjectStore\CustomEmoticons", 1) If $msnstatus = 1 Then ShellExecute("msnmsgr.exe") $msnstatus = 0 EndIf EndFunc ;==>Delete Func max($x, $y) ;Return the larger of two numbers If $x > $y Then Return $x Else Return $y EndIf EndFunc ;==>max Func _IsChecked($control) Return BitAND(GUICtrlRead($control), $GUI_CHECKED) = $GUI_CHECKED EndFunc ;==>_IsChecked ;=============================================================================== ; UDF Name: _AnimatedGif.au3 ; ; Version v1.0.0 Oct 12, 2006, built with Autoit 3.2.1.3 ; ; Authors: gafrost, elgabionline, lod3n ; ; Contribution: Ed_Maximized ; ; Email: ; ; Use: Creation of an animated GIF control and functions to stop/resume animation ;=============================================================================== #include-once ;=============================================================================== ; ; Function Name: _GUICtrlCreateGIF() ; Description: Create an Animated GIF control ; Parameter(s): $gif [required] path and filename of the animated GIF ; $x [optional] x pos of the top-left corner ; $y [optional] y pos of the top-left corner ; $border [optional] 0 = no border ; any other = sunken border ; Requirement(s): #include ; Return Value(s): ; controlID of the control created ; Author(s): elgabionline, gafrost, Ed_Maximized ; ;=============================================================================== Func _GUICtrlCreateGIF($gif, $x = 0, $y = 0, $border = 0) Local $pwidth, $pheight, $oIE, $GUIActiveX _GetGifPixWidth_Height($gif, $pwidth, $pheight) $oIE = ObjCreate("Shell.Explorer.2") $GUIActiveX = GUICtrlCreateObj($oIE, $x, $y, $pwidth, $pheight) $oIE.navigate("about:blank") While _IEPropertyGet($oIE, "busy") Sleep(100) WEnd $oIE.document.body.background = $gif $oIE.document.body.scroll = "no" If $border = 0 Then $oIE.document.body.style.border = "0px" $gifwidth = $pwidth $gifheight = $pheight Return $oIE EndFunc ;==>_GUICtrlCreateGIF ;=============================================================================== ; ; Function Name: _GUICtrlStopGIF() ; Description: stop an Animated GIF control created with _GUICtrlCreateGIF() ; Parameter(s): $Control [required] controlID of the control returned by _GUICtrlCreateGIF() ; ; Requirement(s): #include ; Return Value(s): ; none ; Author(s): lod3n, Ed_Maximized ; ;=============================================================================== Func _GUICtrlStopGIF($control) _IEAction($control, "stop") ; stop EndFunc ;==>_GUICtrlStopGIF ;=============================================================================== ; ; Function Name: _GUICtrlResumeGIF() ; Description: resume an Animated GIF control created with _GUICtrlCreateGIF() ; Parameter(s): $Control [required] controlID of the control returned by _GUICtrlCreateGIF() ; ; Requirement(s): #include ; Return Value(s): ; none ; Author(s): lod3n, Ed_Maximized ; ;=============================================================================== Func _GUICtrlResumeGIF($control) $control.document.body.background = $control.document.body.background ;resume EndFunc ;==>_GUICtrlResumeGIF ;=============================================================================== ; ; Function Name: _GetGifPixWidth_Height() ; Description: return the size of a GIF image in pixels ; Parameter(s): $s_gif [required] path and filename of the animated GIF ; ; Requirement(s): #include ; Return Value(s): ; $pwidth = width of the GIF in pixels ; $pheight = height of the GIF in pixels ; Author(s): gafrost ; ;=============================================================================== Func _GetGifPixWidth_Height($s_gif, ByRef $pwidth, ByRef $pheight) If FileGetSize($s_gif) > 9 Then Local $sizes = FileRead($s_gif, 10) ;ConsoleWrite("Gif version: " & StringMid($sizes, 1, 6) & @LF) $pwidth = Asc(StringMid($sizes, 8, 1)) * 256 + Asc(StringMid($sizes, 7, 1)) $pheight = Asc(StringMid($sizes, 10, 1)) * 256 + Asc(StringMid($sizes, 9, 1)) ;ConsoleWrite($pwidth & " x " & $pheight & @LF) EndIf EndFunc ;==>_GetGifPixWidth_Height Func _moche($gif) Local $pwidth, $pheight, $oIE, $GUIActiveX _GetGifPixWidth_Height($gif, $pwidth, $pheight) $gifwidth = $pwidth $gifheight = $pheight EndFunc ;==>_moche