i am facing a vb script run time error saying "wrong number of arguments or invalid property assignment". 'useunit sub in unita call unita.testsub(param1,param2) end sub
'sub in unitb sub testsub(param1,param2) ..... end sub
After USEUNIT you need to specify the name of the unit whose functions you will use in this unit. So, change your code in the following way:
unita
'USEUNIT unitb
sub main
dim param1
dim param2
param1="Test"
param2="Complete"
call unitb.testsub(param1,param2)
end sub
unitb
sub testsub(param1,param2)
Log.Message(param1 & param2)
end sub
I believe that
call unita.testsub(param1,param2)
should be
call unitb.testsub(param1,param2)
i found this from the oficial forums Execute "Call UnitName.SubWithParams(1, ""string"", True)" ' Using syntax with the Call keyword and parentheses
Execute "UnitName.SubWithParams 1, ""string"", True" ' Syntax without the Call keyword and parentheses
res = Eval("UnitName.FunctionWithParams(1, ""string"", True)")
' Inserting parameter values dynamically
strFunctionCall = aqString.Format("UnitName.FunctionWithParams(%d, ""%s"", %s)", 42, "string", CStr(True))
res = Eval(strFunctionCall)
but still donot know how exactly should we pass the parameters
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.