Code : Tout sélectionner
#NoTrayIcon
#include <GuiListBox.au3>
#include <_pngnormal.au3>
#include <_RSS.au3>
#include <GUIConstantsEx.au3>
#include <ButtonConstants.au3>
#include <ListBoxConstants.au3>
#include <WindowsConstants.au3>
#include <WinAPI.au3>
#include <_PngGui.au3>
RegWrite("HKCU\Software\AutoIt v3\Autoit", "Include", "REG_SZ", @ProgramFilesDir & "AutoIt3\Include\" )
Opt("GUIOnEventMode", 1)
FileInstall("C:\Users\James\Desktop\iTMNEwS\images\pic.png", @TempDir & "/pic.png")
Opt("TrayMenuMode", 1)
TrayCreateItem("Ouvrir")
Opt("TrayAutoPause",0) ; Script will not be paused when clicking the tray icon.
TraySetIcon("iPodtouch.ico", "")
$Test2 = _RSSGetInfo("http://blog.ipodtouchmasterfr.com/feed/", "<title>", "</title>", 1)
$Test1 = $Test2
$Option = GUICreate("Option", 373, 146, 194, 135)
GUISetBkColor(0xB9D1EA)
$456 = IniRead(@ScriptDir & "\conf.ini", "Options", "Minuterie", "5 Minutes")
$Minuterie = GUICtrlCreateCombo($456, 200, 32, 153, 25)
GUICtrlSetData(-1, "5 Minutes|10 Minutes|15 Minutes|20 Minutes|30 Minutes|45 Minutes|1 Heure|2 Heures")
$Label1 = GUICtrlCreateLabel("M'avertir à toutes les", 24, 32, 171, 24)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
$Demarrer = GUICtrlCreateCheckbox("Demarrer avec Windows", 32, 64, 220, 25)
$traytimon = IniRead(@ScriptDir & "\conf.ini", "Options2", "TrayTime", "")
If $traytimon = 1 Then Guictrlsetstate($Demarrer,$GUI_CHECKED)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
$Group1 = GUICtrlCreateGroup("Réglages", 8, 16, 361, 89, $BS_CENTER)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$MyButton45 = GUICtrlCreateButton("Ok", 264, 112, 100, 30, $BS_FLAT)
GUICtrlSetOnEvent(-1, "OptionButtonOk")
GUISetState(@SW_HIDE)
$sc12 = @TempDir &"\pic.png"
$1 = 370
$2 = 375
$3 = 196
$4 = 123
$Form1_1 = GUICreate("iTMBlogNews", $1, $2, $3, $4)
GUISetOnEvent($GUI_EVENT_CLOSE, "GUIClose")
WinMove("iTMBlogNews", "" , $3, $4 , $1, $2)
GUISetBkColor(0xA6CAF0)
$pngm1 = -15
$pngm2 = -10
$png = PpngGuiCreatePic($sc12, $pngm1, $pngm2)
$Group1 = GUICtrlCreateGroup("10 Dernères News", 64, 72, 241, 180, $BS_CENTER)
GUISetBkColor(0xA6CAF0)
$MyButton1 = GUICtrlCreateButton("Réactualiser", 64, 260, 116, 30, $BS_FLAT)
GUICtrlSetOnEvent(-1, "_refresh")
$MyButton2 = GUICtrlCreateButton("Aperçu", 192, 260, 116, 30, $BS_FLAT)
GUICtrlSetOnEvent(-1, "Apercu")
$MyButton3 = GUICtrlCreateButton("Option", 64, 290, 244, 30, $BS_FLAT)
GUICtrlSetOnEvent(-1, "OptionButton")
$list = GUICtrlCreateList("",68,84,234,155,BitOR($__LISTBOXCONSTANT_WS_VSCROLL, $LBS_NOTIFY),$WS_EX_TRANSPARENT)
GUICtrlSetBkColor(-1, 0xA6CAF0)
GuiCtrlSetData($list, "")
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetBkColor(0xA6CAF0)
$Group2 = GUICtrlCreateGroup("Description", 400, 72, 241, 180, $BS_CENTER)
$MyButtonQuitApercu = GUICtrlCreateButton("Ok", 615, 310, 40, 30, $BS_FLAT)
$MyButtonopenpage = GUICtrlCreateButton("Ouvrir la Page", 398, 261, 244, 30, $BS_FLAT)
$editinformation = GUICtrlCreateEdit("", 405,83, 232,165,$__LISTBOXCONSTANT_WS_VSCROLL,$WS_EX_TRANSPARENT)
GUISetState(@SW_SHOW)
Global $tmh
_refresh()
AdlibRegister("_DefineTmh", 3)
AdlibRegister("_Traymsg", $tmh)
AdlibRegister("DescriptionGet", 3)
While 1
$Test1 = $Test2
WEnd
Func DescriptionGet()
$NumberofList = _GUICtrlListBox_GetCurSel($list)
$redon = GUICtrlRead($NumberofList)
MsgBox(0,"", $NumberofList)
EndFunc
Func _Description()
$description = _RSSGetInfo("http://blog.ipodtouchmasterfr.com/feed/", "<description>", "</description>", 1)
$Description[1] = StringReplace($Description[1], "’", "'")
$Description[1] = StringReplace($Description[1], "…", "")
$Description[2] = StringReplace($Description[2], "’", "'")
$Description[2] = StringReplace($description[2], "…", "")
$description[3] = StringReplace($Description[3], "’", "'")
$description[3] = StringReplace($Description[3], "…", "")
$description[4] = StringReplace($description[4], "’", "'")
$description[4] = StringReplace($description[4], "…", "")
$description[5] = StringReplace($description[5], "’", "'")
$description[5] = StringReplace($description[5], "…", "")
$description[6] = StringReplace($description[6], "’", "'")
$description[6] = StringReplace($description[6], "…", "")
$description[7] = StringReplace($description[7], "’", "'")
$description[7] = StringReplace($description[7], "…", "")
$description[8] = StringReplace($description[8], "’", "'")
$description[8] = StringReplace($description[8], "…", "")
$description[9] = StringReplace($description[9], "’", "'")
$description[9] = StringReplace($description[9], "…", "")
$description[10] = StringReplace($description[10], "’", "'")
$description[10] = StringReplace($description[10], "…", "")
$Description[1] = StringReplace($Description[1], "ption><![CDATA[", "")
$Description[1] = StringReplace($Description[1], "[...]]]>", "")
$Description[2] = StringReplace($Description[2], "ption><![CDATA[", "")
$Description[2] = StringReplace($description[2], "[...]]]>", "")
$description[3] = StringReplace($Description[3], "ption><![CDATA[", "")
$description[3] = StringReplace($Description[3], "[...]]]>", "")
$description[4] = StringReplace($description[4], "ption><![CDATA[", "")
$description[4] = StringReplace($description[4], "[...]]]>", "")
$description[5] = StringReplace($description[5], "ption><![CDATA[", "")
$description[5] = StringReplace($description[5], "[...]]]>", "")
$description[6] = StringReplace($description[6], "ption><![CDATA[", "")
$description[6] = StringReplace($description[6], "[...]]]>", "")
$description[7] = StringReplace($description[7], "ption><![CDATA[", "")
$description[7] = StringReplace($description[7], "[...]]]>", "")
$description[8] = StringReplace($description[8], "ption><![CDATA[", "")
$description[8] = StringReplace($description[8], "[...]]]>", "")
$description[9] = StringReplace($description[9], "ption><![CDATA[", "")
$description[9] = StringReplace($description[9], "[...]]]>", "")
$description[10] = StringReplace($description[10], "ption><![CDATA[", "")
$description[10] = StringReplace($description[10], "[...]]]>", "")
GuiCtrlSetData($editinformation, "")
GUICtrlSetData($editinformation, _Utf8ToAnsi($description[1] & "..." &@CRLF &@CRLF &"Pour voir le reste, cliquer sur le bouton portant le nom: Ouvrir la Page"), 1)
EndFunc
;Tous les functions
Func _refresh()
GuiCtrlSetData($list, "")
GuiCtrlSetData($list, "Patientez SVP !")
$Test2 = _RSSGetInfo("http://blog.ipodtouchmasterfr.com/feed/", "<title>", "</title>", 1)
GuiCtrlSetData($list, "")
For $i = 1 to 10 Step 1
$Test2[$i] = StringReplace($Test2[$i], "’", "'")
$Test2[$i] = StringReplace($Test2[$i], "…", "")
GUICtrlSetData($list, _Utf8ToAnsi($Test2[$i]), 1)
Next
EndFunc
; string conversion: UTF-8 --> ANSI (default or given code page)
Func _Utf8ToAnsi($Utf8String, $CodePage = 0)
Local $struct = _WinAPI_MultiByteToWideChar($Utf8String, 65001)
Return(_WinAPI_WideCharToMultiByte(DllStructGetPtr($struct), $CodePage))
EndFunc
Func GUIClose()
$lecture = GUICtrlRead($Minuterie)
IniWrite(@ScriptDir & "\conf.ini", "Options", "Minuterie", $lecture)
$rel = GUICtrlRead($Demarrer)
IniWrite(@ScriptDir & "\conf.ini", "Options2", "TrayTime", $rel)
Exit
EndFunc
Func OptionButton()
GUISetState(@SW_SHOW, $Option)
EndFunc
Func OptionButtonOk()
GUISetState(@SW_HIDE, $Option)
EndFunc
Func _Traymsg()
$Test2[1] = StringReplace($Test2[1], "’", "'")
$Test2[1] = StringReplace($Test2[1], "…", "")
TrayTip("Dernière News du Blog iTMFR!", _Utf8ToAnsi($Test2[1]), 1)
Sleep(3000)
TrayTip("","", 0)
EndFunc
Func _DefineTmh()
$voila = GUICtrlRead($Minuterie)
If $voila = "5 Minutes" Then $tmh = 8000
If $voila = "10 Minutes" Then $tmh = 600000
If $voila = "15 Minutes" Then $tmh = 900000
If $voila = "20 Minutes" Then $tmh = 1200000
If $voila = "30 Minutes" Then $tmh = 1800000
If $voila = "45 Minutes" Then $tmh = 2700000
If $voila = "1 Heure" Then $tmh = 3600000
If $voila = "2 Heures" Then $tmh = 7200000
EndFunc
Func Apercu()
$1 = 370
$png2m = -15
For $i = 1 to 30
Sleep(15)
;~ Fenetre itmnews
$1 = $1+10
WinMove("iTMBlogNews", "" , $3, $4 , $1, $2)
;~ png Pic
$png2m = $png2m+4.8
GUICtrlDelete($png)
$png = PpngGuiCreatePic($sc12, $png2m, -10)
;~ Group
GUICtrlDelete($Group1)
$Group1 = GUICtrlCreateGroup("10 Dernères News", 64, 72, 241, 180, $BS_CENTER)
;~ Bouton
GUICtrlDelete($MyButton1)
$MyButton1 = GUICtrlCreateButton("Réactualiser", 64, 260, 116, 30, $BS_FLAT)
GUICtrlSetOnEvent(-1, "_refresh")
GUICtrlDelete($MyButton2)
$MyButton2 = GUICtrlCreateButton("Aperçu", 192, 260, 116, 30, $BS_FLAT)
GUICtrlSetOnEvent(-1, "Apercu")
GUICtrlDelete($MyButton3)
$MyButton3 = GUICtrlCreateButton("Option", 64, 290, 244, 30, $BS_FLAT)
GUICtrlSetOnEvent(-1, "OptionButton")
GUICtrlDelete($list)
$list = GUICtrlCreateList("",68,84,234,155,BitOR($__LISTBOXCONSTANT_WS_VSCROLL, $LBS_NOTIFY),$WS_EX_TRANSPARENT)
GUICtrlSetBkColor(-1, 0xA6CAF0)
_ListRezise()
GUICtrlDelete($Group2)
$Group2 = GUICtrlCreateGroup("Description", 400, 72, 241, 180, $BS_CENTER)
GUICtrlDelete($MyButtonQuitApercu)
$MyButtonQuitApercu = GUICtrlCreateButton("Ok", 615, 310, 40, 30, $BS_FLAT)
GUICtrlSetOnEvent(-1, "_ReduireGui")
GUICtrlDelete($MyButtonopenpage)
$MyButtonopenpage = GUICtrlCreateButton("Ouvrir la Page", 398, 261, 244, 30, $BS_FLAT)
GUICtrlDelete($editinformation)
$editinformation = GUICtrlCreateEdit("", 405,83, 232,165,$__LISTBOXCONSTANT_WS_VSCROLL,$WS_EX_TRANSPARENT)
GUICtrlSetBkColor(-1, 0xA6CAF0)
Next
_Description()
EndFunc
Func _ReduireGui()
$png2m = 129
For $i = 1 to 30
Sleep(15)
;~ Fenetre itmnews
$1 = $1-10
WinMove("iTMBlogNews", "" , $3, $4 , $1, $2)
;~ Group
GUICtrlDelete($Group1)
$Group1 = GUICtrlCreateGroup("10 Dernères News", 64, 72, 241, 180, $BS_CENTER)
;~ png Pic
$png2m = $png2m-4.8
GUICtrlDelete($png)
$png = PpngGuiCreatePic($sc12, $png2m, -10)
;~ Bouton
GUICtrlDelete($MyButton1)
$MyButton1 = GUICtrlCreateButton("Réactualiser", 64, 260, 116, 30, $BS_FLAT)
GUICtrlSetOnEvent(-1, "_refresh")
GUICtrlDelete($MyButton2)
$MyButton2 = GUICtrlCreateButton("Aperçu", 192, 260, 116, 30, $BS_FLAT)
GUICtrlSetOnEvent(-1, "Apercu")
GUICtrlDelete($MyButton3)
$MyButton3 = GUICtrlCreateButton("Option", 64, 290, 244, 30, $BS_FLAT)
GUICtrlSetOnEvent(-1, "OptionButton")
;~ la liste
GUICtrlDelete($list)
$list = GUICtrlCreateList("",68,84,234,155,BitOR($__LISTBOXCONSTANT_WS_VSCROLL, $LBS_NOTIFY),$WS_EX_TRANSPARENT)
GUICtrlSetBkColor(-1, 0xA6CAF0)
_ListRezise()
GUICtrlDelete($Group2)
$Group2 = GUICtrlCreateGroup("Description", 400, 72, 241, 180, $BS_CENTER)
GUICtrlDelete($MyButtonQuitApercu)
$MyButtonQuitApercu = GUICtrlCreateButton("Ok", 615, 310, 40, 30, $BS_FLAT)
GUICtrlSetOnEvent(-1, "_ReduireGui")
GUICtrlDelete($MyButtonopenpage)
$MyButtonopenpage = GUICtrlCreateButton("Ouvrir la Page", 398, 261, 244, 30, $BS_FLAT)
GUICtrlDelete($editinformation)
$editinformation = GUICtrlCreateEdit("", 405,83, 232,165,$__LISTBOXCONSTANT_WS_VSCROLL,$WS_EX_TRANSPARENT)
Next
EndFunc
Func _ListRezise()
$Test1[1] = StringReplace($Test1[1], "’", "'")
$Test1[1] = StringReplace($Test1[1], "…", "")
$Test1[2] = StringReplace($Test1[2], "’", "'")
$Test1[2] = StringReplace($Test1[2], "…", "")
$Test1[3] = StringReplace($Test1[3], "’", "'")
$Test1[3] = StringReplace($Test1[3], "…", "")
$Test1[4] = StringReplace($Test1[4], "’", "'")
$Test1[4] = StringReplace($Test1[4], "…", "")
$Test1[5] = StringReplace($Test1[5], "’", "'")
$Test1[5] = StringReplace($Test1[5], "…", "")
$Test1[6] = StringReplace($Test1[6], "’", "'")
$Test1[6] = StringReplace($Test1[6], "…", "")
$Test1[7] = StringReplace($Test1[7], "’", "'")
$Test1[7] = StringReplace($Test1[7], "…", "")
$Test1[8] = StringReplace($Test1[8], "’", "'")
$Test1[8] = StringReplace($Test1[8], "…", "")
$Test1[9] = StringReplace($Test1[9], "’", "'")
$Test1[9] = StringReplace($Test1[9], "…", "")
$Test1[10] = StringReplace($Test1[10], "’", "'")
$Test1[10] = StringReplace($Test1[10], "…", "")
GUICtrlSetData($list, _Utf8ToAnsi($Test1[1]) & "|" &_Utf8ToAnsi($Test1[2]) & "|" &_Utf8ToAnsi($Test1[3]) & "|" &_Utf8ToAnsi($Test1[4]) & "|" &_Utf8ToAnsi($Test1[5]) & "|" &_Utf8ToAnsi($Test1[6]) & "|" &_Utf8ToAnsi($Test1[7]) & "|" &_Utf8ToAnsi($Test1[8]) & "|" &_Utf8ToAnsi($Test1[9]) & "|" &_Utf8ToAnsi($Test1[10]), 1)
EndFunc