VBScripting For Dummies: Make a basic program starter!

Discussion in 'Archives' started by Nyx, Jan 11, 2011.

VBScripting For Dummies: Make a basic program starter!
  1. Unread #1 - Jan 11, 2011 at 10:49 AM
  2. Nyx
    Joined:
    Dec 17, 2010
    Posts:
    480
    Referrals:
    0
    Sythe Gold:
    0

    Nyx SMR likes me a lot
    Banned

    VBScripting For Dummies: Make a basic program starter!

    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.

    [​IMG]

    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

    [​IMG]

    To make things easier, I suggest you pin the toolbox.

    [​IMG]

    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!)

    [​IMG]

    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.)

    [​IMG]

    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"
    Note: Chances are that your MSN is located somewhere else and in that case, the code won't work for you. I strongly suggest you copy the code yourself.

    Now place the location between the (). Your result should look like this:

    Code:
    Shell("C:\Program Files\Windows Live\Messenger\msnmsgr.exe")
    Note: Don't forget to place the location between ""!

    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.

    [​IMG]

    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.

    [​IMG]

    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:

    [​IMG]

    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:

    [​IMG]

    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:

    [​IMG]

    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.

    [​IMG]

    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.

    [​IMG]

    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!
     
  3. Unread #2 - Jan 17, 2011 at 10:20 AM
  4. Nyx
    Joined:
    Dec 17, 2010
    Posts:
    480
    Referrals:
    0
    Sythe Gold:
    0

    Nyx SMR likes me a lot
    Banned

    VBScripting For Dummies: Make a basic program starter!

    Anyone at all? :)
     
  5. Unread #3 - Jan 17, 2011 at 10:27 AM
  6. NextSoulreaper
    Joined:
    Jun 1, 2010
    Posts:
    865
    Referrals:
    2
    Sythe Gold:
    0

    NextSoulreaper Apprentice
    Do Not Trade

    VBScripting For Dummies: Make a basic program starter!

    Wow thanks man! this actually blew me away, cause I have always wanted to get into programming, 10/10!
     
  7. Unread #4 - Jan 18, 2011 at 7:07 AM
  8. Nyx
    Joined:
    Dec 17, 2010
    Posts:
    480
    Referrals:
    0
    Sythe Gold:
    0

    Nyx SMR likes me a lot
    Banned

    VBScripting For Dummies: Make a basic program starter!

    Glad you liked it!
     
  9. Unread #5 - Jan 28, 2011 at 1:00 PM
  10. iLikePaper
    Joined:
    Jan 22, 2010
    Posts:
    702
    Referrals:
    0
    Sythe Gold:
    0

    iLikePaper I heard you liek "paper"?
    Do Not Trade

    VBScripting For Dummies: Make a basic program starter!

    Thanks, looks like your good at programming.

    I only know PHP for now, just find VB so complicated. :p

    Looking forward to more of your guides, especially VB ones. :)
     
  11. Unread #6 - Jan 28, 2011 at 11:22 PM
  12. Nyx
    Joined:
    Dec 17, 2010
    Posts:
    480
    Referrals:
    0
    Sythe Gold:
    0

    Nyx SMR likes me a lot
    Banned

    VBScripting For Dummies: Make a basic program starter!

    Hey man, you should really get into VB, it isn't that hard at all :p. Anyway, glad you enjoyed the guide.
     
  13. Unread #7 - Feb 19, 2011 at 9:26 PM
  14. zxc10
    Joined:
    May 25, 2010
    Posts:
    123
    Referrals:
    0
    Sythe Gold:
    0

    zxc10 Active Member
    Banned

    VBScripting For Dummies: Make a basic program starter!

    great guide, thanks my mate
     
  15. Unread #8 - Mar 4, 2011 at 1:03 PM
  16. fbitom
    Joined:
    Feb 23, 2011
    Posts:
    204
    Referrals:
    0
    Sythe Gold:
    0

    fbitom Active Member

    VBScripting For Dummies: Make a basic program starter!

    very interesting guide, looking into it was more than appealing ! :D
     
< Complete Guide On Viruses | RAM And Upgrading It >

Users viewing this thread
1 guest


 
 
Adblock breaks this site