VB icon

Windows 10 Desktop Wallpaper Changer

Email
Submitted on: 5/5/2019 6:25:38 PM
By: A_X_O 
Level: Beginner
User Rating: Unrated
Compatibility: VbScript (browser/client side)
Views: 798
 
     Very Basic Script to change the Desktop Wallpaper on Windows 10. Just Drag & Drop an Image on the Script and that's it.

 
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
				
'**************************************
' Name: Windows 10 Desktop Wallpaper Changer
' Description:Very Basic Script to change the Desktop Wallpaper on Windows 10. Just Drag & Drop an Image on the Script and that's it.
' By: A_X_O
'**************************************

'
'-------------------------------------------------------------------------------'
'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++'
'		Demonstration: Windows 10, Desktop Image Changer		'
'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++'
'										'
'	Purpose		: Demonstrates Drag and Drop; Registry Writing		'
'	-----------------------------------------------------------------------	'
'	Creation Date	: 01/04/2019 [dd/mm/yyyy]				'
'	Version		: 1:1							'
'	Designer	: Fabian						'
'										'
'###############################################################################'
'			MODIFICATION HISTORY					'
'-------------------------------------------------------------------------------'
'										'
'	Version		: 1:0	01/04/2019	Create the Sample		'
'			: 1:1	02/04/2019	Added Automatic Refresh		'
'										'
'-------------------------------------------------------------------------------'		
'
Public Const HKCU = &H80000001 
Public Const RegKey = "HKCU\Control Panel\Desktop\Wallpaper"
Public Const RunDLLpath = "\RUNDLL32.EXE user32.dll,UpdatePerUserSystemParameters"
Public Const IntPause = 1000
'
Dim WshShell
Dim FSO
Dim SystemPath
'
Dim Args
Dim Arg
'
Dim DeskImage
Dim NewDesktopImage
'
Public Const ExecutionError = "Drag & Drop any image on this VBScript"
Public Const ExecutionTitle = "Execution Error"
'
Set WshShell = Wscript.CreateObject("Wscript.Shell")
Set FSO = CreateObject("Scripting.FileSystemObject")
'
	SystemPath = FSO.GetSpecialFolder(1)
'
Set Args = WScript.Arguments
'
If Args.Count < 1 Then
'
	Msgbox ExecutionError, VbSystemModal + VbExclamation + VbOkOnly, ExecutionTitle
'
Else
'
For Each Arg In Args
'
Set DeskImage = FSO.GetFile(Arg)
'
	NewDesktopImage = DeskImage.ShortPath 
'
Next
'
With WshShell
'
	.RegWrite RegKey, "%"
'
WScript.Sleep IntPause
'
	.RegWrite RegKey, NewDesktopImage
'
	.Run SystemPath & RunDLLpath,1, True
'
WScript.Sleep IntPause
'
	.SendKeys "%{F5}", True 
'
End With
'
End If
'
Set WshShell = Nothing
Set FSO = Nothing


Other 17 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Beginner category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments


 There are no comments on this submission.
 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.