Getting all the items in a list box

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
kpassaur
Automation Wizard
Posts: 696
Joined: Wed Jul 07, 2004 1:55 pm

Getting all the items in a list box

Post by kpassaur » Wed Mar 28, 2007 4:34 pm

I am trying to get the entire contents of a list box not just one selected item. Is there anyway to capture the entire list and write it to a text file?

Thanks

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Wed Mar 28, 2007 8:03 pm

The quick answer is YES.

It depends on what the source file is. If you are on a web page, you could open the source file and may be able to pull out the values there. You could search for the combo box code, copy it to a variable, then parse the variable to extract the select values and write them to a file.

Here is a rough outline of the process to follow on most generic files:
On most pages, you can create a loop that goes to the combo box.
Set counter of n=0
Start Looping
Press>Down*n, Enter
Copy value to clipboard, and store as %last value%
Send clipboard to variable
Append variable to the list file.
Add>n,1
Continue looping until the value copied is same as %last value%, now you know you have done them all. End the loop.
If not the same as %last value% then repeat the loop.

Again, this is just a quick and dirty flow chart to get started. Untested, needs fine tuning.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

kpassaur
Automation Wizard
Posts: 696
Joined: Wed Jul 07, 2004 1:55 pm

Getting List Box Text

Post by kpassaur » Wed Mar 28, 2007 8:19 pm

Bob, thank you for responding.

What I am looking is a way to get the text out of a MS list box that is in a Non-Modal Dialog Box. What the script is doing is adding lines and removing lines making the lines go up and down. But all that is one line at a time. I want to be able to just get all the lines in the order that they are displayed on the screen. What happens is when I add lines and remove lines and I save the file those lines are not change as the list box was just updated.

User avatar
JRL
Automation Wizard
Posts: 3532
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Wed Mar 28, 2007 10:42 pm

Keith,
If I'm understanding you correctly, you have a script that you are working with that has a non-modal dialog with a list box. That list box has a list that is changing while the script is processing. You want to know how to write that list to a file.

First, I'm sure you'll recognize that you are writing the list to a file at a moment in time. If the list continues to update, you will need to recreate or append to the file to reflect any updates.

There is a variable named [DIALOG_NAME].[LISTBOX_NAME].ITEMS.TEXT that contains the exact contents of the list box.
From Dialog ListBox Help wrote:Items is a list of items separated by %CRLF%. Creates variable defined by DialogName.Name set to the value of the item(s) selected by the user. Use DialogName.Name.Items.Text to set/retrieve the entire list at runtime. Optionally set multiselect to TRUE. If more than one item is selected in a multiselect list box DialogName.Name is set to the list of selected values separated by %CRLF%

WriteLn>[FileName],result,%[DIALOG_NAME].[LISTBOX_NAME].ITEMS.TEXT%

will write the list box contents to a file.

Hope this helps,
Dick

kpassaur
Automation Wizard
Posts: 696
Joined: Wed Jul 07, 2004 1:55 pm

list item update

Post by kpassaur » Wed Mar 28, 2007 11:01 pm

That is what I have been looking for. I will give it a shot. I'm sure it will work.

Thanks

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts