A Simple Startup Manager

All executables (mostly shortcuts) residing in the Windows startup folder(s) run automatically when you logon to Windows. This works fine except that you cannot control the order in which these programs are loaded. Neither can you include conditional startups.

There are numerous programs for managing the startup process but you can do this yourself, at no cost, in a very simple way by means of a Windows script. This lets you perfectly control the order in which the programs are loaded as the script simply executes in sequence each line at a time. With Visual Basic it is also a cinch to perform conditional loading of one or several programs. Besides loading programs you can also do other stuff like emptying Windows' temporary folder for instance.

An Example:

This is an excerpt of a script file 'Scripts.vbs' residing in my Windows Startup folder. So it is executed each time I logon to Windows.

Option Explicit
Const TemporaryFolder = 2
Dim Fso, LastLogon, S
Set S = CreateObject("WScript.Shell")
S.Run "C:\Internet\Programs\Netscape\Program\NsNotify.exe"
If MsgBox("Run Calculator?",vbYesNo) = vbYes Then
    S.Run "Calc"
    WScript.Sleep 500   ' Wait 500 milliseconds
    S.SendKeys "%vt"    ' "%vs" if you want scientific mode
End If
On Error Resume Next
LastLogon = S.RegRead("HKCU\LastLogon")
If LastLogon <> CStr(Date) Then
    S.RegWrite "HKCU\LastLogon",Date
    S.Run "C:\Internet\Programs\AtomicTime.exe"
End If
Set Fso = CreateObject("Scripting.FileSystemObject")
Fso.DeleteFile Fso.GetSpecialFolder(TemporaryFolder) & "\*.*",True
What does it do?

Option Explicit: Forces explicit declaration of all variables in the script: Dim Fso, LastLogon, S.

Set S = CreateObject("WScript.Shell"): creates a shell object.

S.Run "C:\Internet\Programs\Netscape\Program\NsNotify.exe": loads Netscape's mail notification program.

Then a message box asks if you want to run Calculator. If you click Yes, the program is loaded and the script waits for 500 milliseconds to make sure the Calculator window is displayed before issuing the SendKeys command which presses consecutively alt (%), [V] and [T] corresponding to the menu command 'View | Standard'.

The next six lines will load the AtomicTime program to adjust your internal clock with an Internet timeserver. I want this to be done only once a day, at the first logon.

On Error Resume Next: From now on the script will continue with the next line when an error occurs, ignoring the line causing the error.

LastLogon = S.RegRead("HKCU\LastLogon"): Reads the date from the 'LastLogon' value in the Windows registry. If the value entry doesn't exist yet an error occurs and the script will continue with the next line. In this case the LastLogon variable contains an empty string.

If LastLogon <> CStr(Date) Then: tests to see whether it is the first time you logon to Windows that day. If the date in LastLogon is not the same as 'Date' (today's date), the condition is True and the two following lines are executed (if false, they are skipped).

S.RegWrite "HKCU\LastLogon",Date: registers today's date in the registry's 'LastLogon' value. So by consecutive logons that day, this line and the next will not be executed.

S.Run "C:\Internet\Programs\AtomicTime.exe": runs AtomicTime.

Set Fso = CreateObject("Scripting.FileSystemObject"): creates the file system object.

Fso.DeleteFile Fso.GetSpecialFolder(TemporaryFolder) & "\*.*",True: deletes all files in the Windows temporary folder, keeping it clean. The 'On Error Resume Next' will also prevent the script to crash here in case of an 'access denied'.

What's next:

You can make your own script by adapting this example to your needs or start from scratch if you have some experience with Visual Basic (Scripting). If something is not clear to you, don't hesitate to e-mail me. I'll be glad to help if I can.