Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Refreshing desktop background?

180 views
Skip to first unread message

Nebulus

unread,
Jul 31, 2003, 6:13:57 PM7/31/03
to
Hey all. I've got a vbscript that'll set an html page as the desktop
background, and it *should* refresh the desktop to show the page. The
problem is that it's able to set the background, but the desktop doesn't
refresh correctly. The desktop refreshes, but the background doesn't. Is
there a way to do this?

See code below:

' Create the variables needed
Dim WSHShell
Dim strRegKey
Dim strWallpaper
Dim strDesktop

' Create the Wscript Shell object
Set WSHShell = WScript.CreateObject("WScript.Shell")

' Define the wallpaper
strWallpaper = "%SystemRoot%\Web\Wallpaper\PRWeb.html"
strDesktop = WSHShell.SpecialFolders("Desktop")

' Create the wallpaper key
strRegKey = "HKEY_CURRENT_USER\"
strRegKey = strRegKey & "Software\"
strRegKey = strRegKey & "Microsoft\"
strRegKey = strRegKey & "Internet Explorer\"
strRegKey = strRegKey & "Desktop\"
strRegKey = strRegKey & "General\"
strRegKey = strRegKey & "Wallpaper"

' Write the key, type, and value
WSHShell.RegWrite strRegKey, strWallpaper, "REG_EXPAND_SZ"

' Refresh the desktop now.
WSHShell.AppActivate strDesktop
WSHShell.SendKeys "{F5}"

' Quit
Wscript.quit(0)


name

unread,
Aug 1, 2003, 12:52:13 AM8/1/03
to
Sorry, I will just brush over this.

htt files or dektop embedded files are not
input/output event scriptable.


While you can set a local or remote path to your
"src" or "href" stuff, it will not behave along
a meta "refresh tag"

========

I suggest you to observe the MS examples.

If 60% don't work, don't use it.

---------------
why not use a "naked" hta with iframe
and all security attributes default or enabled
and this window set beautifully as documented.


"Nebulus" <pfried...@nebulus.org> wrote in message
news:4KacnTo_APM...@comcast.com...

name

unread,
Aug 1, 2003, 1:02:02 PM8/1/03
to

Try

http://www.systeminternals.com/ntw2k/source/regmon.shtml

and see what call chain activity is actually taking place.

======


"Nebulus" <pfried...@nebulus.org> wrote in message
news:4KacnTo_APM...@comcast.com...

Joe Earnest

unread,
Aug 1, 2003, 1:27:15 PM8/1/03
to
Hi,

[snipped]


"Nebulus" <pfried...@nebulus.org> wrote in message
news:4KacnTo_APM...@comcast.com...

> Hey all. I've got a vbscript that'll set an html page as the desktop
> background, and it *should* refresh the desktop to show the page. The
> problem is that it's able to set the background, but the desktop doesn't
> refresh correctly. The desktop refreshes, but the background doesn't. Is
> there a way to do this?

You're not getting focus on the desktop, so you can't refresh by sending F5.

The following works on Win2k and WinXp, and is the equivalent of
interactively right-clicking on the desktop and selecting "Refresh" from the
context menu.

The spelling, capitalization, and location of the ampersand in the string
must match exactly per the localized language version of Windows...

set shellApp = createobject("shell.application")
set desktop = shellApp.Namespace(0)
desktop.self.InvokeVerb "R&efresh"

credit: Michael Harris (MVP)

For other versions, Jean (JMST Belgium) came up with the ingenious solution
of writing and running an SCF file. The following is a cut and paste (a
splash of Belgian French, but I think you can pick it out).

---
A scripting solution should be to create and run a SCF file
to give focus to the desktop followed by
sending F5 with SendKeys :

'---8<---Raffraichir_Bureau.VBS---Couper-Ici---
scfBureau=Repertoire_Script&"Le_Bureau.scf"

CreateObject("Scripting.FileSystemObject")._
CreateTextFile(scfBureau,True)._
Write(_
"[Shell]"&VbNewLine&_
"Command=2"&VbNewLine&_
"[Taskbar]"&VbNewLine&_
"Command=ToggleDesktop"_
)

With CreateObject("WScript.Shell")
.Run """"&scfBureau&""""
Effacer_Fichier(scfBureau)
WScript.Sleep 100
.SendKeys "{F5}"
End With

Sub Effacer_Fichier(fichier)
With CreateObject("Scripting.FileSystemObject")
On Error Resume Next
While .FileExists(fichier)
.DeleteFile fichier,True
Wend
On Error GoTo 0
End With
End Sub

Function Repertoire_Script
With WScript
r=.ScriptFullName
r=Left(r,Len(r)-Len(.ScriptName))
End With
Repertoire_Script=r
End Function
'---8<---Raffraichir_Bureau.VBS---Couper-Ici---
---

Joe Earnest

Nebulus

unread,
Aug 3, 2003, 3:51:34 PM8/3/03
to
Ok, I think everybody's missing what I was asking.
I wasn't asking how to refresh the page in the desktop, I was asking how to
refresh the deskotp AFTER installing the page from a script.

I figured it out, so here's the code:

' Quit
Wscript.quit(0)


"name" <rlei...@tampabay.rr.com> wrote in message
news:%239jtti%23VDH...@TK2MSFTNGP09.phx.gbl...

Gurgen

unread,
Aug 3, 2003, 6:53:54 PM8/3/03
to
Not really possible... unless you are using some third party ActiveX objects to set Wallpaper via API call
Another option is to combine registry modification with an explicit wallpaper confirmation via display properties window.
Here is a slightly modified script introduced by Tom Lavedas:

strWallpaper = "%SystemRoot%\Web\Wallpaper\PRWeb.html"

strRegKey = "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Desktop\General\Wallpaper"
With CreateObject("Wscript.Shell")
.RegWrite strRegKey, strWallpaper, "REG_EXPAND_SZ"
CreateObject("Shell.Application").ControlPanelItem cstr("desk.cpl")
do until .AppActivate ("Display Properties") : wsh.sleep 100 : Loop
.SendKeys "{Up}{Down}{Enter}"
End With


Gurgen
http://www.gurgensvbstuff.com


"Nebulus" <pfried...@nebulus.org> wrote in message news:WR-dnWG55sp...@comcast.com...

0 new messages