Sign in to follow this  
Followers 0
cdm_Death

Someone Please try this for me...

4 posts in this topic

If someone wouldn't mind taking a look at this, its a hastily written script, but I think it does what it needs to, its obviously a basic beta version, but until I get this working 100% I am not going to add other Functions, simple put a picture in bmp format in windows directory... let me know how it goes,

Thanks

;Written By Jake Campos

;A Death Program

;This script was created for fun, and in no way is meant to be used for malicious purposes...

;Insert this script, and the desktop .bmp into your windows directory and set a windows process to run this every so often,

;V.01 Does not yet include an auto installer, Does not yet use supported picture converter,

;Contributions by (Piano_Man, borrowed Function)

;===============================================================

$sFile = "@WindowsDir & TNDTWP.BMP"

Func _ChangeDesktopBackground($sFile, $iPosition = 3)

    Local $sCLSID, $tBuffer, $hImage, $sTemp

; Convert image to BMP image

    _GDIP_Startup()

    $hImage = _GDIP_Image($sFile)

    $sCLSID = _GDIP_EncodersGetCLSID('BMP')

    $sTemp  = _Str_ChangeFileExt($sFile, '.bmp')

    _GDIP_ImageSaveToFile($hImage, $sTemp)

    _GDIP_ImageDispose($hImage)

    _GDIP_Shutdown()

; Set wallpaper position

    Switch $iPosition

        Case 1; Tiled

            RegWrite('HKCU\Control Panel\Desktop', 'TileWallpaper' , 'reg_sz', '1')

            RegWrite('HKCU\Control Panel\Desktop', 'WallpaperStyle', 'reg_sz', '0')

        Case 2; Centered

            RegWrite('HKCU\Control Panel\Desktop', 'TileWallpaper' , 'reg_sz', '0')

            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')

    EndSwitch

; Set wallpaper

    $tBuffer = DllStructCreate("char Text[" & StringLen($sTemp) + 1 & "]")

    DllStructSetData($tBuffer, "Text", $sTemp)

    _API_SystemParametersInfo($SPI_SETDESKWALLPAPER, 0, DllStructGetPtr($tBuffer), BitOR($SPIF_UPDATEINIFILE, $SPIF_SENDCHANGE))

EndFunc

;===============================================================

BlockInput (1)

ChangeDesktopBackground($sFile, 3)

Sleep (2000)

BlockInput (0)

Share this post


Link to post
Share on other sites



Why are you using BlockInput when you aren't doing anything that could be messed up by user input?

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

this is a good point, I guess out of habbit, when first started the script I was planning on opeinging a URL and using a right click function, but then I came across this premade function, wich is truely simpler, so I guess it isnt nessasary, but more than anything I guess I just want to make sure that nothing is going to give away the sorce of the new wallpaper, I guess I'll just hide the tray icon, and take that out, thank you... any other comments?

I should note that this is the first I'v used AutoIt since last december when I wrote a book keeping program for our drivers... very usefull but I cant find the sorce now :) It took a GUI for our drivers and created a text file, e-mailed the text file (and for some drivers a gps history file :) ) and then was re-compiled into an excell spread sheet... it pretty much guarantees DOT compliance...

Not that any of that has to do with this =\?

I guess my quetion now is am I using this correctly, and is this working?

;Written By Jake Campos

;A Death Program

;This script was created for fun, and in no way is meant to be used for malicious purposes...

;Insert this script, and the desktop .bmp into your windows directory and set a windows process to run this every so often,

;V.01 Does not yet include an auto installer, Does not yet use supported picture converter,

;Contributions by (Piano_Man, borrowed Function)

;===============================================================

Func _ChangeDesktopBackground($sFile, $iPosition = 3)

Local $sCLSID, $tBuffer, $hImage, $sTemp

; Set wallpaper position

Switch $iPosition

Case 1; Tiled

RegWrite('HKCU\Control Panel\Desktop', 'TileWallpaper' , 'reg_sz', '1')

RegWrite('HKCU\Control Panel\Desktop', 'WallpaperStyle', 'reg_sz', '0')

Case 2; Centered

RegWrite('HKCU\Control Panel\Desktop', 'TileWallpaper' , 'reg_sz', '0')

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')

EndSwitch

; Set wallpaper

$tBuffer = DllStructCreate("char Text[" & StringLen($sTemp) + 1 & "]")

DllStructSetData($tBuffer, "Text", $sTemp)

_API_SystemParametersInfo($SPI_SETDESKWALLPAPER, 0, DllStructGetPtr($tBuffer), BitOR($SPIF_UPDATEINIFILE, $SPIF_SENDCHANGE))

EndFunc

;===============================================================

ChangeDesktopBackground(@WindowsDir & FWM.BMP, 3)

Sleep (2000)

Edited by cdm_Death

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

alright it's giving me an error with the first function, and then after I took the _ out it complained about an end function =\??

Edited by cdm_Death

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  
Followers 0