11-21-2011 03:08 PM
Hi smoothdurban,
What's the bigger picture here? What are you trying to do, at a high-level? There may be a better way to approach this.
That said, to directly answer your question, you can store information from a dialog within DIAdem's pre-allocated Auxiliary Variables (T1, R1, etc.), or you could always globally allocate your own variables, which then be programmatically accessible to DIAdem after your dialog box returns.
11-21-2011 03:19 PM
Hey Derrick
I am trying to use a GUI to allow a user to select which data file to process and generate a report.
I currently have a VBScript file and Report Layout which conditions test data and creates test channels and generates the desirable report layout.
I want to add a GUI which would allow a user to select individual files to process and and add some pertinent test information.
Seems Simple enough.
11-21-2011 04:06 PM
Hi smoothdurban,
If you're just looking to prompt the user to choose which files to process, note that can be done from SCRIPT without involving a custom user dialog box (using the commands we spoke about earlier in this thread). If you choose to call the commands from your user dialog box, the selected files will still automatically be available as DIAdem environment variables that are accessible from your "main" script.
If you need to have the user enter additional information (for example, operator name), then a custom user dialog box seems like the way to go. However, in the most ideal case, this type of information could be added to the data collection application and saved to the actual data file(s) so that the information would not only automatically populate in your reports, but would also be searchable using DataFinder (e.g. find all files where the operator name was "George").
If you choose to go the custom dialog route, then using the variable approach to access the "additional information" from your primary script will work great.
11-22-2011 09:18 AM
I have been able to use the code provided in the thread to give the user the ability to select which file they would like to process and then process it.
I would like to add a custom dialog box which would take in such things as operator name, test title etc. The operator names could come from a combo box while the test name would be manually entered.
How would I be able to grab this information in the dialog box and send it to my VBScript.
I tried looking at the example Dynamic User Dialog Box but for some reason my version of DIAdem has different SUD file listed as "SudExample 1.sud" which does not appear to correspond to the VBScript Sud SignalSelect.vbs.
However I do see how the global variable has been declared. How would I reference a global variable called in one script in another script? (An example of how do to this would be appriciated!)
11-23-2011 02:32 PM
Hi smoothdurban,
The example that I mentioned shows how to do this. Once the variable is declared it is referenced like any other variable. If you could not clearly view the code, here is a snippet:
Call GlobalDim("iMyVar1, iMyVar2") iMyVar1 = 1 iMyVar2 = 0
Here is the help file that discusses Global Variables in DIAdem:
http://zone.ni.com/reference/en-XX/help/370859H-01/comoff/globaldim/
I hope that this helps.
Regards,
Perry S.
08-21-2012 06:48 AM
Hey Perry,
Any experience using global variable in an array?
It seems I get errors when I try to do so.
08-21-2012 06:58 AM - edited 08-21-2012 07:05 AM
Hi Tim
What are your problems? What is your code and the what are the error messages? As explained in the help (http://zone.ni.com/reference/en-XX/help/370859K-01/comoff/globaldim/) you can use arrays in GlobalDim.
Winfried
08-21-2012 07:11 AM
The problem I am having is that i create a clobale variable array
GlobalDim "ArrayTest()"
Then I am unsure how to specify the array size which I normally perform with ReDim on local variables.
I am also curious whether or not I could set the size of the global array using my script in one of my SUDialog box scripts?
08-21-2012 07:32 AM
The best way is to use it in conjunction with GlobalRedim. The following example shows you haw to use it
Call ScriptCmdReset GlobalDim "ArrayTest()" GlobalReDim "ArrayTest(3)" arraytest(1) = 5 call test sub test msgbox Arraytest(1) End Sub
To reset all global Variables use ScriptCmdReset
Hope this helps
Winfried
08-21-2012 07:45 AM
Thanks
Needed to Call ScriptCmdReset.