Reply to topic  [ 8 posts ] 
Insert Line Break 
Author Message

Joined: 2011-04-21 20:35:50
Posts: 4
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?


2011-04-21 20:46:00
Profile
User avatar

Joined: 2007-02-07 00:58:12
Posts: 876
Location: Japan
Type Text "\u2028"

_________________
philip


2011-04-22 02:45:23
Profile

Joined: 2011-04-21 20:35:50
Posts: 4
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'?


2011-04-22 06:33:03
Profile

Joined: 2007-03-03 09:55:06
Posts: 494
Location: Europe
Quote:
wordsmith was asking:
Does anyone know where I can find a list of these unicode numbers?

Hello, wordsmith. I hope these suggestion will be of help.

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.


2011-04-22 07:36:29
Profile

Joined: 2011-04-21 20:35:50
Posts: 4
Thanks for that too, Groucho. I'm slowly finding my feet, having written Word macros for years but not being very familiar with Perl.


2011-04-22 07:54:18
Profile
Official Nisus Person
User avatar

Joined: 2002-07-11 17:14:10
Posts: 4251
Location: San Diego, CA
wordsmith wrote:
Does anyone know where I can find a list of these unicode numbers?

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:
Code:
Type Type '

'

I don't think the forum will have the soft return come through, but hopefully get the idea- you can just type the soft return between the quote marks directly.

Quote:
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'?

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.

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:
Insert Text "\n"
Set Font Name "Times New Roman", true

That 2nd parameter (true), tells NWP to force the font face, in this case plain (not bold).

Alternatively, you could also apply the formatting to your macro string directly, like so:
Code:
Insert Attributed Text "\n"

That's not going to register via the forum so well, but basically you may format your string inside the macro, and then just insert it attributes/formatting and all.


2011-04-22 15:47:03
Profile WWW

Joined: 2008-05-17 04:02:32
Posts: 400
wordsmith wrote:
Immediately before inserting the line break I want to make sure that the text is not bold or italic
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.
Code:
Menu ':Format:Remove Attributes Except Styles'
Type Text "\x{2028}"


2011-04-22 17:33:18
Profile

Joined: 2011-04-21 20:35:50
Posts: 4
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!


2011-04-22 19:37:14
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 8 posts ] 

Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group
Designed by ST Software