VB Code:
'My Execute function
Public Function Execute(theFunction As String) As Boolean
On Error GoTo Err
'returns true if no errors, false if not..
Dim currPos As Long 'the current position in this function
Select Case Language
Case VB:
Dim VBfunc_pos As Long 'position of "Function " & theFunction
Dim VBFuncArgStartPos As Long 'lol, the opening parenthesis (
Dim VBFuncArgEndPos As Long 'the closing parenthesis )
VBfunc_pos = InStr(VBfunc_pos + 1, theScript, "Sub " & theFunction, vbTextCompare)
VBFuncArgsStartPos = InStr(VBfunc_pos + 1, theScript, "(", vbTextCompare)
VBFuncArgsEndPos = InStr(VBFuncArgsStartPos + 1, theScript, ")", vbTextCompare)
currFunction = Mid$(theScript, vbfuncpos + 7, VBFuncArgsStartPos - (VBfunc_pos + 4))
currPos = VBFuncArgsEndPos
Do Until (currPos > InStr(VBFuncArgsEndPos, theScript, "End Sub", vbTextCompare))
'loop through and find keywords..
If (UCase$(Mid$(theScript, currPos, 2) = "If")) Then
ElseIf (UCase$(Mid$(theScript, currPos, 6) = "End If")) Then
ElseIf (UCase$(Mid$(theScript, currPos, 3) = "For")) Then
ElseIf (UCase$(Mid$(theScript, currPos, 4) = "Next")) Then
ElseIf (UCase$(Mid$(theScript, currPos, 6) = "MsgBox")) Then
MsgBox "BLA", , "MsgBox Call"
ElseIf (UCase$(Mid$(theScript, currPos, 4) = "Call")) Then
'find the function name and execute it..
'Execute Mid$(theScript, currPos + 5, (InStr(currPos + 1, theScript, vbCrLf, vbTextCompare) - 2 - (currPos + 5)))
Execute Mid$(theScript, currPos + 5, (InStr(currPos + 1, theScript, vbCrLf, vbTextCompare)) - (currPos + 5))
End If
currPos = currPos + 1
Loop
'MsgBox Chr(34) & currFunction & Chr(34)
Case JS:
End Select
Err:
Exit Function
End Function
..that works with a script like this: