nisus.com
https://www.nisus.com/forum/

How can I change spacing after paragraph with a macro?
https://www.nisus.com/forum/viewtopic.php?f=17&t=2372
Page 1 of 1

Author:  Derick [ 2007-07-05 08:40:35 ]
Post subject:  How can I change spacing after paragraph with a macro?

To clean up some imported documents, I’m trying to write a macro that will set the spacing after a paragraph to 0 pt (they’re getting imported with it set to 12 pt). But as far as I can tell, this setting can only be changed from the Paragraph palette in the Tooldrawer, not from a menu. Does this mean there is no way to access it from a macro?

If not, how can I do this? (please don't send me down the thorny path of UI Applescripting....)

thanks
Derick

Author:  martin [ 2007-07-05 14:23:36 ]
Post subject: 

This seems to be an area where the menus (and thus macros) are somewhat deficient. There is no way to set just the paragraph spacing via a macro. Here's two options:

1. Apply a paragraph style to the text that has the proper spacing (eg: Normal). This should clear any ruler overrides. This obviously won't work if the style has been set to include paragraph spacing.

2. Include formatted text in the macro that has the ruler settings you want. Move that formatted text to the clipboard and then paste the ruler, eg:
Code:
$plain = “text”
Write Clipboard $plain
Paste Ruler


Both of these options will unfortunately affect other ruler properties. I'll file some enhancement requests that makes this job easier.

Author:  js [ 2007-07-09 08:48:19 ]
Post subject: 

This macro did not work and I tried the following:

1. I have an open document with some text
2. I copy some words and edit the clipboard, giving it a shorter ruler
3. I go back to the original window and do Past Ruler

This should paste the edited clipboards ruler to my text, shouldn't it?
Well it doesn't. But if it doesn't how can your macro work?

js

Author:  martin [ 2007-07-09 15:26:56 ]
Post subject: 

Sorry js, I forgot that when you copy/paste a ruler a special system clipboard is used for this purpose. Here's a revised macro that should do the trick:

Code:
# save current selection for later
$selStart = Selection Location
$selLength = Selection Length

# copy the default ruler to the special ruler clipboard
Select All
Select Start
Insert Attributed Text "plain\n"
Remove Attributes and Styles
Copy Ruler
Delete

# apply the ruler to the originally selected text
Set Selection $selStart, $selLength
Paste Ruler

Page 1 of 1 All times are UTC - 8 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/