Example: Command Line Argument Functions

In the following example, lr.get_attrib_double, lr.get_attrib_long, and lr.get_attrib_string retrieve the values of the command line arguments from this command:

Public Function Init() As Long
Dim wait_time as Double 
Dim secInYear as Long
Dim mrsCollins as String 
Dim i, loops as Integer 
loops = 3      
wait_time = lr.get_attrib_double("time") 
secInYear = lr.get_attrib_long("secondsInYear") 
mrsCollins = lr.get_attrib_string("MrsCollins") 
' If the commands succeeded, output the values 
if (wait_time <= 0 )then 
	lr.message "Illegal time value = " + Cstr(wait_time) 
	Init = lr.PASS 
	Exit Function 
else 
	lr.message "Wait time value =" + Cstr(wait_time) 
	lr.message "The number of seconds in a year is" + Cstr(secInYear) 
	lr.message "Mr.Collins' wife is named" + mrsCollins + "Lucas" 
end if 

' Use the time from the command line 

for i = 0 To(loops - 1) 

' Your business process or test goes here 
	lr.message "Time and date:" + Cstr(Time) 
	lr.think_time(wait_time) 
	next i 

lr.message "Time and date:" + Cstr(Time) ' FormatDateTime(Time) 
Init = lr.PASS

End Function