Topic Options
#995 - 11/21/03 02:44 PM WCScript + VBScript = Solution!
Luke Tomasello Administrator Offline
Member

Registered: 09/17/00
Posts: 740
Loc: San Jose, CA., USA
WinCron Script (WCScript) + VBScript gives you everything you need to create very powerful scripts.
Let’s try a simple script to demonstrate the basics:

Code:
## test VBScript - basic call
# this simple script just calls a VBScript function that prints "WinCron Rocks" in a loop.
# The script then calls the WinCron-defined, VB function Print() to print some status info
{
	-name test VBScript
	-start 
	-stop

	# call a VBScript Function (can't call Subs directly)
	main("WinCron Rocks")	

	# print the return value from the VBScript function
	Print("Returned value is: '%TG.COMMAND_RETURN%'")

	# call one of the internal, WinCron-defined, VB functions
	# (there are a bunch of these internal functions, documentation to come)
	# Hey look! The usual WinCron macros still expand inline!
	Print("Done! at %c%")
}

'' Entering the VBScript domain!
' Notice how comments are now VBScript style?
Option Explicit		' Force declarations for variables

Function main(args)

	' simple loop to print the passed in string. 
	' we also prints a counter and another built-in WinCron macro!
	Dim jx
	For jx = 1 To 1024
		WCCtrl.Print jx & " " + args + " !!%#W%"
	Next
	
	' return whatever you want. We've decided to return the current time
	main = time
	
End Function  
_________________________
Regards,
Luke Tomasello

Top
#996 - 11/21/03 02:51 PM Re: WCScript + VBScript = Solution!
Luke Tomasello Administrator Offline
Member

Registered: 09/17/00
Posts: 740
Loc: San Jose, CA., USA
Real programmers don't use comments!
Just kidding!
But here is the above program without comments so you can see the real harmony between the two scripts:

Code:
{
	-name test VBScript
	-start 
	-stop

	
	main("WinCron Rocks")	

	Print("Returned value is: '%TG.COMMAND_RETURN%'")

	Print("Done! at %c%")
}
	
Option Explicit	
Function main(args)


	Dim jx
	For jx = 1 To 1024
		WCCtrl.Print jx & " " + args + " !!%#W%"
	Next
	
	main = time
End Function  
_________________________
Regards,
Luke Tomasello

Top


Moderator:  Luke Tomasello