Monday, July 25, 2016

How to Make a simple windows 7 gadget

gadgets
Make a simple windows 7 gadget

First of all what are gadgets? 

Gadgets are lightweight HTML and script-based applications which can present information or provide functionality from a variety of sources such as websites or services. To make a gadget you need to know the basic of HTML.

In this post I am going to show you how to make a simple windows 7 gadget. A basic gadget needs an XML file named exactly gadget.xml and an HTML file with the gadget name. Also you can include any pictures needed in the gadget. In this post. I am going to show you how to make a simple demo clock gadget which would display time in a simple way. Just follow the steps given and if you know basic HTML you will find it easy to understand.


Step 1: First of all make a new folder on your desktop and rename it anything you want.
Step 2: Put the html file which would be your gadget into the folder and rename the file as the name of the gadget. In this case the name would be NXClock.html. The demo code for the html is given below.


<html><head><title>NXClock</title><script language="VBScript">Sub Window_Onloaddocument.body.style.width = 155document.body.style.height = 50document.body.style.margin = 0End SubFunction Clock()box.value = timeX = SetTimeOut("Clock()", 1000)End Function</script><style>input {background-color: #000000;color: #FF0000;text-align: center;font-size: 24pt;}</style></head><body bgcolor="#000000" onload="Clock()"><table align="center"><tr><td><input type="text" id="box" size="6"></td></tr></table></body></html>


Step 3: Now save the following code as gadget.xml EXACTLY into the folder you created earlier. Do not name it anything else or the gadget will not work. You must replace the NXClock.html in the code with the name of the html file if you are making your own gadget. And you can change the title too.

<?xml version="1.0" encoding="utf-8" ?><gadget> <name>NXClock</name> <version>1.0.0.0</version> <description>Description</description> <author name="Noor Mohamed"> </author> <hosts> <host name="sidebar"> <base type="HTML" apiVersion="1.0.0" src="NXClock.html" /> <permissions>Full</permissions> <platform minPlatformVersion="1.0" /> </host> </hosts></gadget>


Step 4: Add the NXClock.html and gadget.xml to a zip file. Be careful to add the files to the zip file, NOT the folder containing them.
Step 5: Now change the extension of the zip file to .gadget. You can either do this by going to folder options > View and disabling the Hide extensions for known file types and then changing the extension. Or else you can do it using command prompt.
Step 6: Now you will have ended with a windows gadget file. Open it and click install and if all went right a new gadget would appear on your desktop.