Windows 7 Gadget to display image based on variable read from text file

52 Views Asked by At

I'm trying to write a gadget that reads input from a text file. the file contains a number. The gadget needs to read the file and then display the image at a specific location with the number that is read but add ".png" at the end. Example would be "P:/some/location/file_to_read.txt" (contains the number "165") then display the image in the gadget at "P:/some/other/location/165.png"

How do you read a text file and assign the contents as a variable and then use that variable as part of a path to a local file (C:/some/location/$assigned_variable.png) that the gadget will display in JS?

Here is the code I'm using for a temporary solution that pulls the image from a webserver and displays it in the gadget, it works but uses bandwidth...I'd rather use a variable as part of a local path to display

<script type="text/javascript" language="javascript">
      //var a=0;
      function init()
      {
            //document.getElementById("status").src="images/head.png";
            document.getElementById("status").src="http://some_web_page/images/head.png?now=" + new Date();
            //document.getElementById("gadgetContent").innerHTML = a;
            //a+=1; //for testing timeout
            setTimeout("init()", 600000);
      }
</script>
</head>
<body onload="init();">
<g:background 
    id="background" 
    src="images/headb.png"
    style="position:absolute;top:0;left:0;z-index:-999;no=repeat;" />
      <img id="status" src="images/head.png"  />
</body>

Thanks!

0

There are 0 best solutions below