#Region ;**** 参数创建于 ACNWrapper_GUI ****
#AutoIt3Wrapper_Compression=4
#AutoIt3Wrapper_UseUpx=n
#AutoIt3Wrapper_Res_Fileversion=0.0.0.0
#EndRegion ;**** 参数创建于 ACNWrapper_GUI ****
#include <IE.au3>
#include <Array.au3>
#include <GDIPlus.au3>
#include <Misc.au3>
#Include <String.au3>
Global $WallPaper="1.JPG";桌面背景图片
Global $TemPPath=@TempDir&"\ZeroWal"
Global $PicR="Y"
_Panel()
Func _Panel()
$WallPaper_Old=$WallPaper
$PicR_Tem=$PicR
Local $Url="http://www.thinkpage.cn/weather/weather.aspx?uid=djzero&c=9291&l=zh-CHS&p=MSN&a=1&u=C&s=1&m=0&x=1&d=3&fc=&bgc=&bc=&ti=1&in=1&li=22"
If Not FileExists(@TempDir&"\jywbWal") Then DirCreate(@TempDir&"\jywbWal")
If Not FileExists($WallPaper) Then
$PicR="N"
EndIf
Local $TempPICPath=$TemPPath&""&StringTrimLeft($WallPaper,StringInStr($WallPaper,"",0,-1)-1)
If $PicR = "Y" Then
If Not FileExists ($TemPPath) Then DirCreate($TemPPath)
If Not FileExists($TemPPath&"\AspJpeg.dll") Then FileInstall("AspJpeg.dll",$TemPPath&"\AspJpeg.dll", 1)
If Not FileExists($TemPPath&"\2.png") Then FileInstall("2.png", $TemPPath&"\2.png", 1)
If Not FileExists($WallPaper) Then
$PicR="N"
_Panel()
Return
EndIf
Global $Png=$TemPPath&"\2.png"
If FileExists($WallPaper) Then
WRPic($WallPaper,_IEGetImgAndText($Url),$TempPICPath&".jpg",$TemPPath&"\2.png",800,-10)
If FileExists($TempPICPath&".jpg") Then _JpgToBmp($TempPICPath&".jpg", @WindowsDir&"\Web\Wallpaper\jywb.bmp")
EndIf
Else
If FileExists($WallPaper) Then
If StringTrimLeft($WallPaper,StringInStr($WallPaper,".",0,-1))="bmp" Then
FileCopy($WallPaper, @WindowsDir&"\Web\Wallpaper\jywb.bmp")
Else
FileCopy($WallPaper,$TempPICPath)
If FileExists ($TempPICPath) Then _JpgToBmp($TempPICPath, @WindowsDir&"\Web\Wallpaper\jywb.bmp")
EndIf
EndIf
EndIf
Local $sFile = @WindowsDir&"\Web\Wallpaper\jywb.bmp"
RegWrite('HKCU\Control Panel\Desktop','Wallpaper','reg_sz',$sFile)
DllCall("user32", "int", "SystemParametersInfo", "int", 20, "int", 1, "str", $sFile, "int", 1)
EndFunc
Func _IEGetImgAndText($URL)
Local $httpObj = ObjCreate("winhttp.winhttprequest.5.1")
$httpObj.open("GET",$URL)
$httpObj.send()
Local $Text_Arr=_GetweatherString($httpObj.Responsetext)
If $Text_Arr[1]<>"" Then $Text_Arr[1]=_InETGetPng($Text_Arr[1])
Return $Text_Arr
EndFunc
Func _GetweatherString($WHtml)
Local $Return
If StringLen($WHtml)>0 Then
$GetPNG=_StringRegExp($WHtml,'src="(.*?.png)"')
$GetTitle=_StringRegExp($WHtml, '<span id="ctl00_ltlText">(.*)</span>')&" 气温:"&_StringRegExp($WHtml, ">气温: <span class='temp'>(.*)</span>°")&"℃"
$GetDay=_StringRegExp($WHtml, '<div class="forecastDay" style="font-weight:bold;">(.*)</div>')
$GetDayAlt=_StringRegExp($WHtml, 'alt="(.*)"')
$GetDaytemp=StringReplace(_StringRegExp($WHtml, '<span class="temp high">(.*)</span>(.*)<span class="temp low">(.*)</span>°<span class="unit">C</span>'),",/,","/")
$Return=$GetPNG&","&$GetTitle&@CRLF
$GetDay=StringSplit($GetDay,",")
$GetDayAlt=StringSplit($GetDayAlt,",")
$GetDaytemp=StringSplit($GetDaytemp,",")
If $GetDay[0]<4 Then ReDim $GetDay[4]
If $GetDayAlt[0]<4 Then ReDim $GetDayAlt[4]
If $GetDaytemp[0]<4 Then ReDim $GetDaytemp[4]
For $i=1 To 3
$Return&=$GetDay[$i]&$GetDayAlt[$i]&$GetDaytemp[$i]&"℃"
If $i<>3 Then $Return&=@CRLF
Next
Else
$Return=",请保管个人财物不要把手机、钱包放在桌面上,以免丢失。"
EndIf
Return StringSplit($Return,",")
EndFunc
Func _StringRegExp($WText,$Pattern,$Flag=1,$nOffset = 1)
Local $Return
If StringLen($Flag)>0 Then
Local $Return,$GetPNG
While 1
Local $GetString = StringRegExp($WText, $Pattern,$Flag, $nOffset)
If @error = 0 Then
$nOffset = @extended
Else
ExitLoop
EndIf
for $i = 0 to UBound($GetString) - 1
$Return&=$GetString[$i]&","
Next
WEnd
If StringRight($Return,1)="," Then $Return=StringTrimRight($Return,1)
Else
$Return=""
EndIf
Return $Return
EndFunc
Func _InETGetPng($Http)
Local $Temp_PNG_Path=$TemPPath&""&StringTrimLeft($Http,StringInStr($Http,"/",0,-1))
If FileExists($Temp_PNG_Path) Then Return $Temp_PNG_Path
Local $hDownload = InetGet($Http, $Temp_PNG_Path, 1, 1)
Do
Sleep(250)
Until InetGetInfo($hDownload, 2)
InetClose($hDownload)
Return $Temp_PNG_Path
EndFunc
Func _JQ()
If StringLeft(@ComputerName,1) ="A" Then Return "会员3元/小时"&@CR&"非会员4元/小时"
If StringLeft(@ComputerName,1) ="B" Then Return "会员4元/小时"&@CR&"非会员5元/小时"
If StringLeft(@ComputerName,1) ="C" Then Return "会员2.5元/小时"&@CR&"非会员3元/小时"
If StringLeft(@ComputerName,1) ="F" Then Return "会员2.5元/小时"&@CR&"非会员3元/小时"
If StringLeft(@ComputerName,1) ="D" Then Return "会员4元/小时"&@CR&"非会员5元/小时"
If StringLeft(@ComputerName,1) ="E" Then
If Int(StringTrimLeft(@ComputerName,1))>13 Then
Return "会员4元/小时"&@CR&"非会员5元/小时"
Else
Return "会员2.5元/小时"&@CR&"非会员3元/小时"
EndIf
EndIf
If StringLeft(@ComputerName,1) ="G" Then
If Int(StringTrimLeft(@ComputerName,1))>128 Then
Return "会员3元/小时"&@CR&"非会员4元/小时"
Else
Return "会员4元/小时"&@CR&"非会员5元/小时"
EndIf
EndIf
EndFunc
Func _JpgToBmp($Jpg,$Bmp)
Local $hImage, $CLSID
_GDIPlus_StartUp()
$hImage = _GDIPlus_ImageLoadFromFile($Jpg)
$CLSID = _GDIPlus_EncodersGetCLSID("BMP")
_GDIPlus_ImageSaveToFileEx($hImage,$Bmp, $CLSID)
_GDIPlus_ImageDispose($hImage)
_GDIPlus_ShutDown()
EndFunc
Func _WBArea()
If StringLeft(@ComputerName,1) ="A" Then Return "游戏区"
If StringLeft(@ComputerName,1) ="B" Then Return "VIP区"
If StringLeft(@ComputerName,1) ="C" Then Return "普通区"
If StringLeft(@ComputerName,1) ="F" Then Return "普通区"
If StringLeft(@ComputerName,1) ="D" Then Return "情侣区"
If StringLeft(@ComputerName,1) ="E" Then
If Int(StringTrimLeft(@ComputerName,1))>13 Then
Return "情侣区"
Else
Return "普通区"
EndIf
EndIf
If StringLeft(@ComputerName,1) ="G" Then
If Int(StringTrimLeft(@ComputerName,1))>128 Then
Return "游戏区"
Else
Return "VIP区"
EndIf
EndIf
EndFunc
Func WRPic($D_WallPaper,$Arr_str,$SavePath="jywb.jpg",$D_Png="",$DX=800,$DY=-10)
If $Arr_str[0]<3 Then ReDim $Arr_str[3]
Local $FontPath=@WindowsDir&"\Fonts\Font.ttf"
Local $SimHei=@WindowsDir&"\Fonts\simhei.ttf"
If Not FileExists($FontPath) Then
If Not FileExists($TemPPath&"\Font.ttf") Then
If FileExists("\\192.168.0.251\zerotem$\wel\Font.ttf") Then
FileCopy("\\192.168.0.251\zerotem$\wel\Font.ttf",$TemPPath&"\Font.ttf")
$FontPath=$TemPPath&"\Font.ttf"
Else
$FontPath=@WindowsDir&"\Fonts\simhei.ttf"
EndIf
Else
$FontPath=$TemPPath&"\Font.ttf"
EndIf
EndIf
If Not FileExists($FontPath) Then $FontPath=@WindowsDir&"\Fonts\simhei.ttf"
$Jpeg=_Photo_OpenCalss($D_WallPaper)
With $Jpeg
If $D_Png<>"" Then .Canvas.DrawPNG($DX,$DY,$D_Png);;;;背景2
If $Arr_str[1]<>"" Then .Canvas.DrawPNG($DX+40,$DY+73,$Arr_str[1]);;;气候图标
.Canvas.Font.Size = 32
.Canvas.Font.Color = 0x000000
.Canvas.Font.Width = 200
.Canvas.Font.Align = 2
.Canvas.Font.Spacing = 1
.Canvas.Font.Opacity = 0.8
.Canvas.PrintTextEx(_WBArea(), $DX+32, $DY+50,$FontPath) ;;;区域
.Canvas.Font.Size = 30
.Canvas.Font.Width = 125
.Canvas.PrintTextEx(@ComputerName, $DX+12, $DY+81,@WindowsDir&"\Fonts\tahomabd.TTF");;;;机号
.Canvas.Font.Size = 12
.Canvas.Font.Width = 120
.Canvas.Font.Align = 0
.Canvas.Font.Color = 0x000000
.Canvas.PrintTextEx($Arr_str[$Arr_str[0]], $DX+93, $DY+100,$SimHei);;;;天气报告
.Canvas.Font.Color = 0xBC6E2F
.Canvas.PrintTextEx(_JQ(), $DX+93, $DY+156,$SimHei);;;;价格
.Canvas.Font.Size = 14
.Canvas.PrintTextEx("欢迎光临聚缘网吧", $DX+93, $DY+183,$SimHei)
.Save ($SavePath)
EndWith
$Jpeg.Close
EndFunc
Func _Photo_OpenCalss($Path)
If Not FileExists($Path) Then Return -1
$Jpeg = ObjCreate("Persits.Jpeg")
If Not IsObj($Jpeg) Then
If Not FileExists(@SystemDir & "\aspjpeg.dll") Then FileCopy($TemPPath&"\aspjpeg.dll",@SystemDir,1)
RunWait("Regsvr32 /s "& @SystemDir & "\aspjpeg.dll")
RegWrite("HKLM\SOFTWARE\Persits Software\AspJpeg\RegKey","","REG_SZ","48958-77556-02411")
$Jpeg = ObjCreate("Persits.Jpeg")
EndIf
If $Jpeg.Version = "1.9.0.0" Then $Jpeg.PreserveMetadata = True
$Jpeg.Interpolation=2
$Jpeg.Quality=100
$Jpeg.Open ($Path)
Return $Jpeg
EndFunc