Wednesday, 28 December 2016

VBS serving an alarm

Dim Input

Input = InputBox("Enter Time in same format as Current Time : "& left(time(),5),"Alarm") 

If len(Input)=5 and instr(Input,":")>1 then 
Set oShell = WScript.CreateObject ("WScript.Shell")

reqTime = left(time(),5)

msgbox "Alarm set for "&left(Input,2)-left(reqTime,2)&" hours and "&right(Input,2)-right(reqTime,2)&" minutes"

Do

If left(time(),5)=Input  then
oShell.run "calc.exe"
Exit Do
End if

Loop

Set oShell = Nothing
Else
msgbox "Wrong format: try again !!"

End If