Combo box to list an ascii database?

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
obfusc88
Pro Scripter
Posts: 85
Joined: Wed Mar 14, 2007 6:22 pm

Combo box to list an ascii database?

Post by obfusc88 » Fri Aug 09, 2013 8:29 pm

I have an ascii text file, semicolon delimited, that I would like to choose from with a Dialog ComboBox. But I am having trouble populating the box.

Obviously it is impossible to type hundreds of lines, four columns per record. But I can make smaller lists on the fly. But I still need to get the smaller list into the box. I have tried to make a small text list manually with differing results.

From the forum I have seen multiple references of data entry, I tried them all including:
[Option1,Option2,Option3]
Option1#13#10Option 2#13#10Option 3#13#10
Option1%CRLF%Option 2%CRLF%Option 3%CRLF%
'Option1'%CRLF%'Option 2'%CRLF%'Option 3'%CRLF%
'Option1'#13#10'Option 2'#13#10'Option 3'#13#10

The last one seems to work best, some not at all.
But in the ComboBox properties I see the values listed twice, one as a long column under Items.String, and again under Text as a long string. There has to be an easy way to fill both those object values. And when I make a manual list, all the values show in the original opening box, but changes when I make the selection from the rows below. I expected the original box to be blank until a selection was made.

If I try editing in the Dialog Designer in the Text field with Right Click, Multi Line Edit, that does not work either.

I was hoping to do something like this:

Code: Select all

Let>BoxList=Option1;Option2;Option3;Option4;
SetDialogProperty>Dialog1,ComboBox1,Text,%BoxList%
That does not work. Even if it did work, those are the four fields in a single record, I really want multiple records listed with four fields each, like this:

Option1: ValueA, ValueB, ValueC, ValueD
Option2: ValueA, ValueB, ValueC, ValueD
Option3: ValueA, ValueB, ValueC, ValueD
Option4: ValueA, ValueB, ValueC, ValueD

So, from a blank combo box, the operator sees a dropdown with all four columns to help make the selection, and chooses one line. After that line is chosen it is no problem to parse out the real values that are needed.

Any insight or code samples available for this condition?

obfusc88
Pro Scripter
Posts: 85
Joined: Wed Mar 14, 2007 6:22 pm

Post by obfusc88 » Fri Aug 09, 2013 8:41 pm

I may be closer...

When I did a right click on the Text object in the Designer, I found an option to select a file. Great! So, what should the format of the file look like? What does it look like for multiple columns, vs. a single column?

If I set the original values there, how can I dynamically load another file from the script? I guess the SetDialogProperty that I tried is probably the answer, but I am just using the wrong file content, delimiters, etc.

User avatar
Dorian (MJT support)
Automation Wizard
Posts: 1359
Joined: Sun Nov 03, 2002 3:19 am
Contact:

Post by Dorian (MJT support) » Tue Aug 13, 2013 12:19 am

I apologize for not being too helpful (again) as dialog boxes really are not my strongpoint. Marcus will be back next week and will look at this at his earliest opportunity.
Yes, we have a Custom Scripting Service. Message me or go here

User avatar
Marcus Tettmar
Site Admin
Posts: 7380
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Tue Aug 20, 2013 9:44 am

To be honest I'm not sure what you're asking here. The text property is for the text edit at the top of the combo box and nothing to do with the options that you can select from.

That would be the ListText property.

Are you asking to be able to see multiple columns in there?

If so I think the only way you could mimic that would be to use a fixed width font and then use fixed spacing to give the effect of multiple columns in the list.

The text file option simply loads the path of the file chosen in this instance - nothing to do with the content of the file. But if you wanted to read from a text file and load the contents into the combo box you could do that in script code at run time by using ReadFile and then setting the ListText property with the content of the file. Each line of the combo box would be delimited by carriage returns in the file.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

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