Sign in to follow this  
Followers 0
noobish

Wallpaper script install

16 posts in this topic

I am pain in the a$$ i know it :( , but this script i'm not able to make it work, i want just a script compiled to exe, and when i executed to install a wallpaper.

$Wallpaper = "...\blabla.jpg" ; for example
$Stile = "Fit" ; yeah .. fit should say enough
Select
Case $Stile="Center"
$Stile="0"
$Stile2="0"
Case $Stile="Fit"
$Stile="1"
$Stile2="0"
Case $Stile="Stretch"
$Stile="2"
$Stile2="0"
Case $Stile="Fill"
$Stile="-1"
$Stile2="0"
Case $Stile="Tile"
$Stile="0"
$Stile2="1"
EndSelect

RegWrite("HKEY_CURRENT_USER\Control Panel\Desktop", "WallpaperStyle", "REG_SZ", $Stile)
RegWrite("HKEY_CURRENT_USER\Control Panel\Desktop", "TileWallpaper", "REG_SZ", $Stile2)
DllCall("user32.dll", "int", "SystemParametersInfo","uint",20,"uint",0,"str",$Wallpaper,"uint",3)

Share this post


Link to post
Share on other sites



Something like this should get you started:

$oShell = ObjCreate("WScript.Shell")
$oFSO = ObjCreate("Scripting.FileSystemObject")
$Wallpaper = @DesktopDir & "1.bmp"

$oShell.RegWrite("HKCUControl PanelDesktopWallpaper", $WallPaper)
$oShell.RegWrite("HKCUControl PanelDesktopWallpaperStyle", "2")
$oShell.Run("%windir%System32RUNDLL32.EXE user32.dll,UpdatePerUserSystemParameters", 1, True)

√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

JLogan3o13 thank you for your help,i put a random .bmp image in my script dir, i compile it to an .exe, but when i executed nothing happens. I don't know why. :ermm:

Share this post


Link to post
Share on other sites

Did you change the path to the file from @DesktopDir to @ScrtipDir?


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

My mistake people sorry,which one is the @DesktopDir

EDIT*Sorry people i'm tatally burned,i found the problem,is in my head

Thank you all, God bless you all

Everything works great, i appreciate your assistance, you are just great

Edited by noobish

Share this post


Link to post
Share on other sites

hmm,sorry i'm back,how to do this script to use a jpeg or png image.

Share this post


Link to post
Share on other sites

Thank you very much guys that does the trick.

Ah,i must built separate exe for x86 and x64 isn't it if i want this script to work to both ?

Thank you all.

Share this post


Link to post
Share on other sites

No, look at RegRead in the help file on how to write to the 64-bit registry values.


_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 04/09/2015

Share this post


Link to post
Share on other sites

hmm,sorry i'm back,how to do this script to use a jpeg or png image.

 

If it can help you, I found a PowerShell script that call the user32.dll to do that, and I converted it into an AutoIt script, example :

$wallpaper = "C:\Windows\Web\Wallpaper\Nature\Natural-scenery-of-the-Canadian-forest-lake_1920x1200.jpg"

DllCall("user32.dll", "int", "SystemParametersInfo","int",20,"int",0,"str",$wallpaper,"int",0x01)

With that code, a simple JPG wallpaper can be set, without rebooting computer.

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

If it can help you, I found a PowerShell script that call the user32.dll to do that, and I converted it into an AutoIt script, example :

$wallpaper = "C:\Windows\Web\Wallpaper\Nature\Natural-scenery-of-the-Canadian-forest-lake_1920x1200.jpg"

DllCall("user32.dll", "int", "SystemParametersInfo","int",20,"int",0,"str",$wallpaper,"int",0x01)

With that code, a simple JPG wallpaper can be set, without rebooting computer.

Mmmm, thanks for sharing that.

I don't recall anyone here ever coming across that before and posting about it?

Hopefully it works for XP.

There are many wallpaper programs here, most of which use third party stuff, but a few used a DLL call for bmp (only).

Looks like I have a program of mine to update a little now, which may well be easier than how I was gonna do it.

P.S. My program uses the DLL call, but IrfanView command-line for jpegs.

EDIT

Now that I've said that, people are sure to find plenty of instances I missed.

Edited by TheSaint

AutoIt.4.Life Clubrooms - Life is like a Donut (secret key)

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Share this post


Link to post
Share on other sites

Mmmm, thanks for sharing that.

I don't recall anyone here ever coming across that before and posting about it?

It's been documented in the Example section already.

_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 04/09/2015

Share this post


Link to post
Share on other sites

#14 ·  Posted (edited)

Mmmm, thanks for sharing that.

I don't recall anyone here ever coming across that before and posting about it?

Hopefully it works for XP.

 

In fact, it works only with Vista, 7, 8 and 8.1

Edited by FreeBeing

Share this post


Link to post
Share on other sites

#15 ·  Posted (edited)

It's been documented in the Example section already.

That figures, and it's not like I've been actively looking for a solution, just occasionally keep tabs on what catches my eye there, so not really surprising I missed it ... or if it was a while back, and non XP was mentioned then I may have just not retained it.

 

In fact, it works only with Vista, 7, 8 and 8.1

 

Damn, I should have known it was too good to be true, and checked back here sooner.

Now I've pulled my program (SetAs Wallpaper) out of storage for nothing ... maybe.

I don't even have it installed on my Laptop (XP) or Netbook (Win7).

Last time I updated the program, was back in September 2009, when my Main Desktop was still working, and it was used to great effect there. It's odd to think, that I've stayed with the same boring Crystal.jpg background on my Laptop for years now (never meant to be my main PC replacement, but using it with it's keyboard, mouse and monitor now).

On my Desktop, the background changed every second day and more often if a Birthday was set. Haven't needed a program on the Netbook, as the program I used to overcome the Starter Edition restriction also changes the background every day for me.

My old Desktop still runs my program, but I don't use it that much ... mainly just for burning and ripping.

Oh well, perhaps I'll look into my original intention (GDIPlus .... jpg to bmp on the fly ... if I remember rightly).

Edited by TheSaint

AutoIt.4.Life Clubrooms - Life is like a Donut (secret key)

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Share this post


Link to post
Share on other sites
DllCall("user32.dll", "int", "SystemParametersInfo","int",20,"int",0,"str",$wallpaper,"int",0x01)

Actually, now that I've checked my code, that's the same DllCall as I'm using for bmp, except my last parameter is 0 not 0x01

So I guess it just works differently after XP, and I knew after all.

Funny how often I find myself working on a program update, where it's the same month, but different year to last one. In this case, September four years ago.


AutoIt.4.Life Clubrooms - Life is like a Donut (secret key)

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

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