Hello,
I am working in DIAdem 2021 Service Pack 1, i am having an issue in Dataplugin tool (.vbsd file) which upload Excel files. Nevertheless, from this *.vbsd file I need to call a VBScript file (.vbs) to perform other actions. I have noticed previously similar issue and used the function :
Function ScriptText(Byval ScriptPath)
Dim i, f, fso, Steps, ErrNum, ErrMsg, Msg
Set fso = CreateObject("Scripting.FileSystemObject")
Steps = Array("FIND", "OPEN", "READ", "CLOSE", "EXECUTE")
FOR i = 0 TO 4
On Error Resume Next ' suspend VBS error handling
Select Case i
Case 0 : IF NOT fso.FileExists(ScriptPath) THEN Err.Raise -1,"","file not found"
Case 1 : Set f = fso.OpenTextFile(ScriptPath, 1)
Case 2 : ScriptText = f.ReadAll
Case 3 : f.Close
Case 4 : Execute ScriptText ' test if ScriptText executes without error
End Select ' i
ErrNum = Err.Number
ErrMsg = Err.Description
On Error Goto 0 ' resume VBS error handling
IF ErrNum <> 0 THEN Exit For ' i
NEXT ' i
IF ErrNum <> 0 Then
Msg = "ScriptText() ERROR!! Could not " & Steps(i) & " the file:"
Msg = Msg & vbCRLF & vbCRLF & Chr(34) & ScriptPath & Chr(34)
Msg = Msg & vbCRLF & vbCRLF & String(CInt(1.75*Len(ScriptPath)), "-")
MsgBox Msg & vbCRLF & vbCRLF & "Error " & ErrNum & ": " & ErrMsg
ScriptText = "Dialog.Cancel"
End If ' ScriptPath is Executable
End Function ' ScriptText()
but still function and it runs until the end without any error message but it is still not working (any action from the *.vbs file is carried-out)
Kindly do the needful.