Visual Page Break Marco?

General questions about using TextPad

Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard

Post Reply
mferreira
Posts: 1
Joined: Wed May 05, 2004 7:07 pm

Visual Page Break Marco?

Post by mferreira »

We'd like to have some way to visual identify where a page ends and the next one starts. Ideally, we'd like to have the following process.

1) user opens their text file
2) the text file loads into the textpad window
3) as this is happening a macro, textpad setting(or something if possible) visually displays a dashed line across the screen where each page would end/start. (kind of like word in print view).
4) the user's could then manually insert breaks to re-format the paging for their own visual formating.

I know you can manually insert page breaks but the user's don't have time to calculate based on line numbers where the page should break. They would prefer to do something visually.

As well, any way we could reset the line numbers once we're started a new page.


Any help would be appreciated.
User avatar
talleyrand
Posts: 624
Joined: Mon Jul 21, 2003 6:56 pm
Location: Kansas City, MO, USA
Contact:

Post by talleyrand »

Edit
Insert
Page Break
Default keystroke is (ctrl-shift-L)

[edit]Sorry, didn't completely grok your desires on the first pass[/edit]
Perhaps a macro that does something like
Clear current page breaks
1) Search and replace
What: /f
Replace with: (nothing)

And now I'm stuck on how to manually say every X lines add a page break. Perhaps this would be addressed with AutoIt (search the forums and you should have plenty of hits)
I choose to fight with a sack of angry cats.
User avatar
CyberSlug
Posts: 120
Joined: Sat Oct 04, 2003 3:41 am

Post by CyberSlug »

talleyrand wrote:And now I'm stuck on how to manually say every X lines add a page break. Perhaps this would be addressed with AutoIt (search the forums and you should have plenty of hits)
:) AutoIt v3 can be obtained from http://www.hiddensoft.com

You need to create a tool in TextPad (Configure > Preferences > Tools):
Command: "C:\Program Files\AutoIt3\AutoIt3.exe"
Parameters: "break.au3" 68
where 68 is the number of lines per page. You need to adjust this manually depending on your font and margin settings. Do a print preview to dermine the right value.

Code: Select all

; contents of the AutoIt script "break.au3"
AutoItSetOption("SendKeyDelay",10)        ;default is 10 ms
AutoItSetOption("WinWaitDelay",200)       ;default is 250 ms
AutoItSetOption("WinTitleMatchMode",2)	  ;substring

$linesPerPage = 68  ;default value
If $CmdLine[0] = 1 Then
	$linesPerPage = $CmdLine[1]
EndIf

; Get # of lines in the document via select all and reading status bar
WinMenuSelectItem("TextPad", "", "&Edit", "&Select All")
$n = StringTrimRight( ControlGetText("TextPad","","HSStatusBar1") , 15)
Send("{Left}") ;UNselect all

$line = $linesPerPage+1
While $line < $n

	sleep(50)
 	WinMenuSelectItem("TextPad", "", "&Search", "&Go To..." )
	Send($line & "{ENTER}")

	WinWaitClose("Go To")
	WinMenuSelectItem("TextPad", "", "&Edit", "&Insert", "&Page Break")
	$line = $line + $linesPerPage 
WEnd
This works for me but keep in mind that putting each linebreak adds a separate entry to the UNDO buffer.
Also, the linebreaks do not automatically ajust if you add or delete lines.

What the script does:
1) determine number of lines in files
2) jumps to next line appropriate line number
3) inserts a page break
4) repeats until end-of-file
Post Reply