PDA

View Full Version : Newbie Question: How do I search though an ASCII file for a string value?



robheim
04-28-2003, 04:23 PM
I'm trying to configure an installation program to read through an existing ASCII file (not an INI) for a text value. I don't want to replace the text only record its value.

I haven't seen a way to do this using the provided beans.

This seems like a common enough function so I figure there must be a way to do this.

Am I going to be forced to create this using a custom bean or are there ways to accomplish this?

Thanks in advance,

Rob

robheim
04-28-2003, 04:30 PM
Ok,

I apoligize for that last posting.

I found the answer in the ASCII File Update wizard.

Originally I thought it was only used for updating contents of the ASCII file.

Rob

robheim
05-07-2003, 11:14 AM
Ok, I took a look at the different ASCII File update actions but I'm still stumped.

Here's the situation I've got.

I've got an XML file that I need to check to see if the string it contains is in there (specifically if it is ServicePackLevel="1" or not).

I can find the string but I can't see how I can get the Installation program to know that I've found it. I don't want to update the file just save the knowledge that the string was found (or not).

Any ideas on what I'm missing out there?

Thanks in advance,

Rob

cfraser
05-09-2003, 12:37 PM
I whould think that could use the bean property, TokensNotFound, to determine if the stiing was found i.e. add a condition to other bean(s) that checks to see if the property is set to "No".

robheim
05-09-2003, 12:48 PM
I'm not exactly sure how I'd get to that property.

It does hold the info I need but it isn't a part of the Wizard panel its part of an action that panel causes.

How would I be able to determine its value?

Rob

cfraser
05-09-2003, 01:44 PM
In a Condition for a follow-on bean you could set the check to Must or Must Not Match "No" to suite your purpose. Or in a Custom Bean you could check the value of the Wizard property using the appropriate Method.

robheim
05-09-2003, 02:46 PM
When I look over the API I don't see any attributes stored with the ASCII File Update bean where I could easily build a custom bean to extract this information.

From what I can see the ASCII File Update Wizard Bean talks to the ModifyFile class and the actions defined in the Wizard bean all feed into the ModifyFile class.

I don't see an easy way of getting to the Token flag.

Rob

cfraser
05-09-2003, 03:41 PM
Sorry, I missread the info on ASCII File Update....

robheim
05-14-2003, 10:49 AM
I see there have been a number of different views on this thread but no answers.

Does anyone have any suggestions on how to get around this issue?

Has anyone else run into this situation and resolved it perhaps in a completely different manner?

Thanks,

Rob

phillipb
05-11-2004, 03:30 PM
I am in the same boat as the original person. I have looked at the "ASCII File Update" doc. It doesn't describe any way to read a file as input, only search/replace/delete. Is it possible to use this bean to simply get and set values? Thanks.

bjfrary
05-18-2004, 12:53 PM
I actually had to do a similar thing. Read an xml file and save values. It was further complicated by the fact that the values were on a different line than the variable name.
Our xml had a bunch of settings in the following form

<ParamName>Variable1</ParamName>
<ParamValue>Value1</ParamValue>
<ParamName>Variable2</ParamName>
<ParamValue>Value2</ParamValue>

When I can clean the code up (there is a lot of debug code which is dependant on another bean) I will post it
Barbara