#Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Icon=AutoItv11.ico #AutoIt3Wrapper_Res_Fileversion=8.2 #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include #include #include #include #Include #Include #include #include #include Global Const $head="Wallpapaper V8" ; C:\Documents and Settings\Marc\Local Settings\Application Data\Wallpapper Global Const $path = @LocalAppDataDir&"\Wallpapper\" Global Const $pathjpg=$path&"Avion.jpg" Global Const $pathbmp=$path&"Avion.bmp" Global Const $pathlog=$path&"random.log" Global Const $pathpg=$path&"page.txt" Global Const $pathsmall=$path&"small.jpg" Global Const $pathini=$path&"Avion.ini" Global $Gui=0 , $pic , $tier , $demitier , $GUI_Button_Next , $GUI_Button_Go , $GUI_Button_Close , $z Opt('WINTITLEMATCHMODE', 4) If Not FileExists($pathini) Then IniWrite($pathini, "Date", "Date", "2000/01/01") ;IniWrite($pathini, "Date", "Date", _NowCalcDate()) EndIf If $CmdLine[0] And $CmdLine[1] = "-a" Then $Lastwallpaper= IniRead($pathini, "Date", "Date", "2000/01/01") If $Lastwallpaper = _NowCalcDate() Then Exit EndIf ;TrayTip ( "Wallpaper", "Working...", 30) DirCreate($path) $Links=_GetLinks() _CreateGUI() ; [0]=ubound ; [1]=Source smaill ; [2]=$SmallWidth ; [3]=$Smallheight ; [4]=Source Big ; [5]=txt source ; [6]=Txt (Airline & Aircraft) ; [7]= ; [8]= Func _CreateGUI() $bar = ControlGetPos("classname=Shell_TrayWnd","","ReBarWindow321") ;~ ConsoleWrite($bar[1]&" - "&$bar[3] & @LF) If $Gui <> 0 Then GUIDelete($Gui) If $Links[2]<150 Then $width = 150 ;need space for the buttons $p=0 Else $width = $Links[2] $p=1 EndIf ;ConsoleWrite($width & @CRLF) If @OSVersion="WIN_7" Or @OSVersion="WIN_VISTA" Then $Gui=GUICreate($head, $width-2 , $Links[3]+40 , @DesktopWidth-$width , @DesktopHeight-($Links[3]+40+$bar[3]) , BitOR($WS_POPUP,$WS_BORDER) ) Elseif @OSVersion="WIN_XP" Or @OSVersion="WIN_XPe" Then $Gui=GUICreate($head, $width-2 , $Links[3]+40 , @DesktopWidth-$width , @DesktopHeight-($Links[3]+$bar[3]+48) , BitOR($WS_POPUP,$WS_BORDER) ) Elseif @OSVersion="WIN_8" Or @OSVersion="WIN_81" Then $Gui=GUICreate($head, $width-2 , $Links[3]+40 , @DesktopWidth-$width , @DesktopHeight-($Links[3]+$bar[3]+41) , BitOR($WS_POPUP,$WS_BORDER) ) Else $Gui=GUICreate($head, $width-2 , $Links[3]+40 , @DesktopWidth-$width , @DesktopHeight-($Links[3]+40+$bar[3]) , BitOR($WS_POPUP,$WS_BORDER) ) EndIf $pic = GUICtrlCreatePic ( $pathsmall, (($width-$Links[2])/2)-$p, -1,$Links[2],$Links[3] ,$WS_BORDER ) $tier = $width/3 $demitier = $tier /2 $GUI_Button_Next = GUICtrlCreateButton("Change",$demitier-25, $Links[3]+5, 50, 30, BitOR($BS_DEFPUSHBUTTON ,$BS_FLAT )) $GUI_Button_Go = GUICtrlCreateButton("Set", $demitier+$tier-25, $Links[3]+5, 50, 30,$BS_FLAT) $GUI_Button_Close = GUICtrlCreateButton("Close", $demitier+$tier+$tier-25, $Links[3]+5, 50, 30,$BS_FLAT) TrayTip ( "","", Default) _TrayBoxAnimate($Gui, 7) GUISetState() EndFunc While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Or $msg = $GUI_Button_Close _TrayBoxAnimate($Gui, 8) Exit Case $msg = $GUI_Button_Next _TrayBoxAnimate($Gui, 8) $Links=_GetLinks() _CreateGUI() _TrayBoxAnimate($Gui, 7) Case $msg = $GUI_Button_Go ExitLoop EndSelect WEnd _TrayBoxAnimate($Gui, 8) GUIDelete($Gui) $Textpg=_StringBetween($Links[5], "" , "") ;~ $aTextpg=StringSplit($Textpg[0] , " | " , 1) ;~ $Links[6]=$aTextpg[1] $Links[6]=$Textpg[0]&" | Made by Cramaboule" InetGet($Links[4],$pathjpg) ;resize the picture _GDIPlus_Startup() $hImage2 = _GDIPlus_ImageLoadFromFile($pathjpg) $Width=_GDIPlus_ImageGetWidth($hImage2) $Height=_GDIPlus_ImageGetHeight($hImage2) $FDesktop=@DesktopHeight/@DesktopWidth $Fact =1 If $Width > @DesktopWidth And $FDesktop > ($Height/$Width) Then $Fact=@DesktopWidth/$Width ElseIf $Height > @DesktopHeight Then $Fact=@DesktopHeight/$Height EndIf $H1 = Round(($Fact * $Height),0) $W1 = Round(($Fact * $Width),0) ; $hWnd = _WinAPI_GetDesktopWindow() $hDC = _WinAPI_GetDC($hWnd) $hBMP = _WinAPI_CreateCompatibleBitmap($hDC, $W1, $H1) $hImage1 = _GDIPlus_BitmapCreateFromHBITMAP ($hBMP) $hGraphic = _GDIPlus_ImageGetGraphicsContext($hImage1) _GDIPLus_GraphicsDrawImageRect($hGraphic, $hImage2, 0, 0, $W1, $H1) ; $hBrush1 = _GDIPlus_BrushCreateSolid(0xFFFFFFFF) ; text color $hBrush = _GDIPlus_BrushCreateSolid( "0x60ffffff") ; layout _GDIPlus_GraphicsFillRect($hGraphic, 0, 0, $W1, 20,$hBrush) _GDIPlus_GraphicsDrawString($hGraphic, $Links[6], 0,0, "Arial Black") ; $CLSID = _GDIPlus_EncodersGetCLSID("bmp") _GDIPlus_ImageSaveToFileEx($hImage1, $pathbmp, $CLSID) ; _WinAPI_DeleteObject($hBMP) _WinAPI_ReleaseDC($hWnd, $hDC) _GDIPlus_ImageDispose($hImage1) _GDIPlus_ImageDispose($hImage2) _GDIPlus_GraphicsDispose ($hGraphic) _GDIPlus_Shutdown() _ChangeDesktopWallpaper($pathbmp, 0) IniWrite($pathini, "Date","Date",_NowCalcDate()) ;~ Sleep(5000) ; let some time to read the tray tip !!! :-) ;~ TrayTip ( "","", Default) ;~ TrayTip ( "Etape4", "Quit", 5) ;~ Sleep(500) Exit Func _ChangeDesktopWallpaper($bmp, $style = 0) ;=============================================================================== ; ; Function Name: _ChangeDesktopWallPaper ; Description: Update WallPaper Settings ;Usage: _ChangeDesktopWallPaper(@WindowsDir & '\' & 'zapotec.bmp',1) ; Parameter(s): $bmp - Full Path to BitMap File (*.bmp) ; [$style] - 0 = Centered, 1 = Tiled, 2 = Stretched ; Requirement(s): None. ; Return Value(s): On Success - Returns 0 ; On Failure - -1 ; Author(s): FlyingBoz ;Thanks: Larry - DllCall Example - Tested and Working under XPHome and W2K Pro ; Excalibur - Reawakening my interest in Getting This done. ; ;=============================================================================== If Not FileExists($bmp) Then Return -1 ;The $SPI* values could be defined elsewhere via #include - if you conflict, ; remove these, or add if Not IsDeclared "SPI_SETDESKWALLPAPER" Logic Local $SPI_SETDESKWALLPAPER = 20 Local $SPIF_UPDATEINIFILE = 1 Local $SPIF_SENDCHANGE = 2 Local $REG_DESKTOP= "HKEY_CURRENT_USER\Control Panel\Desktop" if $style = 1 then RegWrite($REG_DESKTOP, "TileWallPaper", "REG_SZ", 1) RegWrite($REG_DESKTOP, "WallpaperStyle", "REG_SZ", 0) Else RegWrite($REG_DESKTOP, "TileWallPaper", "REG_SZ", 0) RegWrite($REG_DESKTOP, "WallpaperStyle", "REG_SZ", $style) EndIf DllCall("user32.dll", "int", "SystemParametersInfo", _ "int", $SPI_SETDESKWALLPAPER, _ "int", 0, _ "str", $bmp, _ "int", BitOR($SPIF_UPDATEINIFILE, $SPIF_SENDCHANGE)) Return 0 EndFunc ;==>_ChangeDestopWallpaper Func _TrayBoxAnimate($TBGui, $Xstyle = 1, $Xspeed = 1500) ; $Xstyle - 1=Fade, 3=Explode, 5=L-Slide, 7=R-Slide, 9=T-Slide, 11=B-Slide, ;13=TL-Diag-Slide, 15=TR-Diag-Slide, 17=BL-Diag-Slide, 19=BR-Diag-Slide Local $Xpick = StringSplit('80000,90000,40010,50010,40001,50002,40002,50001,40004,50008,40008,50004,40005,5000a,40006,50009,40009,50006,4000a,50005', ",") DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $TBGui, "int", $Xspeed, "long", "0x000" & $Xpick[$Xstyle]) EndFunc ;==>_TrayBoxAnimate Func _GetLinks() Do ;3878175 Local $rdm=Random(1,5000000,1) $small="-6.jpg" $big="-12.jpg" ;~ Local $rdm=787175 ;~ Local $rdm=2837649 ;~ http://www.airliners.net/photo/219906 ;~ http://www.airliners.net/photo/Airbus/Airbus-A340-642/219906 ;~ http://cdn-www.airliners.net/photos/airliners/6/0/9/0219906.jpg?v=v20 ;~ http://imgproc.airliners.net/photos/airliners/6/0/9/0219906-v20-15.jpg (moyenne) ;~ http://imgproc.airliners.net/photos/airliners/6/0/9/0219906-v20-6.jpg (petite) ;~ http://imgproc.airliners.net/photos/airliners/6/0/9/0219906-v20-12.jpg (grande) ;ConsoleWrite($rdm & @CRLF) ;_FileWriteLog($pathlog, $rdm) Local $flag=0 Local $Text=_INetGetSource("http://www.airliners.net/photo/"&$rdm,1) If Not(@error) Then $flag=1 EndIf Until $flag=1 ;ConsoleWrite($Text & @CRLF) $aText=_StringBetween($Text, '') $aaaText=_StringBetween($aText[0], '
' , '
') Local $Href=_StringBetween($aaaText[0], '