DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

DIAdem 10.0 :: Connectivity VIs 3.1 :: Run script with "InteractionOn" command from an external application

Hello all,
 
I am using DIAdem 10.0 Adv, LV 8.0 with the DIAdem Connectivity VIs v3.1. I need to start a VBS script from my LabVIEW application. DIAdem hangs when the script executes the "InteractionOn" command. The script works fine when the script is run from DIAdem. I don't know why.
 
You can recreate the behavior with the simple script below.
 
MsgBox ("Hello")
InteractionOn
MsgBox ("Bye")
 
and the following calling VIs sequence:
 
DIAdem Open Reference
DIAdem Run Script
DIAdem Close Reference
 
Is it possible to pause a script and let the user manipulate DIAdem when the script is launch from LabVIEW?
 
Thank you for your help.
 
MatthieuG.
Eurilogic
 
0 Kudos
Message 1 of 7
(4,249 Views)
No answer... Is it a bug in DIAdem that has not been fixed by NI yet or do I make an error myself?
 
Thanks for your reply.
 
MatthieuG
Eurilogic
0 Kudos
Message 2 of 7
(4,219 Views)

Hi MatthieuG,

You have not made an error.  It turns out that during an OLE Server session, DIAdem automatically locks the DIAdem GUI, with the idea that otherwise the user and the OLE Server controlling application could get in each other's way and lead to unexpected results.  Ideally this would not be the case if the OLE Server controlling application happened to be running a DIAdem VBScript, but at the moment DIAdem does not distinguish between an arbitrary OLE Server session and one that is currently running a VBScript.

For now the best workaround I can suggest is to break your VBScript into two VBScripts-- everything before and after the InteractionON, respectively (but not including the InteractionON command).  Then call the first VBScript from LabVIEW and begin polling DIAdem once per second to see if the desired steps have been carried out in DIAdem-- hopfully they lead to new channels or some other measurable change.  Once the desired action has occured, LabVIEW can kick off the second VBScript.  This is neither clean nor pleasant, but it is the best I can think of with currentl functionality.

Regards,
Brad Turpin
DIAdem Product Support Engineer
National Instruments

 

Message 3 of 7
(4,191 Views)

Hi,

I recently used Diadem 9.1 with labview 7.1 to create a data capture/analysis system, labview did the capture, opened diadem using the connectivity vi's and instructed diadem to run a vbs script.

Analysis was performed then the user could print graphs etc from a SUD dialog, or use the interactionON (run from the vbs file)function to gain access to the full capabilities of diadem and then return to the script.

This worked using diadem 9.1, am I correct in assuming that this functionality will no longer work using Diadem 10.

I'm about to build 10 more systems and before I order 10 copies of diadem I need to get this resolved.

This change in functionality will cause major problems (splitting the script in two is not an option).

Is it possible to buy diadem 9.1 (at reduced cost of course) instead of 10.

Regards

Nick

0 Kudos
Message 4 of 7
(4,149 Views)

Hi Nick,

I went another round with R&D on this question, and they reported that the GUI lock that occurs when accessing DIAdem through its OLE Server, which precludes InteractionON, is only applied with the CmdExecuteSync() method.  They say if you use instead the CmdExecuteASync() method that the InteractionON state will be allowed, even in DIAdem 10.  They are looking into addressing this for the next version of DIAdem, but for DIAdem 10 that means you'd need to poll on a DIAdem variable from LabVIEW which the VBScript would set as its last command, in order to know when it finished (assuming LabVIEW doesn't quit then too).  You might also want to poll on the error status in case the VBScript asynchronously errors out.  In that case, try playing with the below code:

Set ToCommand = CreateObject("DIAdem.ToCommand")
Call ToCommand.CmdExecuteSync("LastErrorReset")
Call ToCommand.CmdExecuteSync("AutoIgnoreError:= 1")
Call ToCommand.CmdExecuteSync("L1:= 0")
Call ToCommand.CmdExecuteSync("L1:= ProgramRevision(1,3,4)")
'Call ToCommand.CmdExecuteSync("L1:= ProgramRevision")
'Call ToCommand.CmdExecuteSync("LastErrorReset")
Call ToCommand.CmdExecuteSync("LastErrorGet")
Call ToCommand.IntegerVarGet("L1", Version)
Call ToCommand.IntegerVarGet("LastErrorNo", ErrNum)
Call ToCommand.TextVarGet("LastErrorFile", ErrText)
Call ToCommand.IntegerVarGet("LastErrorPart", ErrPart)
Call ToCommand.CmdExecuteSync("AutoIgnoreError:= 0")
Set ToCommand = Nothing
MsgBox "DIAdem Revision = " & Version & vbCRLF & "ErrNo = " & ErrNum & vbCRLF & "ErrMsg = " & ErrText & vbCRLF & "ErrPar = " & ErrPart


Regards,
Brad Turpin
DIAdem Product Support Engineer
National Instruments

 

 

 

0 Kudos
Message 5 of 7
(4,119 Views)

Hi Brad

Thanks for looking further into this.

I've created the attached vi + script, the vi opens diadem asynchronously and runs the script and then reads variable R1 repeatedly until R1=1 then diadem is closed.

The script sets interactionOn then when it resumes sets R1 to 1.

This seems to work ok most of the time but occasionally I find that when the end interaction button is pressed labview locks up, R1 is not read and diadem remains open.

This happens maybe one time in 10 but its a bit to often for things to be considered reliable.

Any suggestions appreciated

Nick

 

0 Kudos
Message 6 of 7
(4,099 Views)

Hi Nick,

Thank you for your test files. With this information we could reproduce the behaviour you described. It can appear if DIAdem is controlled by an application (e.g. LabVIEW) and the “InteractionOn” mode is activated via script. This will be fixed for the next revision.

Greetings
Walter
0 Kudos
Message 7 of 7
(4,012 Views)