Friday, February 19, 2016

StrReverse In Tosca

Option Explicit
' ****************************************************************** '
Sub Main(testAction)
    Dim oParamAction    'As Engine.clsParamAction
    Dim oValue          'As Engine.clsParamAction
    Dim sValue          'As String
    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 oValue = testAction.ParamAction("Value")
   
    If (oValue Is Nothing) Then
        oExecLib.raiseException objServer.GetExceptionString(1), _
            "Please set action mode of attribute 'Value' to 'Input' or 'Verify'"
        Exit Sub
    End If
   
    sAction = oValue.Action
    sValue = oValue.InputView.Value
   
    Select Case LCase(sAction)
        Case "input", "buffer"
            testAction.AddArbitraryLogToDoku "Set value >" & sValue & "< to buffer >" & sBuffer & "<."

            oBuffer.SetValue sBuffer, StrReverse(sValue)
        Case "verify"
            testAction.AddArbitraryLogToDoku "Verify buffer >" & sBuffer & "<."
            oValue.actValue = oBuffer.GetValue(StrReverse(sBuffer))
            oValue.verify
        Case Else
            oExecLib.raiseException objServer.GetExceptionString(1), _
                "ActionMode >" & sAction & "< is not supported!"
    End Select

    Set oParamAction = Nothing
    Set oValue = Nothing


End Sub
Steps to be followed:
1.       Save above code as TCReverseBuffer.vbs
2.       Attach this file to module
3.       Goto properties of TC Reverse Buffer Module
4.       Provide the Word as same name of vbs file which attached to this module



No comments:

Post a Comment