Jump to content
Macro Express Forums
NeVeR

Find soemthing in a document and copy it out

Recommended Posts

I've many large files over 20000 lines each

In each file there is about 5000 names i need to copy out - names could be different lengths etc.

All the names start with @

So I could tell ME3 to look for that - but I don't know how to tell it to only copy the name and then repeat.

 

Share this post


Link to post
Share on other sites

Probably can be done with command Text File Begin Process, which loops for the entire file and passes one line at a time to a text variable.  Read about it in the Help section.  If you need to copy the whole line starting with @, it's easy.  If you need to copy less than the whole line, the hard part may be where to leave off -- that is, what delineates the end of the name to be copied?  

Show us a couple dozen representative lines; change the names to protect the innocent, if necessary. 

If your files are not text files, then ????

Share this post


Link to post
Share on other sites

How many words in each name? Or does the number of words vary?

If it's a fixed number of words, then selecting the names and copying them may be straightforward. Part of your script might look like this, assuming each name is two words long. (This is in pseudocode, but it's similar to Macro Express code

Type "<CONTROL>f"   // Find
Type "@<ENTER>"     // Search for @ and initiate the search
Type "<ESC>          // Cancel the search
Type "<CONTROL><SHIFT><RIGHT> //  Select the 1st word
Type "<CONTROL><SHIFT><RIGHT> //  Select the 2nd word
Type "<CONTROL>c" // Copy to the clipboard

 

In many text editors, pressing F3 repeats the previous search. In Microsoft Word, the hotkey is Shift + F5. Knowing these factoids might help simplify the project.

Share this post


Link to post
Share on other sites

Paste the names into Excel.

Then use the 'Capture' feature of MacroExpress to demonstrate to Excel how to do one of the names and step to the start of the next name.

Then  use the 'Edit macro' to insert features of the 'Repeat' menu such as 'Repeat start' 'Repeat Counter' and 'Repeat Until'

Share this post


Link to post
Share on other sites

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

×