Jump to content
Macro Express Forums

Find And Replace Function?


Linda

Recommended Posts

Hi! I couldn't find anything about this in the help-file.

 

Is there a find-and-replace function in the MacroExpress editor? For instance, if I have a file with 50 references to %T9% and I want to change them all to %T55%, is there a way to do that without changing each one individually?

 

Thanks,

 

Linda

Link to comment
Share on other sites

Ah thanks!

 

I'd forgotten about the Direct Editor screen because the formating was so ugly :unsure: but that doesn't matter for large scale search and replace. :)

 

But is it possible to get the Direct Editor to pretty-print (er, pardon the C++ term) on the screen? When I try to improve the formatting by adding <return> statements, they show up as wierd text things in the Scripting Editor. Is there anyway to add whitespace to the Direct Editor to make it readable without obfuscating the code from the Scripting Editor view?

 

Thanks again,

 

Linda

Link to comment
Share on other sites

Hello Linda!

 

When you view a macro in the Direct Editor, or any text editor, you are looking at it in its natural state. This is the macro. When viewing it from the Scripting Editor, you are seeing a more friendly, human representation. But, it is not the real thing. So, the Scripting Editor is actually the "pretty-print" interface that you referenced.

 

You cannot add formatting to the Direct Editor. Remember that each editor is looking at the same macro in two different ways. When you make a change in one, it will appear in the other (if you save the change).

 

Also, just so you know, you can use an external text editor. But again, you will be working with the macro in its natural state.

Link to comment
Share on other sites

  • 1 year later...

Hi there. I am curious too. Is there any way to do a large scale find and replace. I believe that the Direct Editor Screen is just for one find and replace....and I need to find a word that is repeated about 100 times in a document and deleting that word. Is there a way to do that?

 

Thanks.

Rachel

Link to comment
Share on other sites

Thanks. I am very much confused I think. It seems to me that the search all screen is just to search the script within MacroExpress....however, I want to search a Word Document for a specific word and replace it with another....however, I want to do this on a large scale. Can anybody step me through this process or point me to the correct tutorial for doing this?

 

Thank you...I really want to buy this software...it seems like amazing programming.

 

Thank you!! :huh:

Link to comment
Share on other sites

Dear Kevin. Thank you for your post. I just ordered macros Express and the Library with Codes. I was hoping that there would be an example of the search feature within the library. I just completed the entire tutorial and none of the examples explained how to find and replace. I don't need the macro to open up a word file and save it and close the file...I can just click on a hotkey while I am in the document...I only need it to find and replace. Can you please tell me what the coding would be...I am so sorry, I just can't figure it out. I basically want it to

 

search and replace all words that say 'address' and delete it (or find address and replace it with nothing), find all words that say 'school' and delete it, and find all words that say 'web' and delete it. Is there already an example from the library code that I purchased that I can work with to do something similar to this? Or can you write up a quick example for me?

 

Thank you!!!!!

Rachel :blink:

Link to comment
Share on other sites

Rachel,

 

What you want is the MS Word keystrokes to do a Search and Replace. In Word you would do the following to replace 'address' with an empty string:

- Type Ctrl+f to bring up the Find dialog.

- Type Alt+p to select the Replace tab.

- Type 'address' in the 'Find what' field.

- Type tab to move to the 'Replace with' tab.

- Type the delete key to remove whatever is in the 'Replace with' field.

- Type Alt+a to 'Replace All'.

 

What Macro Express does it to automate what you normally type by hand. Here is an untested macro:

Text Type: <CONTROL>f
Delay 0.25 Seconds
Text Type: <ALT>p
Delay 0.1 Seconds
Text Type: address
Text Type: <TAB>
Delay 0.1 Seconds
Text Type: <DELETE>
Delay 0.1 Seconds
Text Type: <ALT>a

Note the Delay commands between some of the commands. When you press Ctrl+f for example, it may take a moment for Word to bring up the Find/Replace dialog.

 

As I mentioned, I have not tested this. You may need to experiment a bit to get it to work smoothly for you.

 

Another alternative is to Capture a macro. When you Capture a macro you have the option to include the amount of time you take between keystrokes. This may be the most reliable but the macro will run more slowly than a macro written with the Scripting Editor.

 

You might want to set the Scope so this macro only runs when MS Word is running.

 

There might be a shortcut to bring up the Replace dialog. The command may be Alt+p but that is not working for me. You may want to search your MS Word help file to determine the shortcut. If there is a shortcut that brings up the Replace dialog you should be able to simplify the sample macro shown above.

Link to comment
Share on other sites

What you want is the MS Word keystrokes to do a Search and Replace

 

Hi, I must say that MS Word is just about the worst tool for the job, sorry for the expression :-)

 

For that I use UltraEdit, a superb ascii-editor ( www.ultraedit.com ). In UE which have an internal macro language, I have made few hot-keys, that temporarely changes following code example:

<SPMSE:00060><SPKEY:0040><MMW2:132,32><LCLK><MMW2:172,146><LCLK><MMW2:320,79><LCLK><TEXTTYPE:<HOME><DOWN ARROW><DOWN ARROW><ENTER>><MMW2:292,160><LCLK>

 

to:

 

<SPMSE:00060>

<SPKEY:0040>

<MMW2:132,32>

<LCLK>

<MMW2:172,146>

<LCLK>

<MMW2:320,79>

<LCLK>

<TEXTTYPE:<HOME>

<DOWN ARROW>

<DOWN ARROW>

<ENTER>>

<MMW2:292,160>

<LCLK>

 

and back again so ME takes the code directly.

When the code in UE have CR/LF's this can be processed in many ways besides just replace all etc.

 

If anyone are interested I will post the UE macro file for handling ME Direct Code, which so far have following features:

 

CRTL-1 Makes multilines

CRTL-2 Make One line

CRTL-3 Convert LMBD LMBU to LMBclick

CRTL-4 Remove all Delays

CRTL-5 Convert Delay (sec) to Timed Delay (0 cpu)

CRTL-6 Convert Delay (msec) to Timed Delay (0 cpu)

 

best regards Lars

Link to comment
Share on other sites

Rachel said:

I want to search a Word Document for a specific word and replace it with another

Can UltraEdit read and edit Word Document format files?

 

It seems that Linda's requirements differ from Rachel's. Thank you Lars for pointing out that Word is not what Linda would want to use.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...