DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Disabling Diadem script errors with Labview

Solved!
Go to solution

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!!

 

0 Kudos
Message 1 of 4
(1,801 Views)

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

 

0 Kudos
Message 2 of 4
(1,769 Views)

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!!!

 

0 Kudos
Message 3 of 4
(1,724 Views)
Solution
Accepted by topic author lorunai1911

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 & "'"

 

0 Kudos
Message 4 of 4
(1,695 Views)