DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Select and Use Data Points Script

Solved!
Go to solution

Hello,

 

I have developed a script that conditions data however to automate the process further I would need assistance with a strategy to select the data conditioning start point.  What I mean by this is I have a piece of raw data that say has 2 events, EV1 & EV2.

 

Sometimes when the data is acquired EV1 is performed first and EV2 is performed after,  other times EV2 is performed first and EV1 is performed after, furthermore sometimes only EV1 or EV2 is acquired.

 

 

I have developed a script which processes my data however I  have to manual offset a physical value in my script so the "FIND()" function starts looking in the correct place.  

 

What I would like to do is to have my script prompt the user on where the script should consider a start point of the script or whether or not the portion of the script is run at all.

 

Here  is how I am offsetting the FIND()

 

CtrlTimeVals(i)= Find("Ch(L2) >= R1", CtrlTimeVals(i-1)+3537)

RespTimeVals(i)= Find("Ch(L4) >= R2", RespTimeVals(i-1)+35400)

 

I am using DIAdem 2011

Tim
0 Kudos
Message 1 of 33
(6,715 Views)

Hi smoothdurban,

 

How do you want the user to input "where the script should consider a start point?"  Do you want them to manually type in a start time (or index), or would you rather them interact with a graph (for example, in VIEW) in order to place the cursor in the correct position?

 

Either way, it sounds to me like you could make a simple Scriptable User Dialog (SUD) box with the SUD Editor in SCRIPT.  Prompt the user to <input a start point or cancel> using your dialog box (which could be modal if inputting a start point via numeric input, or non-modal if inputting a start point via VIEW cursor) and use the the output of their selection as input to your Find() function. 

Derrick S.
Product Manager
NI DIAdem
National Instruments
0 Kudos
Message 2 of 33
(6,703 Views)

Hey Derrick

 

I would be more inclined to have the user be prompted to select (By clicking on) a starting point.

 

I know how to develop a basic SUD  but I have run into problems getting data from user selection and using this in the main script file.

 

I am currently reviewing some of the supplied examples and may need assistance developing my user interface.

 

Tim
0 Kudos
Message 3 of 33
(6,675 Views)

Hey Derrick,

 

I have had some time to kind off play around using the SUD files.

 

Currently I have a main script file which calls  GUI's I created which prompt the user which file to open and then prompt the user which channel(s) to select.

 

I there away to display a preview of the data or plot the selected data while my main script file is still executing?

 

I have found a way to display the selected channels in the  View tab but they are only viewable once the main script has stopped running.

 

Ultimately I would like the user to be able to select the starting points by moving some short of a cursor and clicking when the want my original script to run.

 

Thanks 

Tim
0 Kudos
Message 4 of 33
(6,655 Views)

Hi smoothdurban -

 

I think you're looking for the function called InteractionOn() (and its corresponding function, InteractionOff()).  These functions will pause execution of a script to allow the user to interact with the environment, and then subsequently end interaction and continue execution of the script.

 

There's an example that uses the commands.  You can find it in the Help » Examples menu by navigating the hierarchy as follows:

 

Example.png

 

Run the example and then choose "Edit" while viewing the dialog box that results.

 

Let me know if that helps.

Derrick S.
Product Manager
NI DIAdem
National Instruments
0 Kudos
Message 5 of 33
(6,650 Views)

Hey Derrick,

 

This seems to be moving in the write direction except I cannot use the InteractionOn() in my SUD file.

 

Also I am uncertain how the example SUD files "Edit" button causes interaction as the button has no event handler associated with it.

Tim
0 Kudos
Message 6 of 33
(6,639 Views)

Hi smooth,

 

If you want to use both SUDialogs and InteractionOn(), then I recommend that you have a loop in your DIAdem VBScript that first calls the SUDialog, then calls InteractionOn, then repeats the process.  Once the SUDialog exits, InteractionOn() available again, and you can relaunch the SUDialog and make sure it pops up in the same state the user last left it.

 

Brad Turpin

DIAdem Product Support Engineer

National Instruments

0 Kudos
Message 7 of 33
(6,635 Views)

Hey Brad thanks for the tip,

 

The example Derrick mentions above does infact have a do while loop around the SUD Call and interactionOn() instructions.  I am a little perplexed how it stop the DIAdem script from running when the edit button is pressed.

Tim
0 Kudos
Message 8 of 33
(6,631 Views)

Hi Smooth,

 

I still haven't looked at the demo Derrick posted, but in general the SUDialog can set and pass global variables back to the calling VBScript, which the VBScript can use to conditionally exit the loop.

 

Brad Turpin

DIAdem Product Support Engineer

National Instruments

0 Kudos
Message 9 of 33
(6,628 Views)

Hey Brad

 

I have attached a piece of my code which has the call for user interatcion but I am unsure if the logic is coded correctly.  When I run this in my script it successfully calls the .SUD file but the call for user interaction is never made.

 

in my .SUD file one of the buttons cancels the Dialog box by using "Dialog.Cancel"  which breaks the program out of the loop.

 

 

do while   SUDDlgShow("DataPreview",MyFolders(0)&"Load File.SUD",NULL) <> "IDCancel"

    CallInteractionOn("Click Here to Finish Viewing")

Loop

 

Any help would be appriciated.

Tim
0 Kudos
Message 10 of 33
(6,608 Views)