Extraction usernames from email addresses in order top down

It works! Dear Nigel you the man!
The last thing i need and the script is perfect is this: it is needed even the whole email and has to be correlative to the username, i saw the modification in the txt file is a simple number on the top that grows everytime so the script goes to next line, i copied the script and in one i put “return {mName}” and in the other “return {mAddr}” but of course the script goes on, so given that the usename has to be extracted first, the modify has to be in the second script, the one with “mAddr”, subtracting 1 to the number aforementioned, maybe? (tried simply changing the number from + 1 to - 1, no luck :slight_smile: )
I hope that a last effort can be put to obtain the perfection.

P.S.:I am sorry if you lost some sleep, Nigel, i thank you very much for your effort and even the others for their will to share what they know in very nice and inspiring way, this forum is the best!!!

I just thought if i split the code in 2 i can do the same with the file with mails, i will have the scripts referring to 2 text files, sometimes the solution is in front of your eyes.

Edit: i did it, it works :cool: , you can sleep now, thaaaaaannnk youuuuuuuuu

I LOVE this forum :smiley:

See ya next time, folks.

dear Nigel and Macscripters, i came to have the need to do another operation with your script, to remove the “:” from the line and i did it, but now i need to remove from another file everything from the end of the line up to the “:”

Example

name@domain.xxx:873ujuj
name@domain.yyy:8u3i2p2

the result has to be this:

873ujuj
8u3i2p2

Do you have any idea on how to do it?

Thank you.

Assuming you’re talking the same kind of scenario as above, just change .

text 1 thru ((offset of "@" in mAddr) - 1) of mAddr

. to .

text ((offset of ":" in mAddr) + 1) thru -1 of mAddr

I am trying to understand who you really are Mr Nigel, it worked at the first try, thank you very much, i will call you from now on
[center]Dynamo, coder impossible. LOL[/center]