- Joined
- 5 Apr 2002
- Messages
- 13,314
This tutorial provides the necessary steps to implement HTML (and other programming languages) into your desktop via the use of active desktop (a feature built into Explorer that allows you to view HTML on your desktop). This tutorial will show you how to turn the active desktop feature on, how to run programs using the A HREF tag, implement a notepad type editor into your desktop, and even a simple calendar. Now I understand that some of you have more knowledge of HTML than others, this tutorial is aimed at making it easy for everyone. Let's get started.
_______________________
CREATE AN HTML FILE
First we need to create an HTML file. Let’s keep it simple just so we can get started.
- Open your favorite HTML editor, such as Notepad
- Insert the following code (remember, we are keeping it simple and you can edit it later)
- Now that we have a basic HTML file, save it to your hard drive (i.e. "C:\WINDOWS\activedesktop.html").
_______________________
ADD YOUR HTML FILE TO YOUR DESKTOP
First we need to turn active desktop on. To do so, follow these steps.
- Right click your desktop
- Select “Properties”
- Select the “Desktop” tab
- Set your background color to white, remove any wallpaper
- Select "Customize Desktop"
- Select the “Web” tab
- Click "New"
- Click "Browse"
- Locate the file that you saved above
- Click "Open"
- Click "OK"
Note: You will need to do this for each HTML file we create below.
_______________________
PROGRAM LAUNCH
Now that we have an HTML document on our desktop, let's add a link (A HREF) to it that will open Solitare.
STEP ONE
We need to create a shortcut to Solitare, to do so, follow these steps.
- Open Windows Explorer and navigate to C:\WINDOWS
- Right click
- Select the submenu: "New"
- Select "Shortcut"
- Use the wizard to find Solitare ("C:\WINDOWS\System32\sol.exe")
- Click "Next"
- Name the shortcut (i.e. "sol" to keep it simple)
- Click "Finish"
STEP TWO
Next we need to create a simple VBSCRIPT, follow these steps to a tee.
- Run Notepad
- Insert the following code
- Now, here's where it gets tricky. You need to make "oShell.run" equal to the name of the shortcut that you created in step one. Following the example that I have set, we will make it equal to "sol" (as seen above).
- Using the above example, save the file as "C:\WINDOWS\sol.vbs". Number one: This file MUST be saved in "C:\WINDOWS". Number two: This file MUST be named just as the shortcut is with the extention ".VBS" (i.e. "sol.vbs").
You can make the shortcut open any program on your hard drive, just remember.
- The shortcut must be in "C:\WINDOWS"
- "oShell.run" must be equal to the shortcut name
- The ".VBS" file must be saved in "C:\WINDOWS" and named to match the shortcut name
STEP THREE
We are now going to start editing the HTML file which we created in the beginning of this tutorial. We are now ready to add the script that will execute the VBS file we created above. Insert the below code between the <HEAD></HEAD> of your HTML file.
The above code needs to be added exactly as is, do not add or modify the code in anyway, doing so could cause problems.
STEP FOUR
We need to create an "A HREF" statement that will launch our program, this is quite simple.
- Insert the following code between your <BODY></BODY> tags. Remember, we are using Solitare as our example.
Please note: there is no space between "java" and "script:void(0)" in the actual code, for some odd reason vBulletin adds one. So make sure that you do NOT have a space when using this code.
The "exec('sol.vbs');" command is going to execute our ".VBS" file, which in turns launches our shortcut ("sol") which launches the program ("C:\WINDOWS\System32\sol.exe").
Let's take an expanded look at our new HTML file.
TIPS AND TRICKS TO MAKE PROGRAM LAUNCH WORK BETTER
Here are a few tweaks to make the above program launch work better and faster.
Please note that if you are running any antivirus program, such as Norton AntiVirus ("NAV"), you may encounter a "Malicious script detected" alert. The reason you will see this warning is because antivirus software, such as NAV, flags such files as a virus. You will receive this warning for each and every shortcut you setup. If you are running NAV, you can simply select "Authorize this script" from the drop down box and select "OK" and you will not be flagged again for this link.
This next tweak is a big one. You may notice an ActiveX warning. Well, let's get rid of that annoying warning. First we need to add the
"My Computer" security zone to your Internet Options: Security tab.
- Run regedit
- Navigate to: HKEY_CURRENT_USER, SOFTWARE, Microsoft, Windows, CurrentVersion, Internet, Settings, Zones, 0
- Set "FLAGS" dword value to 47
- Close regedit
- Launch Internet Explorer
- Select the "Tools" menu
- Select "Internet Options"
- Select the "Security" tab
You will notice that you have a "My Computer" security zone (if not, reboot and try relaunching Internet Explorer). Now configure your "My Computer" security zone.
- Highlight the "My Computer" zone icon
- Click "Custom Level"
- Under "ActiveX controls and plug-ins", change "Download signed ActiveX controls" to "Enable"
- Change "Download unsigned ActiveX controls" to "Enable"
- Change "Initialize and script ActiveX controls not marked as safe" to "Enable"
- Change "Run ActiveX controls and plug-ins" to "Enable"
- Chnage "Script ActiveX controls marked safe for scripting" to "Enable"
- Click "OK"
- Click "Apply"
- Click "OK"
After doing so, you will not receive any ActiveX control warnings for local files. Please note that making the above changes will not affect files located on the web (such as files on the xp-erience.org website). All websites on the Internet use the "Internet Security Zone", not the "My Computer Security Zone".
Now we are going to go over some shortcuts that you can create and add to your program launch. To create a shortcut, do the following.
- Run Explorer and go to "C:\WINDOWS"
- Right click
- Select the "New" menu
- Select "Shortcut"
- Then simply follow the wizard to create a new shortcut
Here are a few examples that you can add.
- SHUTDOWN: %windir%\system32\tsshutdn.exe 0 /DELAY:0 /POWERDOWN
- REBOOT: %windir%\System32\shutdown.exe -r -t 00
- LOCK PC: %windir%\System32\rundll32.exe user32.dll,LockWorkStation
- USER ACCOUNTS: %windir%\System32\control.exe userpasswords2
Now remember to create your ".VBS" file to match your shortcut.
_______________________
NOTEPAD
The next thing we are going to cover is the desktop notepad. You can either add this to your existing HTML file or you can create a new file. I recommend creating a new file unless you have the experience. I am pretty much going to do everything for you with the notepad, all you need to do is make it how you want it to look. Let's get started.
STEP ONE
- Create a blank ".TXT" file
- Save as "C:\WINDOWS\quicknotes.txt"
STEP TWO
Create a new HTML file (save it however you'd like it any directory) and paste the following code.
SOME THINGS TO REMEMBER
It is important that you don't change the name of the FORM or TEXTAREA (i.e. name=""). If you change the name of these fields then the VBSCRIPT will not function, at all.
Something you can, and will probably want to change is the size of the textarea. Simply adjust the two numbers (cols="29" and rows="7") to the size you want. The first variable represents columns (width) and the second represents rows (height). Making the textarea 60 by 20 will make it appear larger.
Lastly, if you decide you would rather have an INPUT button instead of text for the save function, follow these two steps.
- REMOVE
- ADD
_______________________
CALENDAR
I have taken the time to create a simple HTML/JavaScript calendar. At this time, this calendar has no fancy functions, but I may expand on that in the future. The calendar is a bit more in depth than the notepad was, and needs more attention. We are going to create two files, one HTML file and one javascript (".JS") file. Here we go.
STEP ONE
- Create a new HTML file
- Copy and paste the following code, then save the file to your hard drive
STEP TWO
- Download this file: calendar.js
- Save the above file in the same directory as you save the first HTML file
STEP THREE
Assuming that you will not be using the same color scheme as I am, there are three variables that you need to change within the "calendar.js" file.
Within "calendar.js" the colors for the table and font are preset, the changes you are going to make affect.
- BORDERCOLOR: the color of the border of the table
- TD BGCOLOR: the background color of the top row (where "month, year" appear)
- FONT COLOR: the color of the font in the top row
Follow these steps to make the changes with ease.
- Open the file in Notepad
- Press F3 once
- Input "#"
- Click "Find Next"
- Proceed to change the color to one that fits your tastes (for BORDERCOLOR)
- Press F3
- Make the same change (for TD BGCOLOR)
- You will need to do this two more times (one for FONT COLOR and one for BORDERCOLOR)
_______________________
RAPPING IT UP
Now obviously if you are attempting active desktop then you have some experience with HTML. It goes without saying that you can change any background color, font color, or add your own touch (such as font tags, center, etc.). I highly recommend that you do NOT attempt to make any changes to any of the above functions (such as the JavaScript and VBSCRIPT). You can also create one file with all the above functions, you just have to insert the functions correctly (JavaScript/VBSCRIPT into <HEAD>, etc.).
DISCLAIMER
By using the above JavaScript, VBSCRIPT, and HTML you agree NOT to hold Matt (a.k.a. “madmatt”) responsible for any problems that you might incur during the use of, or installation, of the above code. Matt has written, and thoroughly tested, the aforementioned code, but will not be held accountable for its failure.
Furthermore, Matt is not responsible for damage caused to software or hardware.
Do NOT contact Matt with questions concerning the code, how to use it, or how to make it work; he will not respond.
All questions can be posted to this thread.
THE FINAL WORD
This has been another madmatt_dtop innovation in conjunction with XP-erience.org (http://www.xp-erience.org).
All code copyright, madmatt usa, 2001-02 (www.madmatt.net). Site copyright, XP-erience.org, 2001-02.
_______________________
CREATE AN HTML FILE
First we need to create an HTML file. Let’s keep it simple just so we can get started.
- Open your favorite HTML editor, such as Notepad
- Insert the following code (remember, we are keeping it simple and you can edit it later)
PHP:
<HTML>
<HEAD>
<TITLE>Active Desktop</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF">
<a href="http://www.xp-erience.org">XP-erience.org</a>
</BODY>
</HTML>
- Now that we have a basic HTML file, save it to your hard drive (i.e. "C:\WINDOWS\activedesktop.html").
_______________________
ADD YOUR HTML FILE TO YOUR DESKTOP
First we need to turn active desktop on. To do so, follow these steps.
- Right click your desktop
- Select “Properties”
- Select the “Desktop” tab
- Set your background color to white, remove any wallpaper
- Select "Customize Desktop"
- Select the “Web” tab
- Click "New"
- Click "Browse"
- Locate the file that you saved above
- Click "Open"
- Click "OK"
Note: You will need to do this for each HTML file we create below.
_______________________
PROGRAM LAUNCH
Now that we have an HTML document on our desktop, let's add a link (A HREF) to it that will open Solitare.
STEP ONE
We need to create a shortcut to Solitare, to do so, follow these steps.
- Open Windows Explorer and navigate to C:\WINDOWS
- Right click
- Select the submenu: "New"
- Select "Shortcut"
- Use the wizard to find Solitare ("C:\WINDOWS\System32\sol.exe")
- Click "Next"
- Name the shortcut (i.e. "sol" to keep it simple)
- Click "Finish"
STEP TWO
Next we need to create a simple VBSCRIPT, follow these steps to a tee.
- Run Notepad
- Insert the following code
PHP:
Dim oShell
Set oShell = WScript.CreateObject ("WScript.shell")
oShell.run "sol"
Set oShell = Nothing
- Now, here's where it gets tricky. You need to make "oShell.run" equal to the name of the shortcut that you created in step one. Following the example that I have set, we will make it equal to "sol" (as seen above).
- Using the above example, save the file as "C:\WINDOWS\sol.vbs". Number one: This file MUST be saved in "C:\WINDOWS". Number two: This file MUST be named just as the shortcut is with the extention ".VBS" (i.e. "sol.vbs").
You can make the shortcut open any program on your hard drive, just remember.
- The shortcut must be in "C:\WINDOWS"
- "oShell.run" must be equal to the shortcut name
- The ".VBS" file must be saved in "C:\WINDOWS" and named to match the shortcut name
STEP THREE
We are now going to start editing the HTML file which we created in the beginning of this tutorial. We are now ready to add the script that will execute the VBS file we created above. Insert the below code between the <HEAD></HEAD> of your HTML file.
PHP:
<SCRIPT>
function exec (command) {
if (document.layers && navigator.javaEnabled()) {
window._command = command;
window.oldOnError = window.onerror;
window.onerror = function (err) {
if (err.indexOf ("User didn't grant") != -1) {
alert('command execution of ' + window._command +
' disallowed by user.');
return true;
}
else return false;
}
netscape.security.PrivilegeManager.enablePrivilege
('UniversalExecAccess');
java.lang.Runtime.getRuntime().exec(command);
window.onerror = window.oldOnError;
}
else if (document.all) {
window.oldOnError = window.onerror;
window._command = command;
window.onerror = function (err) {
if (err.indexOf('utomation') != -1) {
alert('command execution of ' + window._command +
' disallowed by user.');
return true;
}
else return false;
};
var wsh = new ActiveXObject('WScript.Shell');
if (wsh)
wsh.Run(command);
window.onerror = window.oldOnError;
}
}
</SCRIPT>
The above code needs to be added exactly as is, do not add or modify the code in anyway, doing so could cause problems.
STEP FOUR
We need to create an "A HREF" statement that will launch our program, this is quite simple.
- Insert the following code between your <BODY></BODY> tags. Remember, we are using Solitare as our example.
PHP:
<a onClick="exec('sol.vbs'); return false;" href="javascript:window.close()">Launch Solitare</a>
Please note: there is no space between "java" and "script:void(0)" in the actual code, for some odd reason vBulletin adds one. So make sure that you do NOT have a space when using this code.
The "exec('sol.vbs');" command is going to execute our ".VBS" file, which in turns launches our shortcut ("sol") which launches the program ("C:\WINDOWS\System32\sol.exe").
Let's take an expanded look at our new HTML file.
PHP:
<HTML>
<HEAD>
<TITLE>Active Desktop: Solitare Example</TITLE>
<SCRIPT>
function exec (command) {
if (document.layers && navigator.javaEnabled()) {
window._command = command;
window.oldOnError = window.onerror;
window.onerror = function (err) {
if (err.indexOf ("User didn't grant") != -1) {
alert('command execution of ' + window._command +
' disallowed by user.');
return true;
}
else return false;
}
netscape.security.PrivilegeManager.enablePrivilege
('UniversalExecAccess');
java.lang.Runtime.getRuntime().exec(command);
window.onerror = window.oldOnError;
}
else if (document.all) {
window.oldOnError = window.onerror;
window._command = command;
window.onerror = function (err) {
if (err.indexOf('utomation') != -1) {
alert('command execution of ' + window._command +
' disallowed by user.');
return true;
}
else return false;
};
var wsh = new ActiveXObject('WScript.Shell');
if (wsh)
wsh.Run(command);
window.onerror = window.oldOnError;
}
}
</SCRIPT>
</HEAD>
<BODY BGCOLOR="#FFFFFF">
<a onClick="exec('sol.vbs'); return false;" href="javascript:window.close()">Launch Solitare</a>
</BODY>
</HTML>
TIPS AND TRICKS TO MAKE PROGRAM LAUNCH WORK BETTER
Here are a few tweaks to make the above program launch work better and faster.
Please note that if you are running any antivirus program, such as Norton AntiVirus ("NAV"), you may encounter a "Malicious script detected" alert. The reason you will see this warning is because antivirus software, such as NAV, flags such files as a virus. You will receive this warning for each and every shortcut you setup. If you are running NAV, you can simply select "Authorize this script" from the drop down box and select "OK" and you will not be flagged again for this link.
This next tweak is a big one. You may notice an ActiveX warning. Well, let's get rid of that annoying warning. First we need to add the
"My Computer" security zone to your Internet Options: Security tab.
- Run regedit
- Navigate to: HKEY_CURRENT_USER, SOFTWARE, Microsoft, Windows, CurrentVersion, Internet, Settings, Zones, 0
- Set "FLAGS" dword value to 47
- Close regedit
- Launch Internet Explorer
- Select the "Tools" menu
- Select "Internet Options"
- Select the "Security" tab
You will notice that you have a "My Computer" security zone (if not, reboot and try relaunching Internet Explorer). Now configure your "My Computer" security zone.
- Highlight the "My Computer" zone icon
- Click "Custom Level"
- Under "ActiveX controls and plug-ins", change "Download signed ActiveX controls" to "Enable"
- Change "Download unsigned ActiveX controls" to "Enable"
- Change "Initialize and script ActiveX controls not marked as safe" to "Enable"
- Change "Run ActiveX controls and plug-ins" to "Enable"
- Chnage "Script ActiveX controls marked safe for scripting" to "Enable"
- Click "OK"
- Click "Apply"
- Click "OK"
After doing so, you will not receive any ActiveX control warnings for local files. Please note that making the above changes will not affect files located on the web (such as files on the xp-erience.org website). All websites on the Internet use the "Internet Security Zone", not the "My Computer Security Zone".
Now we are going to go over some shortcuts that you can create and add to your program launch. To create a shortcut, do the following.
- Run Explorer and go to "C:\WINDOWS"
- Right click
- Select the "New" menu
- Select "Shortcut"
- Then simply follow the wizard to create a new shortcut
Here are a few examples that you can add.
- SHUTDOWN: %windir%\system32\tsshutdn.exe 0 /DELAY:0 /POWERDOWN
- REBOOT: %windir%\System32\shutdown.exe -r -t 00
- LOCK PC: %windir%\System32\rundll32.exe user32.dll,LockWorkStation
- USER ACCOUNTS: %windir%\System32\control.exe userpasswords2
Now remember to create your ".VBS" file to match your shortcut.
_______________________
NOTEPAD
The next thing we are going to cover is the desktop notepad. You can either add this to your existing HTML file or you can create a new file. I recommend creating a new file unless you have the experience. I am pretty much going to do everything for you with the notepad, all you need to do is make it how you want it to look. Let's get started.
STEP ONE
- Create a blank ".TXT" file
- Save as "C:\WINDOWS\quicknotes.txt"
STEP TWO
Create a new HTML file (save it however you'd like it any directory) and paste the following code.
PHP:
<HTML>
<HEAD>
<TITLE>Active Desktop: Notepad</TITLE>
<SCRIPT LANGUAGE="VBSCRIPT">
<!--
Set fs = CreateObject("Scripting.FileSystemObject")
Const ForReading = 1, ForWriting = 2, ForAppending = 3
Sub setFile (filename)
Set a = fs.CreateTextFile(filename, true)
a.Write(Document.notes.qnotes.value)
a.Close
End Sub
Sub loadFile (filename)
if fs.FileExists(filename) then
Set a = fs.OpenTextFile(filename,ForReading)
Document.notes.qnotes.value = a.ReadAll()
a.Close
else
Document.notes.qnotes.value = "MADMATT_innovations"
end if
End Sub
-->
</SCRIPT>
</HEAD>
<BODY BGCOLOR="#FFFFFF" onLoad="loadFile('c:\\windows\\quicknotes.txt');">
<form name="notes">
<textarea name="qnotes" cols="29" rows="7" wrap="PHYSICAL"></textarea>
<a onClick="setFile('c:\\windows\\quicknotes.txt');" href="javascript:window.close();">Save</a>
</form>
</BODY>
</HTML>
SOME THINGS TO REMEMBER
It is important that you don't change the name of the FORM or TEXTAREA (i.e. name=""). If you change the name of these fields then the VBSCRIPT will not function, at all.
Something you can, and will probably want to change is the size of the textarea. Simply adjust the two numbers (cols="29" and rows="7") to the size you want. The first variable represents columns (width) and the second represents rows (height). Making the textarea 60 by 20 will make it appear larger.
Lastly, if you decide you would rather have an INPUT button instead of text for the save function, follow these two steps.
- REMOVE
Code:
<a onClick="setFile('c:\\windows\\quicknotes.txt');" href="javascript:void(0);">Save</a>
Code:
<input onClick="setFile('c:\\windows\\quicknotes.txt');" type="submit" value="Save">
_______________________
CALENDAR
I have taken the time to create a simple HTML/JavaScript calendar. At this time, this calendar has no fancy functions, but I may expand on that in the future. The calendar is a bit more in depth than the notepad was, and needs more attention. We are going to create two files, one HTML file and one javascript (".JS") file. Here we go.
STEP ONE
- Create a new HTML file
- Copy and paste the following code, then save the file to your hard drive
PHP:
<HTML>
<HEAD>
<TITLE>Active Desktop: Calendar</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF">
<SCRIPT SRC="calendar.js"></SCRIPT>
</BODY>
</HTML>
STEP TWO
- Download this file: calendar.js
- Save the above file in the same directory as you save the first HTML file
STEP THREE
Assuming that you will not be using the same color scheme as I am, there are three variables that you need to change within the "calendar.js" file.
Within "calendar.js" the colors for the table and font are preset, the changes you are going to make affect.
- BORDERCOLOR: the color of the border of the table
- TD BGCOLOR: the background color of the top row (where "month, year" appear)
- FONT COLOR: the color of the font in the top row
Follow these steps to make the changes with ease.
- Open the file in Notepad
- Press F3 once
- Input "#"
- Click "Find Next"
- Proceed to change the color to one that fits your tastes (for BORDERCOLOR)
- Press F3
- Make the same change (for TD BGCOLOR)
- You will need to do this two more times (one for FONT COLOR and one for BORDERCOLOR)
_______________________
RAPPING IT UP
Now obviously if you are attempting active desktop then you have some experience with HTML. It goes without saying that you can change any background color, font color, or add your own touch (such as font tags, center, etc.). I highly recommend that you do NOT attempt to make any changes to any of the above functions (such as the JavaScript and VBSCRIPT). You can also create one file with all the above functions, you just have to insert the functions correctly (JavaScript/VBSCRIPT into <HEAD>, etc.).
DISCLAIMER
By using the above JavaScript, VBSCRIPT, and HTML you agree NOT to hold Matt (a.k.a. “madmatt”) responsible for any problems that you might incur during the use of, or installation, of the above code. Matt has written, and thoroughly tested, the aforementioned code, but will not be held accountable for its failure.
Furthermore, Matt is not responsible for damage caused to software or hardware.
Do NOT contact Matt with questions concerning the code, how to use it, or how to make it work; he will not respond.
All questions can be posted to this thread.
THE FINAL WORD
This has been another madmatt_dtop innovation in conjunction with XP-erience.org (http://www.xp-erience.org).
All code copyright, madmatt usa, 2001-02 (www.madmatt.net). Site copyright, XP-erience.org, 2001-02.