Two simple macros for writers.

Everything related to our flagship word processor.
Post Reply
User avatar
loulesko
Posts: 133
Joined: 2008-01-20 11:08:35
Location: California
Contact:

Two simple macros for writers.

Post by loulesko »

Hey there. I wrote these two macros which are working really well for novel and article writing. The first is an insert scene break macro, and the second is scene select macro.

The first places a carriage return and a "#" symbol centered and carriage return to mark the end of scene for novels or end of a section for articles. The macro will prompt you for a scene name and then place it in the Bookmarks with an "EOS" (End of Scene). For example "EOS: Open on a London street".

The second macro enables you to easily select a scene to cut and paste elsewhere. Click on a bookmark to select it. The end of scene mark (#) will be highlighted in the document. The macro then finds the start of the scene based on a previous scene marker. It's smart enough to know the top of the document as well as selecting the whole scene preserving the bookmark. So if you cut the selected scene and then paste it elsewhere the bookmark will re-appear in the Bookmarks window.

This works best if you have the Navigator set to Bookmarks > View By Location in the gear menu at the bottom of the Navigator. To add these macros, copy the code and paste it in a new NWP document, then save it as a macro to your macro folder. Then assign them to a keyboard shortcut.

The # symbol centered is a standard formatting practice for manuscript submission, and I've found my magazine editors like it as well.


Insert Scene Break

Code: Select all

#NisusMacroProperty Name: Insert Scene Break

$name = Prompt Input 'Enter the section/scene name:','','OK',''
	If !$name
		$name = "Untitled Scene"
	End
Type Text "\n"
Menu ":Format:Paragraph Alignment:Center"
Insert Text "#"
Add Bookmark As "EOS: $name"
Select End
Type Text "\n"
Menu ":Format:Paragraph Alignment:Align Left"
Select Scene

Code: Select all

#NisusMacroProperty Name: Select Scene
$selection = Read Selection
#make sure were on a scene mark
If $selection == “#”
$end = Selection Location
Select Start
#find the previous scene mark to determine starting point
Find '^#$', 'Er-Wr'
If selection length
$start = Selection Location
$start = $start + 1
else
#if the find selected nothing we’re at the top, start selection at beginning
$start = 0
end
$doc = Document.active
If $end >= $doc.text.length
$end = $end - 1
end
$range = Range.newWithLocations($start, $end)
TextSelection.setActiveRange($range)
Else
Prompt ‘End of scene mark not selected.’,‘’, ‘OK’
End
germanix
Posts: 4
Joined: 2009-12-05 05:17:47
Location: Germany

Re: Two simple macros for writers.

Post by germanix »

I thank you very much for these macros. They will surely come in handy for me. Have a nice day. :D
User avatar
loulesko
Posts: 133
Joined: 2008-01-20 11:08:35
Location: California
Contact:

Re: Two simple macros for writers.

Post by loulesko »

My pleasure - glad you like them.
Post Reply