Mon gestionnaire d'émoticones pour
Windows Live Messenger
Parce qu'aucun que j'aille essayé ne fonctionnait bien, j'ai décidé
de crée le mien.
- Placez votre script dans un dossier.
- Au démarrage, il regarde tous les dossiers présent autour de lui.
- Il liste tous les *.gif dans ces dossiers.
- Il affiche dans des onglets tous ces gif (un onglet = un dossier )
Si vous cliquez sur le bouton sous l'émoticone (animée, cela va de soi)
le titre, sans le *.gif sera mis dans le presse-papier et copier dans
la fenêtre ayant "Conversation" comme titre . (Vous devez précédemment installer
l'émoticone dans msn avec comme raccourci-clavier le titre de votre émoticone.)
Les boutons :
Renommer : Nomme toutes les émoticones selon le schéma suivant :
les 3 premières lettres du dossier et un nombre entre 10 et X
Installer : (vous devez avoir des icônes avec des noms de 7 caractères ou moins
pour que cela fonctionne)
Installe les émoticônes dans msn en leur assignant comme raccourcis-clavier leur noms.
Backup : Sous vista, récupère le dossier "Custom Emoticons" situé
dans User\nom d'utilisateur\local\appdata\microsoft\messenger\Email\objectdata\customemoticons et copie ce dossier à la racine du script.
(N.B. : Si plus d'un utilisateur se sert de WLM sur cet ordinateur, seul le dossier
du premier email sera copié)
Restore : L'inverse de backup (copie les fichiers vers
Delete : Efface tous les émoticônes personnalisés
Voilà .
F10 cache et montre l'application.
Donnez moi des commentaires si vous aimez... ou ne comprenez pas... ou pour
n'importe quelle raison.

Voilà le code
► Afficher le texte
Code : Tout sélectionner
#include <Array.au3>
#include <ButtonConstants.au3>
#include <File.au3>
#include <GUIConstantsEx.au3>
#include<IE.au3>
#include<Misc.au3>
;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: <edmundofasano [at] gmail [dot] com>
;
; 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 <IE.au3>
; 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 <IE.au3>
; 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 <IE.au3>
; 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 <IE.au3>
; 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
Gestionnaire d'émoticônes du Pouf.au3
- (13.12 Kio) Téléchargé 267 fois