05-19-2021 10:09 AM
Hi all,
We have programmed a Diadem script that runs automatically from Labview.
The problem is that when the script fails, the execution of the rest of the Labview program is blocked.
Would it be possible to disable the error pop-up in Diadem using Labview? I have already tried to send the 'AutoIgnoreError:=1' command in Labview, but it doesn't work (I am not sure if I used it properly... I read in an old post that this command is no longer available).
Another nice to have option would be getting the error code in Labview, but that's only a bonus 🙂
Many thanks in advance!!
Solved! Go to Solution.
05-19-2021 11:13 AM
You can help yourself by making sure that the script does not break.
If you wrap your code by 'on error resume next' you will be able to prepare the error to be read by your labview code.
Option Explicit
' call main method
call main()
sub main()
' the main method will only take care of raised errors
dim errorOccured : errorOccured = false
dim errorNumber : errorNumber = 0
dim errorText : errorText = ""
' will just go forward if errors shows up
on error resume next
call workToBeDone() ' this method does the real job
if 0 <> err.number then
errorText = err.Description
errorNumber = err.number
errorOccured = true
end if
on error goto 0
LogFileWrite "Result: errorOccured=" & errorOccured & ", errorNumber=" & errorNumber & ", errorText='" & errorText & "'"
end sub
sub workToBeDone()
dim a : a = Data.Root.ChannelGroups(1).Channels("DoesNotExist").Name
LogFileWrite "Not reached because of raised err"
end sub
06-01-2021 08:42 AM
Hi Andreas,
Thanks for your fast reply!!
What about disabling the error pop-ups in Diadem when the script doesn't works? Would it be possible?
Many thanks in advance!!!
06-04-2021 02:09 AM - edited 06-04-2021 02:11 AM
Just put a script beneath your script with the following content replacing "a.vbs" by your script name.
option explicit
on error resume next
scriptstart CurrentScriptPath & "a.vbs"
on error goto 0
Call this script instead of the original one.
Or if you are interested in the eror:
option explicit
dim errorOccured : errorOccured = false
dim errorNumber : errorNumber = 0
dim errorText : errorText = ""
on error resume next
scriptstart CurrentScriptPath & "a.vbs"
if 0 <> err.number then
errorText = err.Description
errorNumber = err.number
errorOccured = true
end if
on error goto 0
LogFileWrite "Result: errorOccured=" & errorOccured & ", errorNumber=" & errorNumber & ", errorText='" & errorText & "'"