07-23-2012 07:28 AM
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
Solved! Go to Solution.
07-24-2012 09:49 AM
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.
07-30-2012 07:19 AM
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.
08-02-2012 10:08 AM
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
08-02-2012 10:50 PM
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:
Run the example and then choose "Edit" while viewing the dialog box that results.
Let me know if that helps.
08-03-2012 08:22 AM
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.
08-03-2012 10:27 AM
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
08-03-2012 12:14 PM
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.
08-03-2012 03:04 PM
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
08-08-2012 07:24 AM
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.