• Das Programm ist noch nicht komplett fertig, weil ich noch wissen muss, was Google bei manchem Wetter zurückgibt, aber ansonsten ist es fertig, sagt bitte wenn ihr etwas neues beim Wetter findet ( dann wird warscheinlich unten kein Bild angezeigt, oder es gibt Fehler)
    Also Version 0.9:

    Spoiler anzeigen
    [autoit]


    #Region ;**** Directives created by AutoIt3Wrapper_GUI ****
    #AutoIt3Wrapper_icon=sonne.ico
    #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
    #NoTrayIcon
    #include <Inet.au3>
    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    #include <string.au3>
    #include <GDIPlus.au3>
    #include <Misc.au3>

    [/autoit] [autoit][/autoit] [autoit]

    FileInstall(".\Bilder\lpfeil.png",@TempDir&"\lpfeil.png")
    FileInstall(".\Bilder\DGewitter.jpg",@TempDir&"\DGewitter.jpg")
    FileInstall(".\Bilder\Dregnerisch.jpg",@TempDir&"\Dregnerisch.jpg")
    FileInstall(".\Bilder\Dsonnig.png",@TempDir&"\Dsonnig.png")
    FileInstall(".\Bilder\Dsonnwolkig.jpg",@TempDir&"\Dsonnwolkig.jpg")
    FileInstall(".\Bilder\Dwolkig.jpg",@TempDir&"\Dwolkig.jpg")
    Global $firststart=IniRead("Deskweather.ini","Info","FirstStart",1)
    If $firststart=1 Then MsgBox(64,"Erklärung","Sie können ändern ob das Fenster im Vordergrund bleiben soll, indem sie die Rechte Maustaste auf den Fenster gedrückt halten")
    Global $stadt=IniRead("Deskweather.ini","Info","Stadt","XX")
    If $stadt="XX" Then $stadt=InputBox("Stadteingabe","Stadt eingeben (PLZ/Stadtname)")

    [/autoit] [autoit][/autoit] [autoit]

    HotKeySet("{esc}","ex")
    Global $WMI=ObjGet("winmgmts:\\localhost\root\CIMV2")
    Global $ontop=IniRead("Deskweather.ini","Info","OnTop",1)
    ;~ OnAutoItExitRegister("unload")
    Global $title="Deskweather 0.9 - TheShadowAE"
    Global $winx=200, $winy=200
    Global $wx=0, $wy=0
    $wx=IniRead("Deskweather.ini","Info","WindowX","0")
    $wy=IniRead("Deskweather.ini","Info","WindowY","0")
    Global $style=$WS_POPUP, $exstyle=-1;$WS_EX_TOPMOST
    Global $bgcolor=IniRead("Deskweather.ini","Info","bgcolor","0xFF99DDFF")
    Global $gui=GUICreate($title,$winx,$winy,$wx,$wy,$style,$exstyle)
    GUISetBkColor("0x"&StringRight($bgcolor,6))
    GUISetIcon("sonne.ico")
    GUISetState()
    WinSetOnTop($gui,"",$ontop)
    Opt("GuiOnEventMode",1)
    GUISetOnEvent($GUI_EVENT_CLOSE,"ex")
    _GDIPlus_Startup()
    Global $gra=_GDIPlus_GraphicsCreateFromHWND($gui)
    Global $buffer=_GDIPlus_BitmapCreateFromGraphics($winx,$winy,$gra)
    Global $backgra=_GDIPlus_ImageGetGraphicsContext($buffer)
    _GDIPlus_GraphicsSetSmoothingMode($backgra,2)
    Global $brush=_GDIPlus_BrushCreateSolid()
    Global $loadimg=_GDIPlus_ImageLoadFromFile(@TempDir&"\lpfeil.png")
    Global $imgx=_GDIPlus_ImageGetWidth($loadimg)
    Global $imgy=_GDIPlus_ImageGetHeight($loadimg)
    Global $img=_GDIPlus_ImageLoadFromFile(@TempDir&"\Dsonnig.png")
    Global $hMatrix = _GDIPlus_MatrixCreate()
    _GDIPlus_MatrixTranslate($hMatrix, 0, 0)
    Global $nomcolor="0xFF00AA00"
    Global $timer=TimerInit()
    Global $tskill=0
    Global $twait=60000
    Global $data
    Global $inet=1
    Global $gedreht=0
    Global $drawtime=500
    AdlibRegister("checkkey",50)
    AdlibRegister("_chinet",5000)
    AdlibRegister("draw",$drawtime)

    [/autoit] [autoit][/autoit] [autoit]

    While 1
    If WinActive($gui)<>1 And $ontop=0 Then WinWaitActive($gui)
    _WinAPI_RedrawWindow($gui, "", "", 1280) ;$RDW_UPDATENOW + $RDW_FRAME
    _GDIPlus_GraphicsDrawImageRect($gra,$buffer,0,0,$winx,$winy)
    Sleep(1000)
    WEnd

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Func checkkey()
    $pos=MouseGetPos()
    If $pos[0]>=$wx And $pos[0]<=$wx+$winx And $pos[1]>=$wy And $pos[1]<=$wy+$winy Then
    If _PressedForSec("02",1) Then
    If $ontop=1 Then
    $ontop=0
    Else
    $ontop=1
    EndIf
    WinSetOnTop($gui,"",$ontop)
    If $ontop=0 Then
    ToolTip("OnTop deaktiviert")
    Else
    ToolTip("OnTop aktiviert")
    EndIf
    Sleep(1000)
    ToolTip("")
    EndIf
    EndIf
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func unload()
    AdlibUnRegister()
    _GDIPlus_ImageDispose($img)
    _GDIPlus_MatrixDispose($hMatrix)
    _GDIPlus_ImageDispose($loadimg)
    _GDIPlus_BrushDispose($brush)
    _GDIPlus_GraphicsDispose($backgra)
    _GDIPlus_BitmapDispose($buffer)
    _GDIPlus_GraphicsDispose($gra)
    _GDIPlus_Shutdown()
    GUIDelete($gui)
    IniWrite("DeskWeather.ini","Info","Stadt",$stadt)
    IniWrite("DeskWeather.ini","Info","WindowX",$wx)
    IniWrite("DeskWeather.ini","Info","WindowY",$wy)
    IniWrite("Deskweather.ini","Info","bgcolor",$bgcolor)
    IniWrite("Deskweather.ini","Info","OnTop",$ontop)
    IniWrite("Deskweather.inI","Info","FirstStart",0)
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _chinet()
    AdlibUnRegister("draw")
    _GDIPlus_MatrixTranslate($hMatrix, ($winx/2), ($winy/2))
    AdlibRegister("sprite",50)
    $inet=_internetcheck()
    AdlibUnRegister("sprite")
    _GDIPlus_MatrixTranslate($hMatrix, -($winx/2), -($winy/2))
    Rotate(-$gedreht)
    AdlibRegister("draw",$drawtime)
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func Rotate($degree)
    _GDIPlus_MatrixRotate($hMatrix, $degree,"False")
    _GDIPlus_GraphicsSetTransform($backgra, $hMatrix)
    $gedreht+=$degree
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func sprite()
    _GDIPlus_GraphicsClear($backgra,$bgcolor)
    Rotate(10)
    _GDIPlus_GraphicsDrawImageRect($backgra,$loadimg,-$winx/2,-$winy/2,$winx,$winy)
    _GDIPlus_GraphicsDrawImageRect($gra,$buffer,0,0,$winx,$winy)
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func draw()
    If $inet Then
    _GDIPlus_GraphicsClear($backgra,$bgcolor)
    PrintCPU()
    PrintWeather($stadt)
    _GDIPlus_GraphicsDrawImageRect($gra,$buffer,0,0,$winx,$winy)
    EndIf
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func PrintWeather($search)
    $diff=TimerDiff($timer)
    If $diff-$tskill>=$twait Or $tskill=0 Then
    $data=_getXML_Weather_data($search)
    $tskill=TimerDiff($timer)
    EndIf
    _GraphicsDrawString($backgra,$data[0]&":",45,5,$nomcolor)
    _GraphicsDrawString($backgra,$data[1],45,20,$nomcolor)
    _GraphicsDrawString($backgra,$data[2],45,35,$nomcolor)
    _GraphicsDrawString($backgra,$data[3],45,50,$nomcolor)
    _GraphicsDrawString($backgra,$data[4],45,65,$nomcolor)
    $bild=IMGName($data[1])
    _GDIPlus_ImageDispose($img)
    $img=_GDIPlus_ImageLoadFromFile($bild)
    _GDIPlus_GraphicsDrawImageRect($backgra,$img,45,80,150,115)
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func IMGName($gabe)
    Local $datei=@TempDir&"\"
    If $gabe="Meistens bewölkt" Then $datei&="Dsonnwolkig.jpg"
    If $gabe="Teils bewölkt" Then $datei&="Dsonnwolkig.jpg"
    If $gabe="Bewölkt" Then $datei&="Dwolkig.jpg"
    If $gabe="Klar" Then $datei&="Dsonnig.png"
    If $gabe="Leichter Regen" Then $datei&="Dregnerisch.jpg"
    If $gabe="Regen" Then $datei&="Dregnerisch.jpg"
    ;~ If $gabe="??" Then $datei&="DGewitter.jpg"
    Return $datei
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func PrintCPU()
    $cpu=getCPU($WMI)
    _GraphicsDrawString($backgra,"CPU:",5,5,$nomcolor)
    _GraphicsDrawString($backgra,$cpu[$cpu[0]]&" %",5,20,$nomcolor)
    _GDIPlus_BrushSetSolidColor($brush,$nomcolor)
    _GDIPlus_GraphicsFillRect($backgra,15,195-(Round($cpu[$cpu[0]]*1.5,0)),10,(Round($cpu[$cpu[0]]*1.5,0)+1),$brush)
    ;# X: 45 frei
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _getXML_Weather_data($Postcode)
    $Api = "http://www.google.com/ig/api?weather=" & $Postcode & '&hl=de'
    $XML_Source = _INetGetSource($Api)
    $City = _StringBetween($XML_Source, '<city data="', '"/>')
    $Wstatus = _StringBetween($XML_Source, '<condition data="', '"/>')
    $Temp = _StringBetween($XML_Source, '<temp_c data="', '"/>')
    $Wind = _StringBetween($XML_Source, '<wind_condition data="', '"/>')
    $Humidity = _StringBetween($XML_Source, '<humidity data="', '"/>')
    Local $MyWeather[5]
    If Not IsArray($City) Then
    $stadt=InputBox("Stadteingabe","Stadt eingeben (PLZ/Stadtname) [Vorherige Eingabe war falsch]")
    Return $MyWeather
    EndIf
    $MyWeather[0] = $City[0]
    $MyWeather[1] = $Wstatus[0]
    $MyWeather[2] = $Temp[0] & " °C"
    $MyWeather[3] = $Wind[0]
    $MyWeather[4] = $Humidity[0]
    Return $MyWeather
    EndFunc ;==>_getXML_Weather_data

    [/autoit] [autoit][/autoit] [autoit]

    Func _GraphicsDrawString($hGraphics, $sString, $nX, $nY, $color=0xFF00FF00, $nSize = 10, $style=1)
    Local $hBrush = _GDIPlus_BrushCreateSolid($color)
    Local $hFormat = _GDIPlus_StringFormatCreate()
    Local $hFamily = _GDIPlus_FontFamilyCreate("Arial")
    Local $hFont = _GDIPlus_FontCreate($hFamily, $nSize, $style)
    Local $tLayout = _GDIPlus_RectFCreate($nX, $nY, 0, 0)
    Local $aInfo = _GDIPlus_GraphicsMeasureString($hGraphics, $sString, $hFont, $tLayout, $hFormat)
    Local $aResult = _GDIPlus_GraphicsDrawStringEx($hGraphics, $sString, $hFont, $aInfo[0], $hFormat, $hBrush)
    Local $iError = @error
    _GDIPlus_FontDispose($hFont)
    _GDIPlus_FontFamilyDispose($hFamily)
    _GDIPlus_StringFormatDispose($hFormat)
    _GDIPlus_BrushDispose($hBrush)
    Return SetError($iError, 0, $aResult)
    EndFunc ;==>_GDIPlus_GraphicsDrawString

    [/autoit] [autoit][/autoit] [autoit]

    Func _internetcheck()
    local $timer = TimerInit()
    While Not Ping("www.google.de")
    Sleep(1000)
    If TimerDiff($timer) > 5000 Then Return 0
    WEnd
    Return 1
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func getCPU($objWMIService=0)
    If Not IsObj($objWMIService) Then $objWMIService=ObjGet("winmgmts:\\localhost\root\CIMV2")
    If Not IsObj($objWMIService) Then Return -1
    Local $aCPU[6]
    Local $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_PerfFormattedData_PerfOS_Processor", "WQL", 48)
    Local $str=""
    If IsObj($colItems) Then
    Local $i = 1
    For $objItem In $colItems
    $aCPU[$i] = $objItem.PercentProcessorTime
    $i += 1
    Next
    $aCPU[0]=$i-1
    Else
    Return 0
    EndIf
    Return $aCPU
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func ex()
    unload()
    Exit
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _PressedForSec($taste,$dauer,$vdll="user32.dll")
    $dauer=$dauer*1000
    $t=TimerInit()
    While _IsPressed($taste,$vdll)
    If TimerDiff($t)>=$dauer Then ExitLoop
    sleep(10)
    WEnd
    If TimerDiff($t)>=$dauer Then Return 1
    Return 0
    EndFunc

    [/autoit]

    Screenshot:
    autoit.de/wcf/attachment/8886/

    Kritik, Lobe und alle anderen Antworten erwünscht


    EDIT: Beschreibung vergessen :D
    Also das Programm zeigt dir CPUauslastung und dein Wetter an, ich versuche auch gerade es hinzukriegen, dass es wie eine Verknüpfung nur auf dem Desktop zu sehen ist, wäre nett wenn ihr mir Tipps geben könnt (Ich habe WinXP)

    EDIT: Neue Version, Alte Version 12 mal gedownloadet und nur 1 Antwort :huh: Naja kann man nichts machen :D

  • Hallo TheShadowAE,

    evtl. könntest du die Anzeige leicht transparent (einstellbar?) und durchklickbar machen, weil auf meinem kleinen Display (1024 X 600) wird jeder Pixel benötigt,

    mfg (Auto)Bert

  • Transparent ist leicht, das könnte ich machen, aber durchklickbar ist es nur bei komplett transparent, ich wüsste jedenfalls nicht wie man das macht, wenn das jemand weiß wär das super, dann wär das ganze Script gleich doppelt so gut