 AndiMEC
		
			AndiMEC
		
		
		
		
		
		
		
		
	
			07-01-2014 05:34 AM
Hello,
how can i transfer the items (names) of a listbox to script.
Thanks
 Brad_Turpin
		
			Brad_Turpin
		
		
		
		
		
		
		
		
	
			07-01-2014 09:56 AM
Hi AndiMEC,
Do you mean a listbox control in a SUDialog?
Brad Turpin
DIAdem Product Support Engineer
National Instruments
07-01-2014 10:31 AM
Hi Brad
i have a dialog with a listbox and a (channel)combobox from which i add any number of channels to the listbox. Now i need to get all the items(Channels) which are in the listbox to my script for further analysis.
 MartinKozlowski
		
			MartinKozlowski
		
		
		
		
		
		
		
		
	
			07-02-2014 03:14 AM - edited 07-02-2014 03:16 AM
Hi,
just add all Elements to an Array or Dictionary and give this Oject to your Script:
In your SUD:
Dim aTmp() Redim aTmp(listBox.Items.Count - 1) For i = LBound(aTmp) To UBound(aTmp) aTmp(i) = listBox.Items(i+1).Text Next Call Dialog.SetArgument(aTmp)
Now in your VBS:
Dim i, aChannels
If (SUDDlgShow("name", sPathToSUD, aChannels) = "IDOk") Then
  For i = LBound(aChannels) To UBound(aChannels))
    Call LogFileWrite(aChannels(i))
  Next
End If
 Brad_Turpin
		
			Brad_Turpin
		
		
		
		
		
		
		
		
	
			07-02-2014 09:01 AM
Hi AndiMEC,
Execute this code in the SUDialog and pass the ChanNames variable back to the calling VBScript. You may probably have to change the name of the control from "ChnCombobox1" to whatever you called it.
  Dim i, iMax
  iMax = ChnComboBox1.Items.Count
  ReDim ChanNames(iMax)
  FOR i = 1 TO iMax
    ChanNames(i) = ChnCombobox1.Items(i).Text
  NEXT ' i
  MsgBox Join(ChanNames, vbCRLF)
Brad Turpin
DIAdem Product Support Engineer
National Instruments