Page 1 of 1

Macro request

Posted: 2014-05-07 01:54:58
by useeger
Dear NW Pro community,

I am not skilled enough to write macros, therefore I would appreciate it very much if one could solve the following problem for me.

I have a very large document with sequences in it like

[return]
A[space]B[space]C[tab][text]
[return]
A[space]B[space]C[tab][text]
[return]
A[space]B[space]C[tab][text]
[return]
and so on

A, B, C are single characters, letters or strange glyphs like ʕ,Ṭ, ʔ, Ǧ , Ḏ , Ḏ̣ (which is a combined sign) and suchlike. Not necessaryly there are exact 3 characters between, [return] and [tab], maybe there are only 2 characters or more than 3 characters seperated by a [space], but not more than 9 characters.

I am looking now for 2 macros. The first one should remove all spaces in these sequences between the characters.

The second one should afterwards do the opposite, what means to add spaces in the sequences which are now without spaces.

Thanks for help!

Re: Macro request

Posted: 2014-05-07 05:36:29
by phspaelti
Let me see if I understand your request correctly: The paragraphs in your file start with between 2 and 9 alphabetic characters followed by a tab and some text. You want to add/remove spaces between these alphabetic characters.

This is not really a macro task, but rather a Powerfind Pro task. However the indeterminate number of characters and the need to add/remove spaces for each character do make it a bit tricky. So I guess a macro does work best after all. So try the following and see if they do what you want.
Useeger Add Spaces.nwm
(16.22 KiB) Downloaded 814 times
Useeger Remove Spaces.nwm
(16.21 KiB) Downloaded 816 times

Re: Macro request

Posted: 2014-05-07 06:59:08
by useeger
Dear Philip,

"Remove Spaces" works fast and perfect. Splendid!

"Add Spaces" has a problem with the sign Ḏ̣ which is a combined charakter out of Ḏ and a dot under it. After the execution of the macro the Ḏ̣ is splitted to a Ḏ followed by a space with a dot under it, like Ḏ ̣

If it is difficult to change that, no problem, this can be afterwards easily corrected by a simple find-replace procedure.

Thank you very much!

Re: Macro request

Posted: 2014-05-07 08:29:38
by phspaelti
useeger wrote:"Add Spaces" has a problem with the sign Ḏ̣ which is a combined charakter out of Ḏ and a dot under it. After the execution of the macro the Ḏ̣ is splitted to a Ḏ followed by a space with a dot under it, like Ḏ ̣

If it is difficult to change that, no problem, this can be afterwards easily corrected by a simple find-replace procedure.
I was going to say that it would be easy to change, but after thinking about it I can't think of an easy way to modify the macro to do this. So the simple find/replace you suggest is probably the best idea. You can also add that simple find/replace as a line to the end of macro.

useeger wrote:Thank you very much!
Your welcome.

Re: Macro request

Posted: 2014-05-07 08:54:49
by useeger
phspaelti wrote:You can also add that simple find/replace as a line to the end of macro.
Did it. Now it does exactly what I wanted and saves me a lot of time. Thanks again!