Programmatically change wallpaper in Windows 10?

22 visualizzazioni (ultimi 30 giorni)
Kevin
Kevin il 14 Giu 2017
Risposto: JohnGalt il 15 Giu 2017
I guess this can be done in Java. So has anyone figured out calling some java script in MATLAB to do that?
  1 Commento
Rik
Rik il 14 Giu 2017
Have a read here. It will greatly improve your chances of getting an answer.

Accedi per commentare.

Risposte (1)

JohnGalt
JohnGalt il 15 Giu 2017
this can be done with a '.cmd' file... which can be executed from the matlab command window using 'system()' ... this starts by copying the wallpaper using 'copy "new_Wallpaper.jpg" "C:\Wallpaper.jpg"' - this is a snippet of code I found online and I can't seem to find the original to give it proper credit... anyway:
@ECHO OFF
:: Paste the wallpaper, desired, due to its extension (type bmp or jpg), for an own folder within it. Do not modify the name of the desired file
copy "new_Wallpaper.jpg" "C:\Wallpaper.jpg"
:: Add the required values ​​to the registry, if these people are using a System Wallpaper. If they have always modified their wallpapers, the following lines are not necessary. "They have no habit of hurting themselves, constantly"
REG ADD "HKCU\Control Panel\Desktop" /V Wallpaper /T REG_SZ /F /D "C:\Wallpaper.jpg"
:: Modify the following line in the last number to 0 if you want to center the bitmap on the desktop. Change the last number in the following line to 2 if you wish to extend the bitmap vertically and horizontally to fit on your desktop.
REG ADD "HKCU\Control Panel\Desktop" /V WallpaperStyle /T REG_SZ /F /D 0
:: Change to 0 (zero), the last number not to "pave" the image, set it to A (1) will be tiled.
REG ADD "HKCU\Control Panel\Desktop" /V TileWallpaper /T REG_SZ /F /D 0
:: The following lines energize desktop
%SystemRoot%\System32\RUNDLL32.EXE user32.dll, UpdatePerUserSystemParameters
::The following line locks (locks) the workstation (server).
::%SystemRoot%\System32\RUNDLL32.EXE user32.dll, LockWorkStation

Categorie

Scopri di più su Startup and Shutdown in Help Center e File Exchange

Tag

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by