View Full Version : Getting specific data from a file.....
jcobb
10-02-2002, 10:59 AM
I have a text file,(but can be any format) that I would like to be able to pull specific information from. Example...box one has a list of 50 states. when a state is selected, box2 lists the major cities from the selected state. when a city is selected, box3 give a list of local prefixes for the city selected.
Any body have any suggestions?
Lorne
10-02-2002, 11:21 AM
The discussion in this other thread (http://www.indigorose.com/ubbthreads/showthreaded.php?Cat=&Board=UBB2&Number=10192&page =&view=&sb=&o=) might help you...
You could also have a look at the attached example (also from that thread).
12371-Raceday.zip (http://www.indigorose.com/ubbthreads/uploads/12371-Raceday.zip)
jcobb
10-03-2002, 03:30 PM
Ok, the example has helped me out tremendously. Thank you.
I have one more question though, Can I have the data shown in the box3 list something like this "555-555-5555 N3" but when selected it adds just the "555-555-5555" to an INI file, leaving the N3 out?
Lorne
10-03-2002, 04:00 PM
Sure! There are a few different ways to approach that, actually. You could use some String actions to trim off the N3 part before you display it...or (and this is probably the best way) you could just store the alternate text as the hidden "data" part of that item.
See the "Adding an item to a list box (with data)" action example in the Command Reference, or search this forum as our own sophisticated and suave Adam put up a really excellent example of this sort of thing at one point.
jcobb
10-07-2002, 01:08 PM
Ok. I am still having difficulty achieving my goal. I have modified the example "raceday" to better show my dilema.
If you download the example, you will notice I have added an editbox, and edited the .txt file. If you click on the first date, the first race, you will see a number infront of each horse. What I would like, is for only the horse to be listed in the editbox, not the number and the horse.
Please check it out, and let me know if you have any help.
Any questions, you can email me at jcobb@ejourney.com
I have attached the example file for dowload, or, you can download it from http://www.ejourney.com/~jcobb/raceday_modified.zip
Thanks again
12513-raceday_modified.zip (http://www.indigorose.com/ubbthreads/uploads/12513-raceday_modified.zip)
Derek
10-08-2002, 05:31 PM
Hi jcobb - taking into account that there may not always be a single digit as the number and there are two spaces (as in this case) between the number and the Horse name, use this method:
<font color=green>
<IR_ACTIONS_LIST>
<Action name="Get Item Text">
<Type>117</Type>
<Function>0</Function>
<DTIndentLevel>0</DTIndentLevel>
<Enabled>1</Enabled>
<ErrorHandling>
<UserNotificationMode>2</UserNotificationMode>
<CustomErrorMessage/>
<OnErrorAction>0</OnErrorAction>
<JumpToLabel/>
</ErrorHandling>
<TargetListBox>Horses</TargetListBox>
<GetType>0</GetType>
<Index/>
<IndexDelimiter>;;</IndexDelimiter>
<Variable>%ItemText%</Variable>
<VarDelimiter>:</VarDelimiter>
</Action>
<Action name="Find">
<Type>21</Type>
<Function>0</Function>
<DTIndentLevel>0</DTIndentLevel>
<Enabled>1</Enabled>
<ErrorHandling>
<UserNotificationMode>2</UserNotificationMode>
<CustomErrorMessage/>
<OnErrorAction>0</OnErrorAction>
<JumpToLabel/>
</ErrorHandling>
<Variable>%FoundPos%</Variable>
<SearchIn>%ItemText%</SearchIn>
<SearchFor> </SearchFor>
<StartAtPosition>0</StartAtPosition>
<SearchDirection>0</SearchDirection>
<CaseSensitive>0</CaseSensitive>
</Action>
<Action name="Set Value">
<Type>6</Type>
<Function>0</Function>
<DTIndentLevel>0</DTIndentLevel>
<Enabled>1</Enabled>
<ErrorHandling>
<UserNotificationMode>2</UserNotificationMode>
<CustomErrorMessage/>
<OnErrorAction>0</OnErrorAction>
<JumpToLabel/>
</ErrorHandling>
<Variable>%CustomVar%</Variable>
<Value>%FoundPos% + 2</Value>
<Evaluate>1</Evaluate>
</Action>
<Action name="Mid">
<Type>24</Type>
<Function>0</Function>
<DTIndentLevel>0</DTIndentLevel>
<Enabled>1</Enabled>
<ErrorHandling>
<UserNotificationMode>2</UserNotificationMode>
<CustomErrorMessage/>
<OnErrorAction>0</OnErrorAction>
<JumpToLabel/>
</ErrorHandling>
<Variable>%SubString%</Variable>
<SourceString>%ItemText%</SourceString>
<StartAtPosition>%CustomVar%</StartAtPosition>
<NumberOfCharacters>1000</NumberOfCharacters>
</Action>
<Action name="Set Text">
<Type>77</Type>
<Function>0</Function>
<DTIndentLevel>0</DTIndentLevel>
<Enabled>1</Enabled>
<ErrorHandling>
<UserNotificationMode>2</UserNotificationMode>
<CustomErrorMessage/>
<OnErrorAction>0</OnErrorAction>
<JumpToLabel/>
</ErrorHandling>
<ObjectName>EditField1</ObjectName>
<Text>%SubString%</Text>
</Action>
</IR_ACTIONS_LIST>
</font color=green>
jcobb
10-08-2002, 07:53 PM
ok...worked perfectly...but I would also need one that would take the beginning data then have 2 spaces then a two characters ie. Horse Name A1 or Horse Name C2. Is this a simple edit to the script above, or a totally new one? I will be playing with it myself, so I will post if I get it.
Thanks again, for all of your help.
Derek
10-09-2002, 07:16 AM
If the txt file format stays the same but 'N3' is added as a suffix, you need to do nothing but add it, in the txt file. The Actions in AMS are reading upto 10000 chars. - so basically to the end of the line, to include anything it finds.
If you plan on taking out the 'line number' and spaces at the beginning of the line, then an adjustment will be needed.
TJ_Tigger
10-09-2002, 11:40 AM
That brings up a question I have, I see that some of the scripts have had the 1000 characters listed in them. Does this reference 1000 characters or until the end of the line? Like the following example with String.Mid, there is an area for number of characters to capture. 1000 characters can be a lot I assume that is will do upto that number of characters or until the end of the line or line break. I did not find the answer in the Command Reference section of the help guide.
<IR_ACTIONS_LIST>
<Action name="Mid">
<Type>24</Type>
<Function>0</Function>
<DTIndentLevel>0</DTIndentLevel>
<Enabled>1</Enabled>
<ErrorHandling>
<UserNotificationMode>2</UserNotificationMode>
<CustomErrorMessage/>
<OnErrorAction>0</OnErrorAction>
<JumpToLabel/>
</ErrorHandling>
<Variable>%FileText%</Variable>
<SourceString>%FileText%</SourceString>
<StartAtPosition>%FoundPos%</StartAtPosition>
<NumberOfCharacters>1000000</NumberOfCharacters>
</Action>
</IR_ACTIONS_LIST>
Derek
10-09-2002, 12:02 PM
If 1000 chars. is specified, that's what it will look for, whether that is the end of the line or not. If the end of the line is reached before 1000 chars. it will stop at the end of the line.
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.