Insert Line Break
Insert Line Break
The instruction 'Type Newline' and the escaped character '\n' will insert a new paragraph. I want to insert a line break (Shift+Enter), so how should I specify this please?
Re: Insert Line Break
Many thanks, phspaelti. Just what I needed. Does anyone know where I can find a list of these unicode numbers?
Immediately before inserting the line break I want to make sure that the text is not bold or italic. Is there a specific command for this, or to I have to test to see if it is bold or italic (or both) and then turn it (or them) off if the test returns 'true'?
Immediately before inserting the line break I want to make sure that the text is not bold or italic. Is there a specific command for this, or to I have to test to see if it is bold or italic (or both) and then turn it (or them) off if the test returns 'true'?
Re: Insert Line Break
Hello, wordsmith. I hope these suggestion will be of help.wordsmith was asking:
Does anyone know where I can find a list of these unicode numbers?
1. You can select any character in NWP and then select Edit>Convert>To Unicode Code Points.
or,
2. See this page.
or,
3. Use UnicodeChecker.
or,
4. Open the Special Characters pane (Edit>Special Characters…) from within any Cocoa application or the finder.
Greetings, Henry.
Re: Insert Line Break
Thanks for that too, Groucho. I'm slowly finding my feet, having written Word macros for years but not being very familiar with Perl.
- martin
- Official Nisus Person
- Posts: 5228
- Joined: 2002-07-11 17:14:10
- Location: San Diego, CA
- Contact:
Re: Insert Line Break
Groucho/Henry provided some nice resources, but I also want to mention that you can have a macro insert any text you can type, just by encasing it inside a string. For example, you could use the code:wordsmith wrote:Does anyone know where I can find a list of these unicode numbers?
Code: Select all
Type Type '
'
It's not terribly convenient, but yes, you'll have to test whether bold/italics are on and then turn them off. Unless you happen to know what font you'd like to use.Immediately before inserting the line break I want to make sure that the text is not bold or italic. Is there a specific command for this, or to I have to test to see if it is bold or italic (or both) and then turn it (or them) off if the test returns 'true'?
For example, if you know ahead of time that you want your macro to always insert a newline in plain Times New Roman, you could use the code:
Code: Select all
Insert Text "\n"
Set Font Name "Times New Roman", true
Alternatively, you could also apply the formatting to your macro string directly, like so:
Code: Select all
Insert Attributed Text "\n"
Re: Insert Line Break
Not very clear to me but, if you want to prevent manually applied bold or italic attribute of the preceding text from affecting the text following the soft return, the macro below will do the job.wordsmith wrote:Immediately before inserting the line break I want to make sure that the text is not bold or italic
Code: Select all
Menu ':Format:Remove Attributes Except Styles'
Type Text "\x{2028}"
Re: Insert Line Break
These further comments from martin and kino deal with everything I need for my first useful macro.
kino’s Menu ':Format:Remove Attributes Except Styles' does the job for me, as it makes the macro usable with any document.
From martin’s post, knowing that I can insert what I need by typing it between the quote marks following TypeText is good (elsewhere in the macro I insert an en rule and that’s how I specify that character) but in this case as the soft return is invisible it would not be obvious from the macro code what is going on and it would be better if I added a comment to the code.
Thanks to everyone - will be be back soon no doubt!
kino’s Menu ':Format:Remove Attributes Except Styles' does the job for me, as it makes the macro usable with any document.
From martin’s post, knowing that I can insert what I need by typing it between the quote marks following TypeText is good (elsewhere in the macro I insert an en rule and that’s how I specify that character) but in this case as the soft return is invisible it would not be obvious from the macro code what is going on and it would be better if I added a comment to the code.
Thanks to everyone - will be be back soon no doubt!