Skip to content
Browse files

Add 3 SSC functions for VB6 Interaction functions (completes the set …

…of 4 VB6 Interaction functions).

* SSC.Choose(Index, ParamArray Choices):
  - chooses the element from the provided parameters in Choices
  - returns Null if out of range (Index is 1 to parameter count)
  [custom-built as calling VB6 version is impossible]
* SSC.IIf(Expression, TruePart, FalsePart):
  - chooses either TruePart or FalsePart based on whether Expression is True.
  [added by Pyro, not me! - I changed comment to use VB6 URL instead]
* SSC.Partition(Number, Start, End, Interval) As String:
  - returns a string representing the range where a number resides ("start:end") in a repeating interval defined by Start To End Step Interval
  - apparently useful for database queries
  [if end <= start or interval <= 0 then returns Null]
* SSC.Switch(ParamArray ExpressionPartPairs):
  - returns first even Part argument where the odd Expression argument before it is True.
  - returns Null if no True odd arguments or if odd number of arguments and last argument is the True expression.
  [custom-built as calling VB6 version is impossible]
  • Loading branch information...
nmbook committed Apr 10, 2016
1 parent f55614e commit 9dbbc2ce36530af2f20852ec321294ed97f6024d
Showing with 37 additions and 1 deletion.
  1. +37 −1 trunk/clsScriptSupportClass.cls
@@ -1570,13 +1570,49 @@ Public Function GetCurrentServerIP()
End If
End Function

'// Returns the chosen value based on the given index.
'// see:
Public Function Choose(ByVal aIndex As Single, ParamArray pChoice() As Variant) As Variant
Choose = Null
If aIndex > 0 And aIndex <= UBound(pChoice) Then
Choose = pChoice(aIndex - 1)
End If
End Function

'// IIF
'// Returns a different value based on if a statement is true or false.
'// see:
'// see:
Public Function IIf(ByVal bExpression As Boolean, ByVal vTruePart As Variant, ByVal vFalsePart As Variant) As Variant
IIf = Interaction.IIf(bExpression, vTruePart, vFalsePart)
End Function

'// Returns the range that the specified Number appears in in the given interval defined by Start, Stop, and Interval.
'// see:
Public Function Partition(ByVal aNumber As Long, ByVal aStart As Long, ByVal aStop As Long, ByVal aInterval As Long) As String
Partition = Null
If aInterval > 0 And aStop > aStart Then
Partition = Interaction.Partition(aNumber, aStart, aStop, aInterval)
End If
End Function

'// Returns the first even item in the parameter list after the odd expression that is true.
'// There must be an even number of arguments.
'// see:
Public Function Switch(ParamArray pVarExpr() As Variant) As Variant
Dim i As Long

Switch = Null
For i = 0 To UBound(pVarExpr) - 1 Step 2
If pVarExpr(i) Then
Switch = pVarExpr(i + 1)
Exit Function
End If
Next i
End Function

'Class_Terminate doesn't run when a UI form is created via a script. I made this sub so the bot's Unload sub can explicitly _
call the code within Class_Terminate to kill all the objects. - FrOzeN
Public Sub Dispose()

0 comments on commit 9dbbc2c

Please sign in to comment.
You can’t perform that action at this time.