Help with VBScript Timer
- From: Huskerboy <Huskerboy@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 28 Aug 2008 08:13:01 -0700
I need to write a script that will time the download and upload of different
size files or folders to a NAS.
I am trying to put together data on upload and download times from different
loactions.
Here is what I have so far. It download the file but never finishes the timer.
Is there an easy way to do this.
Thanks in Advance
Dim WshShell,fso
Dim LOGFILENAME
Dim cnt
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Const FILELOGPATH =
"c:\commonlog\applications\consolidated\download_timer.log"
Const ERRORLOGPATH =
"C:\commonlog\applications\consolidated\download_timer_error.log"
'-----------------------------
'CREATE OBJECTS FOR LATER USE
'-----------------------------
Set WshShell = WScript.CreateObject("WScript.Shell")
Set fso = CreateObject("Scripting.FileSystemObject")
Set evar = wshshell.environment("Process")
Set WshNet = WScript.CreateObject("WScript.Network")
'To keep script from failing on error
'On Error Resume Next
'---------------------------
'Main
'---------------------------
Dim conn,conStr,conSoft,strSQL,rs,StartTime,c
'Open error log
Set ErrorLog = fso.OpenTextFile(ERRORLOGPATH,ForAppending,True)
StartTime = Timer
'------------------------
fso.CopyFolder "\\<servername>\<sharename>\<folder>", "c:\temp\"
'------------------------
If Err <>0 Then
msg = "An error occurred while trying to create the recordset:" & Err &
vbCrLf 'Create an understandable error msg
msg = msg & "Error number: " & Err & vbCrLf
msg = msg & "Description: " & Err.Description
Wscript.Echo msg
WshShell.Popup msg,3, "Error Pulling Records!",64
ErrorLog.writeline "<ScriptName>: " & Err.Description & " " & Now() & " "
& FormatNumber(Timer - StartTime,2)
Else
wscript.echo "Recordset created successfully."
ErrorLog.writeline "<ScriptName>: Completed Successfully " & Now() & " " &
FormatNumber(Timer - StartTime,2)
End If
.
- Follow-Ups:
- Re: Help with VBScript Timer
- From: Richard Mueller [MVP]
- Re: Help with VBScript Timer
- Prev by Date: Re: Connect to DB
- Next by Date: Re: Help with VBScript Timer
- Previous by thread: Re: Connect to DB
- Next by thread: Re: Help with VBScript Timer
- Index(es):
Relevant Pages
|