home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 1_2002.ISO / Data / Zips / Scripting 2882110132001.psc / clsSEX_Script.cls < prev    next >
Encoding:
Visual Basic class definition  |  2001-10-11  |  3.4 KB  |  117 lines

  1. VERSION 1.0 CLASS
  2. BEGIN
  3.   MultiUse = -1  'True
  4.   Persistable = 0  'NotPersistable
  5.   DataBindingBehavior = 0  'vbNone
  6.   DataSourceBehavior  = 0  'vbNone
  7.   MTSTransactionMode  = 0  'NotAnMTSObject
  8. END
  9. Attribute VB_Name = "clsSSE_Script"
  10. Attribute VB_GlobalNameSpace = False
  11. Attribute VB_Creatable = True
  12. Attribute VB_PredeclaredId = False
  13. Attribute VB_Exposed = False
  14. Private alias()         As clsSSE_Alias
  15. Private alias_count     As Integer
  16. Public parent   As clsSSE_Main
  17.  
  18. Public returnVal As String
  19. Public bExecuted As Boolean
  20. Private Sub ClearScript()
  21.     ReDim Functions(1 To 1) As clsSSE_Alias
  22. End Sub
  23.  
  24.  
  25. Public Sub dev_evalaliases()
  26.     Dim i As Integer
  27.    
  28.     For i = 1 To alias_count
  29.         
  30.         alias(i).dev_evalaliasx
  31.         
  32.     Next i
  33. End Sub
  34.  
  35. Public Function ExecuteAlias(strName As String, Params()) As String
  36.     Dim i As Integer
  37.     
  38.     For i = 1 To alias_count
  39.         If alias(i).GetName = strName Then
  40.             Dim tempAlias As New clsSSE_Alias
  41.             alias(i).CopyAlias alias(i), tempAlias
  42.             'ExecuteAlias = alias(i).Execute(Params)
  43.             ExecuteAlias = tempAlias.Execute(Params)
  44.             bExecuted = True
  45.             returnVal = ""
  46.             Exit Function
  47.         End If
  48.     Next i
  49.     bExecuted = False
  50. End Function
  51.  
  52.  
  53. Public Sub LoadScript(strFileName As String, parent As clsSSE_Main)
  54.     '* If file doesnt exist, exit
  55.     If FileExists(strFileName) = False Then
  56.         '* ...? echo...
  57.         Exit Sub
  58.     End If
  59.     
  60.     '* Variable declarations
  61.     Dim FF As Integer, strLine As String, lineCount As Integer
  62.     Dim inAlias As Boolean, strAlias() As String
  63.     
  64.     On Error GoTo error_handler
  65.     FF = FreeFile
  66.     Open strFileName For Input As #FF
  67.         Do
  68.             Line Input #FF, strLine
  69.             strLine = TrimLeft(strLine)
  70.         
  71.             If strLine = "" Then GoTo ignoreline
  72.             '* Now lets check the line for an alias or event tag
  73.             'strLine = TrimLeft(LCase(strLine))
  74.             'strLine = LCase(strLine)
  75.             If strLine Like "alias *" Or strLine Like "event *" Then
  76.                 If inAlias Then
  77.                 Else
  78.                     inAlias = True
  79.                     strAlias = Split(strLine, " ")
  80.                     If strAlias(0) = "alias" Then
  81.                         NewAlias strAlias(1), 0, JoinArray(strAlias, " ", 3)
  82.                     ElseIf strAlias(0) = "event" Then
  83.                         NewAlias strAlias(1), 1, JoinArray(strAlias, " ", 3)
  84.                     End If
  85.                     Set alias(alias_count).rootEngine = parent
  86.                     lineCount = 0
  87.                 End If
  88.             ElseIf strLine = "end alias" Or strLine = "end event" Then
  89.                 inAlias = False
  90.             ElseIf Left(strLine, 1) = ";" Then
  91.             Else
  92.                 If inAlias Then
  93.                     alias(alias_count).AddCodeLine strLine
  94.                 End If
  95.             End If
  96. ignoreline:
  97.         Loop Until EOF(1)
  98.     Close #FF
  99.     Exit Sub
  100. error_handler:
  101.     '* echo an error message
  102.     
  103. End Sub
  104.  
  105.  
  106.  
  107. Private Sub NewAlias(strName As String, the_type As Integer, Optional strExtraParams As String)
  108.     alias_count = alias_count + 1
  109.     ReDim Preserve alias(1 To alias_count) As clsSSE_Alias
  110.     Set alias(alias_count) = New clsSSE_Alias
  111.     
  112.     alias(alias_count).SetInfo strName, the_type, strExtraParams
  113.     
  114. End Sub
  115.  
  116.  
  117.