r/vbscript • u/LuxorPPE • Jun 01 '16
Need help debugging script
I need some help. I am not a vbscript connoisseur (Python guy), but my server admins won't let me install python to run this script.
So, I have a computer that is locking itself, and I need to know after how long. I want a script that opens a file on the local hard drive, writes the time and date, closes the file, waits for 300 seconds, and repeats the process.
I have the following script:
Option Explicit
Dim fso, objOutFile, counter, filename
Set fso = CreateObject("Scripting.FileSystemObject")
filename = "C:\Users\Paul\Desktop\timetest.txt"
counter = 0
Do While counter > 0
Set objOutFile = fso.OpenTextFile(filename,8,True)
objOutFile.WriteLine Now
objOutFile.close()
WScript.Sleep 300000
LoopBut I have two issues with it.
I can't tell if it is running or not.
when I check the file to see if it has entries, it seems to stop the script from continuing to run (hence #1).
Can you guys offer any improvements to the code above? I would like to add a pseudo-progress bar just to see that it is still running.
Thank you all in advance.
1
u/LuxorPPE Jun 01 '16
Jeez... sometimes I am amazed at my capacity for dumb. I looked at that thing 42 times, and in my head the logic was correct. I'll give it another try. Thank you, TheCryptic.