Advertisement
Guest User

SetTime.vbs - use with Timer.vbs

a guest
Sep 20th, 2010
684
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Option Explicit
  2.  
  3. Dim objFSO, objShell, objTextFile
  4.  
  5. Const strDirectory = "C:"
  6. Const strFile = "\timelog.txt"
  7. Const checkTimeLeftVbs = "C:\checktimeleft.vbs"
  8. Const ForAppending = 8
  9. Const ForReading = 1
  10. Const ForWriting = 2
  11.  
  12. Set objFSO = CreateObject("Scripting.FileSystemObject")
  13. Set objShell = WScript.CreateObject ("WScript.Shell")
  14.  
  15. Dim newTime
  16.  
  17. Function openLogFile(N)
  18. Set objTextFile = objFSO.OpenTextFile(strDirectory & strFile, N, True)
  19. End Function
  20.  
  21. Function extendTime(T)
  22. Call openLogFile(ForWriting)
  23. objTextFile.WriteLine(Date)
  24. objTextFile.WriteLine("0")
  25. objTextFile.WriteLine(T)
  26. objTextFile.Close
  27. End Function
  28.  
  29. Function verifyID()
  30. If InputBox("Enter password.","Password Required") = "changethis" Then verifyID = True
  31. End Function
  32.  
  33. If verifyID() = True then
  34.     newTime = InputBox("Enter the amount of time in minutes." & vbcrlf & "This will override the current time remaining for the day and previous time extensions.","Set Usage Time")
  35.     extendTime newTime
  36.     objShell.Run checkTimeLeftVbs
  37. Else
  38.     Msgbox "Authentication failure.", vbCritical
  39. End If
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement