Author Topic: Macro to surround strings with TEXT(), _T()  (Read 8882 times)

Dan112123

  • Community Member
  • Posts: 44
  • Hero Points: 2
Macro to surround strings with TEXT(), _T()
« on: November 19, 2008, 07:03:36 PM »
Does anyone have a macro that would surround all strings in a file with TEXT(). seems like a very useful macro to have.

Graeme

  • Senior Community Member
  • Posts: 2796
  • Hero Points: 347
Re: Macro to surround strings with TEXT(), _T()
« Reply #1 on: November 19, 2008, 09:06:56 PM »
Try recording one using the color coding option in the find dialog to search for a string, then search for quotes, insert whatever text you want etc.

Graeme
 

Dan112123

  • Community Member
  • Posts: 44
  • Hero Points: 2
Re: Macro to surround strings with TEXT(), _T()
« Reply #2 on: November 19, 2008, 11:48:44 PM »
Not sure what you mean exactly, I've tried several things with color and quotes and non of them give me the results I want. Which is

I have string like this "some string" and after I run the macro I want it to look like this _T("some string"). Note that all of the string are different.

lambertia

  • Senior Community Member
  • Posts: 382
  • Hero Points: 14
  • I have nothing sufficiently witty to say.
Re: Macro to surround strings with TEXT(), _T()
« Reply #3 on: November 20, 2008, 12:56:40 AM »
Just experiment. In a simple case:

  • Start macro recording
  • Open the search dialog
  • Use a regular expressiong search for .+, click the Colour button and select String. Click enter
  • This will take you to a string.
  • Type _TEXT(
  • Hit end
  • Type)
  • Stop recording the macro and save it.

Now replay the macro. It will step through all strings in the file.

This will not work for all cases, its just to give you the jist of it.

Graeme

  • Senior Community Member
  • Posts: 2796
  • Hero Points: 347
Re: Macro to surround strings with TEXT(), _T()
« Reply #4 on: November 20, 2008, 02:41:23 AM »
A slight adjustment to lambertia's list  - instead of "hit end", do a search for "not string" to find the end of the string - the color coding thing lets you do that.

Graeme

lambertia

  • Senior Community Member
  • Posts: 382
  • Hero Points: 14
  • I have nothing sufficiently witty to say.
Re: Macro to surround strings with TEXT(), _T()
« Reply #5 on: November 20, 2008, 02:51:45 AM »
That's nice I didn't know that!