augrunt

Hello, I am trying to Improve a Gadget which forces users to log in to there Administrator accounts to use Backgrounds simply because it was named "Administrator" at the Path.

At first I tried using PHP like calls. But didn't work, So I resorted to looking at how the calls are made.

I've added this.

<!--
////////////////////////////////////////////////////////////////////////////////
//Find Which User is Using the Gadget and SET the Variable - Steven {augrunt}
////////////////////////////////////////////////////////////////////////////////
-->
<script>
userProf = System.Environment.getEnvironmentVariable("USERPROFILE");
userPath = userProf + "\\AppData\\Roaming\\Microsoft\\Windows Photo Gallery\\Windows Photo Gallery Wallpaper.jpg"
</script>

To the end of the script. In hopes of not interfering. but BEFORE the "path" is called for the background image.

<body onload="startup()">

<!-- removed bulk of code for forum post.--->


<g:background id="canvas" src= style="position: absolute; width: 125%; height: 100%; left: 0; top: 0; z-index: -999;" />

My question is, What do I put in the Also correct me if im wrong on the USERPATH setting at the top there. I saw someone use \\ for an address and it seemed correct to me.




Re: Sidebar Gadget Development Environment Variables and Image Calls.

Jonathan Abbott

You haven't said what you're trying to achieve, but I'm guessing that you want the Windows Photo Gallery wallpaper to be the background image of the gadget. In which case:

Move your script into the HEAD section and then set the src of the g:background:

<html>
<head>
<script language="javascript" type="text/javascript">
function startup() {
...
var userProf = System.Environment.getEnvironmentVariable("USERPROFILE");
var userPath = userProf + "\\AppData\\Roaming\\Microsoft\\Windows Photo Gallery\\Windows Photo Gallery Wallpaper.jpg";
canvas.src = userPath;
}
</script>
</head>
<body ...>
<g:background id="canvas" style="position: absolute; width: 125%; height: 100%; left: 0px; top:0px;" />
</body>
</html>

You don't need to set z-index on the g:background, it will always be at the bottom.




Re: Sidebar Gadget Development Environment Variables and Image Calls.

augrunt

Thanks for that, I figured it out a few minutes ago and then i JUST decided to check and bang someone answered it. Where were you 3 hours ago lol

Anyway I made it even better, Now it works with whatever Windows Vista has set as its wallpaper and no longer requires the User to have to set it using Windows Picture Manager. It now uses and reads the Registry to find out where it should look.