Reply to topic  [ 4 posts ] 
How can I change spacing after paragraph with a macro? 
Author Message

Joined: 2007-05-21 08:33:59
Posts: 105
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


2007-07-05 08:40:35
Profile
Official Nisus Person
User avatar

Joined: 2002-07-11 17:14:10
Posts: 4251
Location: San Diego, CA
Post 
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.


2007-07-05 14:23:36
Profile WWW

Joined: 2007-04-12 14:59:36
Posts: 229
Post 
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


2007-07-09 08:48:19
Profile
Official Nisus Person
User avatar

Joined: 2002-07-11 17:14:10
Posts: 4251
Location: San Diego, CA
Post 
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


2007-07-09 15:26:56
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 4 posts ] 

Who is online

Users browsing this forum: No registered users and 3 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:  
Powered by phpBB® Forum Software © phpBB Group
Designed by ST Software