# Solved: VBS Time



## Dre0745 (Jun 25, 2004)

Hi.
I am currently studying VBS so I am still a begginer at this.
We have not covered this in class yet, and do not think we will.
What I would like to know is:
1) How can I read the value of the time and date from my computer.
2) How can I have the program do something at an specified time (either hard coded or user specified).
3) How can I launch an external application when the time reaches the tiem set?

I would like to create a program that does something, in this case launches a browser at an specified time.

Any help with this would be much appreciated.
Thank you very much.

Dres0745


----------



## peterh40 (Apr 15, 2007)

1. Use the Now() function
2. and 3. Use the Scheduled Tasks feature in Windows to run programs as specific times, there is a Timer feature in VB but its only good for short periods of time between tasks.


----------



## Dre0745 (Jun 25, 2004)

Hi, thank you for the answer.
Is there anyway to integrate the schedule function into the software itself?
Or how can I call the scheduled tasks feature in windows from the program?
And last question, is there any way to constantly update the time with the Now() function, instead of just having it display the time when a button is pressed, how would you make it to update itself every second?
Thank you again for the reply.

Dre0745


----------



## DoubleHelix (Dec 10, 2004)

In order for the program to detect the time and run every second, it obviously has to be running all the time such as a service. You might want to look into other programming options for what you're trying to accomplish. Having a VBS script running constantly isn't too efficient.


----------



## Dre0745 (Jun 25, 2004)

Hi DoubleHelix, thanks for the answer.
It's too bad I can't accomplish what I wanted with VBs, which language would you recommend for the creation of this kind of software?
Also, do you know the code to call another application from the VBS application, such as a button that when you click it, it opens IE, or Opera, or another application?
Thank you.

Dre0745


----------



## peterh40 (Apr 15, 2007)

2xHelix is right, such a program will have to run as a loop and use up valuable cpu time or as a service.
To run another application from vbs, you can use the wshell.run "command"


----------



## Dre0745 (Jun 25, 2004)

Thank you for your replies.
Thanks peterh40 and DoubleHelix for clarifying my questions.


----------

