Jump to content
EduGeek EdSec 2026 is Go! 27th Oct in Derby! Join us for a day of EdTech security focused talks, networking, and an evening social ×

Code to call a sub routine at a certain time.


Recommended Posts

Posted

Hi

 

I would like some VBS code that will call a subroutine at 13:30 if anyone could help that will be good.

 

Thanks.

 

Z

Posted

This looks like kind of what you want:

scripting vbscript For fun: a VBS alarm clock

 

SetAlarm.vbs  
 
Set ws = WScript.CreateObject("WScript.Shell")  
 
Set fso = CreateObject("Scripting.FileSystemObject")  
 
when = InputBox("When do you want to wake up?")  
 
'needs to be in military time! e.g. 14:15 for 2:15 PM  
 
Set f = fso.OpenTextFile("C:\AlarmFlag.txt",2,true)  
 
f.Write "On"  
 
f.close  
 
ws.Run("at " & when & " ""C:\Alarm.vbs""")  

 

it schedules a separate vbs file to be run at a time specified but you could probably either break up your code into multiple files or use command line arguments to specify which bit of code you want it to run when triggered.

  • Thanks 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...