Running Beta10, and not sure what I'm doing wrong, but checking for the vector being empty fails:
[code]Option Explicit
' Called by Directory Opus to initialize the script
Function OnInit(ByRef initData)
DOpus.Output("Initializing...")
' Provide basic information about the Script
initData.name = "OnBeforeFolderChange_vbtest"
initData.desc = "Adds the 'OnBeforeFolderChange_vbtest' event handler to Directory Opus."
initData.copyright = "(c) 2014 steje"
initData.version = "v1.0.0 (vb)"
initData.default_enable = True
'////////////////////////////////////////////////
' Set DEBUG flag below to true in order to enable logging messages to the Opus Output Window
initData.config.DEBUG = True
'////////////////////////////////////////////////
' Create a ScriptConfig property of type VT_BSTR
initData.config.strScriptVT_BSTR = "VT_BSTR"
'////////////////////////////////////////////////
' Create a ScriptConfig property of type VT_I4
initData.config.iScriptVT_I4 = 255
'////////////////////////////////////////////////
' Create a ScriptConfig property of type VT_BOOL
initData.config.bScriptVT_BOOL = False
'////////////////////////////////////////////////
' Create a ScriptConfig property of type VT_VECTOR / VB TypeName() will return type : Variant
initData.config.objScriptVT_VECTOR = DOpus.NewVector("")
End Function
' Called before a folder is opened
Function OnBeforeFolderChange(ByRef beforeFolderChangeData)
Dim message
message = ""
Const vbQuote = """"
Dim STRING
STRING = "VT_BSTR"
logMsg("")
logMsg("------------Begin------------")
'////////////////////////////////////////////////
' Test the objScriptVT_VECTOR ScriptConfig property
Dim i, x, objScriptVT_VECTOR_type, objLinkedTabList_type
If (Script.config.objScriptVT_VECTOR.empty) Then
logMsg("objScriptVT_VECTOR is empty... exit")
Exit Function
End If
logMsg("")
message = "ScriptConfig property objScriptVT_VECTOR "
objScriptVT_VECTOR_type = TypeName(Script.config.objScriptVT_VECTOR)
logMsg(message & "is of type: " & objScriptVT_VECTOR_type)
If Not (objScriptVT_VECTOR_type = "unknown") Then
i = 0
For Each x in (Script.config.objScriptVT_VECTOR)
logMsg(message & "values are set to: [" & i & "]: " & x)
i = i + 1
Next
End If
'////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
logMsg("")
logMsg("------------End------------" & vbCrLf)
End Function
' Subroutine to allow toggling of the global VT_BOOL variable to control whether logging is performed or not
Sub logMsg(message)
If (Script.config.DEBUG) Then DOpus.Output(message)
End Sub[/code]
...just even looking without testing, shouldn't the If (Script.config.objScriptVT_VECTOR.empty) check be true here? If you're inclined to say its the ("") assignment, well... setting a size of (0) or even just () produces an error when I test the vector in that If check:
Object required: 'Script.config.objScriptVT_VECTOR' (0x800a01a8)