iamareplicant
Programmer
I am new to vbscript.
I have some test scripts set up that look like this (the parent instantiates several class objects from a child script, one of which is a timer):
(PARENT SCRIPT .wsf file)
(CHILD SCRIPT Clasess.vbs)
When the code NewTimer.RunTimer is run, the timer should run for 60 seconds, which I would think would mean that the next 2 lines in the parent would NOT get executed for 60 seconds.
Again, I am new to vbscript. The parent is a .wsf file, and when I exectute the parent, the entire script runs instantly (and I know that objAcc.f_DoAdbTest runs correctly becuase that line of code runs an Access macro in that creates a temp table in an Access db).
So, my issue is this: I want to be able to create a rather involved parent that uses a number of classes, and those class's methods. But each method called needs to finish before going on to the next line of code in the parent. This is why I set up a timer to see if this is true.
But it appears not to be.
Can one of you experts shed some light on calling another script for a parent, and how the parent (.wsf) file handles the calls/objects to those child scripts? Does/should the parent call or instantiantion of a child's method execute before the next line of parent code is run?
Thanks in advance for any insight into this.
Jeff
I have some test scripts set up that look like this (the parent instantiates several class objects from a child script, one of which is a timer):
(PARENT SCRIPT .wsf file)
Code:
<job id="Job1">
<script language="VBScript" src="C:\WINNT\Profiles\jgoodma1\Desktop\Classes.vbs"/>
<script language="VBScript">
option explicit
Dim NewTimer
dim objAcc
set NewTimer = New UniversalTimer
NewTimer.Interval = 60
NewTimer.RunTimer
set objAcc = New RunAccessMacro
objAcc.f_DoAdbTest
set objAcc = nothing
</script>
</job>
(CHILD SCRIPT Clasess.vbs)
Code:
Class UniversalTimer
Public Property Let Interval(nValue)
nValue = Interval
End Property
Public Property Get Interval()
Interval = nValue
End Property
Public Sub RunTimer
Dim lngStart
lngStart = Timer()
intPause = Interval
Do While Timer() < lngStart + intPause
loop
End Sub
End Class
Class RunAccessMacro
public sub f_DoAdbTest()
dim objAccess
set objAccess = CreateObject("Access.Application")
objAccess.OpenCurrentDatabase ("C:\WINNT\Profiles\jgoodma1\Desktop\Utility.mdb")
objAccess.docmd.RunMacro "macTest"
set objAccess=nothing
end sub
End Class
When the code NewTimer.RunTimer is run, the timer should run for 60 seconds, which I would think would mean that the next 2 lines in the parent would NOT get executed for 60 seconds.
Again, I am new to vbscript. The parent is a .wsf file, and when I exectute the parent, the entire script runs instantly (and I know that objAcc.f_DoAdbTest runs correctly becuase that line of code runs an Access macro in that creates a temp table in an Access db).
So, my issue is this: I want to be able to create a rather involved parent that uses a number of classes, and those class's methods. But each method called needs to finish before going on to the next line of code in the parent. This is why I set up a timer to see if this is true.
But it appears not to be.
Can one of you experts shed some light on calling another script for a parent, and how the parent (.wsf) file handles the calls/objects to those child scripts? Does/should the parent call or instantiantion of a child's method execute before the next line of parent code is run?
Thanks in advance for any insight into this.
Jeff