1

I like how certain Windows themes rotate through various images, but I also like to use BgInfo to write out various machine info to the desktop wallpaper image.

I created a customized BGI file and pointed it to current.jpg in a folder. Then I wrote a powershell script to copy a random image in that folder to the current.jpg and then execute the BgInfo command-line options to update the wallpaper:

Get-ChildItem -Path $Env:USERPROFILE\Pictures\wallpaper\* -Include *.* -Exclude current.jpg | Get-Random | Foreach-Object { Copy-Item -Path $_ -Destination $Env:USERPROFILE\Pictures\wallpaper\current.jpg }
D:\utils\SysinternalsSuite\Bginfo.exe $Env:USERPROFILE\Documents\custom.bgi /NOLICPROMPT /timer:0

This works great. However, when I setup a scheduled task to execute this script every thirty minutes a powershell window would flash on the screen, briefly. I had seen solutions that use a VBS file to execute commands, so I tried that:

Dim shell,command
command = "powershell.exe -NoLogo -NonInteractive -WindowStyle Hidden -File D:\utils\select-random-wallpaper.ps1"
set shell = CreateObject("WScript.Shell")
shell.Run command,0

I no longer see a brief console window, but it still will activate the foreground app in weird ways. Like if I am using Chrome, it will switch the current active Chrome window to a different one.

Am I doing something wrong? How do I schedule a task without having it affect foreground applications?

Edit: Related to it being BgInfo-specific, any idea if BgInfo's source is available anywhere? The bug's been around since 2007 and it hasn't even been updated since 2013.

1 Answer 1

2

This looks like an issue with BGInfo (see here and here), and none of the options seem to change this behavior.

It is apparently possible to get the same info as BGInfo, write text on an image, and refresh the wallpaper via powershell, so you could roll your own solution if you are so inclined. No guarantees that one of these steps won't end up grabbing focus as well, but it may be worth a try.

2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.