InStr in Tosca
Option Explicit
'
' ****************************************************************** '
Sub Main(testAction)
Dim oParamAction 'As Engine.clsParamAction
Dim oValue1
Dim oValue2
Dim oStart 'As Engine.clsParamAction
Dim sValue1 'As String
Dim sValue2
Dim sStart
Dim sBuffer 'As String
dim sAction 'As String
'get Buffername
Set oParamAction =
testAction.ParamAction("Buffer")
If oParamAction Is Nothing
Then
oExecLib.raiseException
objServer.GetExceptionString(1), "Please set the action mode of attribute
'Buffer' to 'Input'!"
Exit Sub
End If
sBuffer =
oParamAction.inputView.value
If (Trim(sBuffer) =
"") Then
oExecLib.raiseException
objServer.GetExceptionString(1), "Please specify a buffer!"
Exit Sub
End If
'get Value
Set oValue1 =
testAction.ParamAction("Value1")
Set oValue2 =
testAction.ParamAction("Value2")
Set oStart =
testAction.ParamAction("Start")
If (oValue1 Is Nothing) Then
oExecLib.raiseException
objServer.GetExceptionString(1), _
"Please set
action mode of attribute 'Value' to 'Input' or 'Verify'"
Exit Sub
End If
sAction = oValue1.Action
sValue1 =
oValue1.InputView.Value
sValue2 =
oValue2.InputView.Value
sStart =
oStart.InputView.Value
Select Case LCase(sAction)
Case "input",
"buffer"
testAction.AddArbitraryLogToDoku "Set value >" &
sValue1 & "< to buffer >" & sBuffer &
"<."
oBuffer.SetValue
sBuffer, InStr(CInt(sStart),sValue1,sValue2)
Case "verify"
testAction.AddArbitraryLogToDoku "Verify buffer >" &
sBuffer & "<."
oValue.actValue =
oBuffer.GetValue(InStr(CInt(sStart),sValue1,sValue2))
oValue.verify
Case Else
oExecLib.raiseException objServer.GetExceptionString(1), _
"ActionMode
>" & sAction & "< is not supported!"
End Select
Set oParamAction = Nothing
Set oValue1 = Nothing
Set oValue2 = Nothing
Set oStart = Nothing
End Sub
Steps to be followed:
1.
Save above code as TCInStrBuffer.vbs
2.
Attach this file to module
3.
Goto properties of TC InStr Buffer Module
4.
Provide the Word as same name of vbs file which
attached to this module
Result in
FILEèSettingsèEngineè
No comments:
Post a Comment