Jump to content

Find and copy the next three text line after space


This topic is 6487 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Hello

I have a field with a huge text file that I brought in so I could automate a process.

I have a certain amount of space then three text lines show up and I want to copy them and place them in another file. Can this be automated with scriptmaker?

There is always different amounts of space between the 3 line text groups

like below for example

The dish ran away with the spoon

Mary had a little lamb

Its fleece was white as snow.

Everywhere that Mary went

The lamb refused to go

not exactly the nursery rhyme

Fee Fi Foe Fum

I smell the blood of

An Englishman.

So as above they are always three lines but varying space between them.

Can something be written to find the next group and copy it.

Thanks

Stan

FileMaker Version: 7

Platform: Mac OS X Panther

Link to comment
Share on other sites

Addendum to that

I need to erase the text that is copied from the first text file - right after it is copied and then capture the next one.

It would be nice if it actually erased the space too that is showing after I remove the three lines of text each time.

I have about 3200 of these 3 line text groups in the big text file.

So it would really help if I were able to do this.

I need to be able to do it within filemaker

Stan

Link to comment
Share on other sites

It's not clear what your goal is.

Let's guess that you have a global field, and you want to parse out every 3 lines out in a looping script.

Middle(YourGlobal,

Position(YourGlobal,

Left(MiddleWords(YourGlobal,1,1,1),1,1),

Position(

YourGlobal,"

Link to comment
Share on other sites

Thank you so much for your time.

I am trying to do it but I get an error

at

EndLoop If[is Empty(Middle(YourGlobal,

Position(YourGlobal,

Left(MiddleWords(YourGlobal,1,1,1),1,1), --- the third comma says too many parameters.

I keep trying things to get rid of it but I am afraid I a screwing it up

STAN

Link to comment
Share on other sites

Hi Ugo,

I had to modify your script a little (must be a difference in US and Non-US versions),

It does end up creating a couple of extra records, so maybe I don't have it right yet. confused.gif

Loop

Exit Loop If []

{

IsEmpty(Middle( YourGlobal ,

Position( YourGlobal ,

Left(MiddleWords( YourGlobal , 1, 1), 1), 1, 1),

Position(

YourGlobal ,"

Link to comment
Share on other sites

Lee,

Glad you could give an eye and debug this one.

I did it a bit quickly and screwed the MidddleWords syntax.

I can't test it actually right now.

If it's given for sure that you'd extract each 3 sentances, then it would be easier to get rid of any par.gif between them.

Loop

EndLoop If[not PatternCount(YourGlobal, "

Link to comment
Share on other sites

I'm more confused now.

Let me explain better (if I can). Your first script as modified by me, provides 5 records from the example given. The first three records have the requested 3 lines of text each. The 4th record has 3 blank lines and the 5th record is blank. It doesn't matter if I start with the text as presented (i.e. with the blank lines between the groups of 3 lines), or remove the extra returns.

The two scripts you just posted. If I run the first one, it doesn't do anything but give me blink by FM. The second script gives me two lines of text in the first record, and inserts a return and a space before the text in YourGlobalField (text itself is not changed). So, I'm sure you meant to insert one or both of these into your previous scripts in some manner?

BTW, the second script has a couple of semicolons where commas should be. See the third line (YourGlobalField;"?";1,gCounter+3) -snip- )

Lee

smile.gif

FileMaker Version: 6

Platform: Mac OS 9

Link to comment
Share on other sites

This topic is 6487 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.