Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Open current wallpaper in windows8
Set Shell = CreateObject("WScript.Shell")
' change to TranscodedImageCache_001 for second monitor and so on
openWallpaper("HKCU\Control Panel\Desktop\TranscodedImageCache_000")
function openWallpaper(regKey)
arr = Shell.RegRead(regKey)
a=arr
fullPath = ""
consequtiveZeroes = 0
For I = 24 To Ubound(arr)
if consequtiveZeroes > 1 then
exit for
end if
a(I) = Cint(arr(I))
if a(I) > 1 then
fullPath = fullPath & Chr(a(I))
consequtiveZeroes = 0
else
consequtiveZeroes = consequtiveZeroes + 1
end if
Next
Shell.run fullPath
end function
Wscript.Quit
@GnstheGrain

This comment has been minimized.

Copy link

GnstheGrain commented Nov 26, 2015

Can't seem to make it work on my Win 8.1 ... I'm on a single Monitor setup.. I tried to remove the _000 too but still not working..

Would you mind contacting me to figure out the culprit ?

@TimSirmovics

This comment has been minimized.

Copy link

TimSirmovics commented Nov 27, 2015

This is great.
The only change I had to make was to add quotes around the final path in case it has spaces:

Shell.run Chr(34) & fullPath & Chr(34)

@kakhak

This comment has been minimized.

Copy link

kakhak commented Oct 12, 2016

Thanks, works great on Win10 with replacing latest final path as TimSirmovics suggested.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.