VBScripting: Make a Program Starter
Table of content
- A brief introduction
- Getting started
- Starting a new project
- Coding
- Debugging
- Saving and using your project
- Afterword
Additional:
- Date and time
- Shortcuts to websites
- Stopwatch
A brief introduction
You may be wondering: What is a Program Starter? Well, it's basically a window that gives you a clear overview of your selection of programs that you use frequently. Here's an example:
Getting started
You will need Visual Basic, but don't worry! You can download it free and legally. Go to this link and follow the instructions below.
Visual Basic 2010 Express → Select desired language and the download should automatically start.
The download may take some time, perhaps you can read the guide while you are waiting?
Starting a new project
When the file is downloaded, simply open it and follow the instructions to start a new project.
New Project' → Windows Form Application → Ok
To make things easier, I suggest you pin the toolbox.
Let's start by renaming your project.
Right mousebutton 'Form1.vb' → Properties → File name and change it into ProgramStarter.vb or something like that. (Don't change the extension!)
Done that? Alright, now we can start for real. Look for 'Groupbox' in the Toolbox and drag it to your form. (Make sure it's big enough for 2 smaller buttons.) When you added the Groupbox, select 'Button' in the Toolbox and add 2 of them.
To rename the Groupbox or the Buttons:
Click on it once → Change 'Text' into the program it represents (MSN, f.e.)
Note: Do not change the 'name', change the 'text'!
Coding
Okay, now we have the button, but it doesn't link to MSN (or the program you chose) yet.
Right mousebutton → View code or just double click the button will take you to the code window. Okay, now don't move the cursor! and type:
Code:
Shell()
Okay, now read every word very carefully, because even though it may seem simple, this is in my opinion the hardest part. Find your version of MSN and click right mousebutton → Properties → Shortcut and NOT Location (The location will most likely link to some place in the Start Menu and your button will not work!)
It should start with C: and end with .exe.
Example:
Code:
"C:\Program Files\Windows Live\Messenger\msnmsgr.exe"
Now place the location between the (). Your result should look like this:
Code:
Shell("C:\Program Files\Windows Live\Messenger\msnmsgr.exe")
Debugging
The next step is debugging/testing your code. This is done by clicking the green 'Play' button OR simply F5.
Note: If you get an error message, I suggest you check your code. If you really don't manage to figure where you went wrong, just drop me a PM and I'll try to help you out!
Saving and using your project
When you added all the programs you want a shortcut to, save the project and don't change the location.
Now open the map 'Visual Studio 2010' and open your project. Then follow the instructions below.
Program Starter → bin → Debug
Copy the .exe file you find there, and paste it on your desktop. You now have a shortcut to your Program Starter!
Date and time
Drag a Statusstrip and a Timer from the Toolbox to your form. These will appear under your form.
Click on the StatusStrip, go to Properties and change SizingGrip to false.
Add 2 StatusStripLabels, this is done by clicking on the icon I marked red. Remove the text from the StatusStripLabels, they will disappear, but disregard that.
It should look like this:
Now you have to change some of the Timer settings: Go to Properties and change Enabled to True and Interval to 1000.
It should look like this:
Double click on your Timer now, don't move your cursor and add the following code:
Code:
ToolStripStatusLabel1.Text = TimeString
ToolStripStatusLabel2.Text = DateString
Debug (F5), and it should look like this:
Shortcuts to websites
If you want to add websites to your Starter, here's what you gotta do:
You will need a Button and a Listbox. To add your desired websites, click right mousebutton → Edit items.
Then double click on the Button (once again, don't move the cursor!) and add the following code:
Code:
Dim webAddress As String = ListBox1.Text
Process.Start(webAddress)
Debug (F5), select one of the sites and click the button.
Stopwatch
To find out how long you've been playing a game, surfing a site or watching a movie, you can add a 'Stopwatch' function to your Starter. It's a rather hard addition so stay attentive!
First of all, you will need to add a new form. (Project → Add Windows form)
Done that? Navigate back to the first form, and create a button with the name 'Stopwatch'.
Double click on the button and add the following code:
Code:
Form2.show()
Back to the 2nd form now, add 3 buttons and 5 labels, and place them like I did in the picture below.
Now give the labels the following text:
Label1 0
Label2 00
Label3 00
Label4 :
Label5 :
Make sure it looks neat; 0 : 00 : 00
When you've done that, add text to the buttons.
Button1 Start
Button2 Stop
Button3 Reset
Finally, add a Timer as well.
The next step is coding all these buttons and the timer.
Start Button
Code:
Timer1.Start()
Stop Button
Code:
Timer1.Stop()
Reset Button
Code:
Timer1.Stop()
Label1.Text = "0"
Label2.Text = "00"
Label3.Text = "00"
Timer
Code:
Timer1.Interval = 10 Label3.Text += 1 If Label3.Text = "100" Then Label2.Text += 1 Label3.Text = "0" End If If Label2.Text = "60" Then Label1.Text += 1 Label2.Text = "0" End If
Afterword
First of all, thanks for reading my guide! I really hope it helped you to understand VBA better than before. As always, I would like to know how to improve. So please, if you read the guide leave some honest feedback. If you have any questions regarding this guide, please PM me. Thanks!



