Every project folder must contain the following 3 files:
Create a directory and rename it Hello world!. This directory will be the project folder to be use for HTML Screensaver Maker on converting into screensaver executable files.
Create an HTML document inside the Hello world! directory and call it index.html. The screensaver will show this page when running in fullscreen mode. Add the following code to it, and save the document.
<!DOCTYPE html>
<html>
<head>
<title>Hello World!</title>
<script type="text/javascript">
function animate() {
var obj=document.getElementById("word");
obj.style.top=Math.round(Math.random() *document.documentElement.clientHeight);
obj.style.left=Math.round(Math.random() *document.documentElement.clientWidth);
setTimeout(function(){animate();}, 2000);
}
function load() {
var word=external.getPreference("word");
if(word){
document.getElementById("word").innerHTML=word;
}
animate();
}
</script>
</head>
<body onload="load();" style="background-color:black;">
<div id="word" style="position:absolute;width:100px;height:100px;background-color:white;font-weight: bold;">Hello World!</div>
</body>
</html>
Create an HTML document inside the Hello world! directory and call it config.html. The screensaver will show this page when running in config mode. Add the following code to it, and save the document.
<!DOCTYPE html>
<html>
<head>
<title>Hello World!</title>
</head>
<body onload="document.getElementById('word').value=external.getPreference('word');external.Resize(300, 200)">
<input type="text" name="word" id="word" value="Hello World!" />
<input type="button" value="Save" onclick="external.setPreference('word',document.getElementById('word').value);" />
</body>
</html>
Create an HTML document inside the Hello world! directory and call it preview.html. The screensaver will show this page when running in preview mode. Add the following code to it, and save the document (Note we are using the same code as fullscreen mode, but you can create another code or just delete the preview page, to start the fullscreen mode like preview page).
<!DOCTYPE html>
<html>
<head>
<title>Hello World!</title>
<script type="text/javascript">
function animate() {
var obj=document.getElementById("word");
obj.style.top=Math.round(Math.random() *document.documentElement.clientHeight);
obj.style.left=Math.round(Math.random() *document.documentElement.clientWidth);
setTimeout(function(){animate();}, 2000);
}
function load() {
var word=external.getPreference("word");
if(word){
document.getElementById("word").innerHTML=word;
}
animate();
}
</script>
</head>
<body onload="load();" style="background-color:black;">
<div id="word" style="position:absolute;width:100px;height:100px;background-color:white;font-weight: bold;">Hello World!</div>
</body>
</html>
Run the HTML Screensaver Maker go to menu File > Open, find and select the folder created previously (Hello world!). choose in the dropdown (Mode) both modes (fullscreen,preview and configurate), to see if the script work, click in compile when done testing, save you screensaver file and done! you have now your first HTML screensaver.
| int | external.X | Gets or sets the x-coordinate of the upper-left corner of the window. | ||||||
| int | external.Y | Gets or sets the y-coordinate of the upper-left corner of the window. | ||||||
| int | external.Width | Gets or sets the width of the window. | ||||||
| int |
| Version | 1.0 |
| License: | Free |
| Operating Systems: | Windows All |
| Additional Requirements: | Microsoft .NET Framework |