Jump to content
Sign in to follow this  
myspacee

info on desktop

Recommended Posts

myspacee

hello,

try now BGinfo good piece of program, that display as desktop wallpaper, lot infos about your computer.

Incrediblebut miss external IP.

(return only network card IP)

Exist anything Autoit can do for this task ?

m.

Share this post


Link to post
Share on other sites
Mat

I may not be fully right, but BGinfo works by taking the current background, adding the info to the picture, and saving it.

You can tell this becouse if you go onto display properties, BGinfo shows up as a background.

To do this in autoit, you need to:

a) find the current background

:D edit it to show the info

c) change background to the edited one.

http://www.autoitscript.com/forum/index.ph...mp;hl=Wallpaper is an example script written bydantay9 that changes the wallpaper, Have a look.

for the others, it's probably a matter of searching the forums, editing images is something i'm sure is possible, but I don't know how - Probably something in GDI+ - but you'll have to ask someone who knows what they're talking about.

MDiesel

Edited by mdiesel

Share this post


Link to post
Share on other sites
myspacee

ghetto solution:

#include <GDIPlus.au3>
#include <ScreenCapture.au3>
#Include <ScreenCapture.au3>

$image = "C:\WINDOWS\mydesktop.bmp"

_Main()


TimeStampScreenshot($image,@IPAddress1 & @CRLF & @IPAddress2  & @CRLF & @IPAddress3  & @CRLF & @IPAddress4 )

;~ sleep(1000)


ChangeWallpaper($image)

Func ChangeWallpaper($FileLong, $State = 3)
    Local $String = $FileLong, $SPI_SETDESKWALLPAPER = 20, $SPIF_UPDATEINIFILE = 1, $SPIF_SENDCHANGE = 2
    Do
        $FileLong = $String
        $String = StringReplace($FileLong, "/", "\")
    Until @extended = 0
    If Not FileExists($FileLong) Then
        SetError(-1)
        Return 0
    EndIf
    If StringRight($FileLong, 3) <> "bmp" Then
        SetError(-2)
        Return 0
    EndIf

    Local $WDir = RegRead('HKLM\Software\Microsoft\Windows\CurrentVersion', 'WallPaperDir')
    $FileShort = StringSplit($FileLong, "\")
    $FileShort = $FileShort[$FileShort[0]]
    If StringInStr($WDir, @WindowsDir) <> 0 Then
        $WDir = StringTrimLeft($WDir, 12)
        $WDir = @WindowsDir & $WDir
    EndIf
    FileCopy($FileLong, $WDir, 1); make wallpaper available in desktop properties window
    FileCopy($FileLong, @UserProfileDir &  '\Local Settings\Application Data\Microsoft\Wallpaper1.bmp', 1)

    RegWrite('HKCU\Control Panel\Desktop', 'Wallpaper', 'reg_sz', @UserProfileDir &  '\Local Settings\Application Data\Microsoft\Wallpaper1.bmp')
    RegWrite('HKCU\Control Panel\Desktop', 'ConvertedWallpaper', 'reg_sz', $WDir & "\" & $FileShort)
    Switch $State
        Case 1; centered
            RegWrite('HKCU\Control Panel\Desktop', 'TileWallpaper', 'reg_sz', '0')
            RegWrite('HKCU\Control Panel\Desktop', 'WallpaperStyle', 'reg_sz', '0')
        Case 2; tiled
            RegWrite('HKCU\Control Panel\Desktop', 'TileWallpaper', 'reg_sz', '1')
            RegWrite('HKCU\Control Panel\Desktop', 'WallpaperStyle', 'reg_sz', '0')
        Case 3; stretched
            RegWrite('HKCU\Control Panel\Desktop', 'TileWallpaper', 'reg_sz', '0')
            RegWrite('HKCU\Control Panel\Desktop', 'WallpaperStyle', 'reg_sz', '2')
        Case Else
    EndSwitch

    $Dll = DllCall("user32.dll", "int", "SystemParametersInfo", _
            "int", $SPI_SETDESKWALLPAPER, _
            "int", 0, _
            "str", $FileLong, _
            "int", BitOR($SPIF_UPDATEINIFILE, $SPIF_SENDCHANGE))
EndFunc;==>ChangeWallpaper







Func TimeStampScreenshot($image,$timestamp)
    If Not FileExists($image) Then Return 0
    $sString  = $timestamp
    _GDIPlus_StartUp()
    $hImage   = _GDIPlus_ImageLoadFromFile($image)
    $hGraphic = _GDIPlus_ImageGetGraphicsContext($hImage)
    $hFamily  = _GDIPlus_FontFamilyCreate("Arial")
    $hFont  = _GDIPlus_FontCreate($hFamily, 16, 1)
    $tLayout  = _GDIPlus_RectFCreate(0, 0)
    $hFormat  = _GDIPlus_StringFormatCreate(0)
    $hBrush1  = _GDIPlus_BrushCreateSolid(0xA2FFFFFF)
    $hBrush2  = _GDIPlus_BrushCreateSolid(0xC4FF0000)
    $hPen    = _GDIPlus_PenCreate(0xC4000000, 2)
    $aInfo  = _GDIPlus_GraphicsMeasureString($hGraphic, $sString, $hFont, $tLayout, $hFormat)
    $iWidth   = DllStructGetData($aInfo[0], "Width" )
    $iHeight  = DllStructGetData($aInfo[0], "Height")

    _GDIPlus_GraphicsFillRect($hGraphic, 0, 0, $iWidth, $iHeight, $hBrush1)
    _GDIPlus_GraphicsDrawRect($hGraphic, 1, 1, $iWidth, $iHeight, $hPen   )
    _GDIPlus_GraphicsDrawStringEx($hGraphic, $sString, $hFont, $aInfo[0], $hFormat, $hBrush2)

  ; Save image
    _GDIPlus_ImageSaveToFile($hImage, $image & ".bmp")

  ; Free resources
    _GDIPlus_PenDispose      ($hPen )
    _GDIPlus_BrushDispose      ($hBrush1 )
    _GDIPlus_BrushDispose      ($hBrush2 )
    _GDIPlus_StringFormatDispose($hFormat )
    _GDIPlus_FontDispose        ($hFont   )
    _GDIPlus_FontFamilyDispose  ($hFamily )
    _GDIPlus_GraphicsDispose    ($hGraphic)
    _GDIPlus_ImageDispose      ($hImage  )
    _GDIPlus_ShutDown()
    FileMove($image & ".bmp",$image,1)
    Return 1
EndFunc



Func _Main()
    Local $hBitmap, $hClone, $hImage, $iX, $iY

; Initialize GDI+ library
    _GDIPlus_StartUp ()

; Capture 32 bit bitmap
    $hBitmap = _ScreenCapture_Capture ("")
    $hImage = _GDIPlus_BitmapCreateFromHBITMAP ($hBitmap)

; Create 24 bit bitmap clone
    $iX = _GDIPlus_ImageGetWidth ($hImage)
    $iY = _GDIPlus_ImageGetHeight ($hImage)
    $hClone = _GDIPlus_BitmapCloneArea ($hImage, 0, 0, $iX, $iY, $GDIP_PXF24RGB)

; Save bitmap to file
    _GDIPlus_ImageSaveToFile ($hClone, $image)

; Clean up resources
    _GDIPlus_ImageDispose ($hClone)
    _GDIPlus_ImageDispose ($hImage)
    _WinAPI_DeleteObject ($hBitmap)

; Shut down GDI+ library
    _GDIPlus_ShutDown ()

EndFunc ;==>_Main

Now snapshot your desktop and add IP.

I need to create 24bit black image (1024x768) then add IP.

Anyone can help ?

m.

Edited by myspacee

Share this post


Link to post
Share on other sites
myspacee

anyone try it ?

anyone can adjut it, or teach me how create BMP (clean) so I can add it to script ?

m.

Share this post


Link to post
Share on other sites
myspacee

Don't know is possible.

But it's so hard create a new bmp file ?

(see clone, GDI 'paste', but nothing for 'new' one)

m.

Share this post


Link to post
Share on other sites
Jos

Don't know is possible.

I know it is possible and pretty easy to do with an AutoIt3script and BGINFO.

But it's so hard create a new bmp file ?

(see clone, GDI 'paste', but nothing for 'new' one)

m.

.. but if you want to reinvent the wheel then be my guest..... :D

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
myspacee

Don't know is possible, for me :D

don't want to reinvent the wheel but I want to learn.

GDI is hard but not impossible to understand.

Don't want to reinvent GBinfo (standard IT tool), i'm not so good :o

m.

Share this post


Link to post
Share on other sites
myspacee

sorry for bagging again,

but try command line BGinfo and it use only its standard (.bgi files)

Not standart RTF file, so how i can inflate other information than BGinfo gives ?

m.

Share this post


Link to post
Share on other sites
Jos

Open BGINFO and load your .bgi file you want to use. Then create a Custom field for the External IP address and have it load from a textfile.

JOs


SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
NeoFoX

I'm using Samurize for several years now.. have a look at that :o

It can even show winamp, rss, weather on your desktop :D

Neo


[center][font="Arial"]--- The Neo and Only --- [/font][font="Arial"]--Projects---[/font]Image to Text converterText to ASCII converter[/center]

Share this post


Link to post
Share on other sites
myspacee

I know that this task is possible. :D

monoceres script do exactly thing I need

thank you all for your time.

m.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×