From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

halt script with labview

Solved!
Go to solution

let's say I execute a script using the "diadem run script.vi" due to user request.  Later, the user wants to cancel because it was taking longer than expected.

 

How do i halt the script using labview tools?

 

jim

0 Kudos
Message 1 of 4
(3,558 Views)
Solution
Accepted by topic author Jim West

Hi Jim,

 

This is possible, but not in the way I believe you are hoping.  I know of no way to halt a VBScript running in DIAdem from the "outside".  If you were staring at DIAdem you could hit the <ESC> key, but any subsequent request from LabVIEW will go onto DIAdem's "Script Stack" and will not be executed until the first VBScript is done naturally.

 

Of course you have to run all your LabVIEW calls to DAdem asynchronously, or nothing helps.

 

So what you can do is set up each VBScript that you think you might want to abort to periodically poll a DIAdem global variable, say "B9", and terminate from inside the VBScript if B9=TRUE.  The command interface from LabVIEW to DIAdem (ToCommand) goes onto the DIAdem Script Stack, but the variable interface from LabVIEW to DIAdem (ToDataSheet) does not.  So you can "poke" variable B9 from LabVIEW while the first VBScript is running and affect it's behavior, but only if and when that VBScript uses that (B9) variable you poked.

 

Of course none of this helps if your VBScript is busy waiting for a single VBScript command to execute, and it only helps if your VBScript is running multiple activities, between which it can poll the (B9) variable.

 

Hope that helps,

Brad Turpin

DIAdem Product Support Engineer

0 Kudos
Message 2 of 4
(3,549 Views)

Hi guys,

 

Do you have examples code which prompt to input ESC keys which execute in LV?

0 Kudos
Message 3 of 4
(2,850 Views)

Hi stevenson_john,

 

No, I don't, and I don't think it would help to simulate the <ESC> keystroke from a VI.  VBScript is actually quite good at simulating keystrokes, but of course the above scenario is that there is already a VBScript running in DIAdem, and only one VBScript can run in DIAdem at a time, so I don't see <ESC> key simulation helping here at all.  I stand by my earlier recommendation to structure your DIAdem VBScripts with global variable (B9, for instance) polling.  You can set a DIAdem global variable state from a running LabVIEW program in parallel to whatever VBScript is already running in that DIAdem instance.  I think that's your only chance.

 

Brad Turpin

Product Support Engineer

National Instruments

0 Kudos
Message 4 of 4
(2,844 Views)