Is it possible to build a "TOC" of a TXT file?

Help with writing and playing macros

Is it possible to build a "TOC" of a TXT file?

Postby hepabolu » Mon Jan 24, 2005 5:21 pm

Hi,

before considering registering UltraEdit, I need to know if it is possible to build a macro that can build a "table of contents" of a text file similar to a list of functions in a C or Java file.
If it is, can someone please explain roughly how to do this? A typical TXT file contains page breaks and I want to include the first line after a page break in my TOC.

Thanks.
User avatar
hepabolu
Newbie
 
Posts: 3
Joined: Mon Jan 24, 2005 12:00 am

Re: Is it possible to build a "TOC" of a TXT file?

Postby Mofi » Tue Jan 25, 2005 2:16 am

This macro do, what you want. It clears the clipboard and then searches in a loop for the page breaks and appends each line after a page break to the clipboard. After exit of the loop the clipboard contains all headlines. Now you can paste it where you want and reformat it.

InsertMode
ColumnModeOff
HexOff
UnixReOff
ClearClipboard
Loop
Find "^b"
IfFound
Key HOME
SelectLine
CopyAppend
EndSelect
Else
ExitLoop
EndIf
EndLoop
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 4062
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna

Re: Is it possible to build a "TOC" of a TXT file?

Postby hepabolu » Tue Jan 25, 2005 5:11 pm

Thank you very much, but it is not exactly what I'm looking for.

What I like is a sort of list where I can jump to the individual items, like the function list. I've been trying to add a new "language" in the wordfile.txt but I can't get the function strings right.
Do you know how I have to define the function strings to get what I want?

Thank you.
User avatar
hepabolu
Newbie
 
Posts: 3
Joined: Mon Jan 24, 2005 12:00 am

Re: Is it possible to build a "TOC" of a TXT file?

Postby Mofi » Wed Jan 26, 2005 4:56 am

/Function String = "^b[ ]++^(*^)$"

should do it, but it does not. Must be a bug of UltraEdit, because this regular expression works fine at the find command, but displays nothing in the function list. Please report this to IDM via mail, so IDM can solve the problem and you will have what you want in the next version of UltraEdit.
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 4062
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna

Re: Is it possible to build a "TOC" of a TXT file?

Postby hepabolu » Wed Jan 26, 2005 12:54 pm

Thanks. I mailed the problem and got almost instant reply: the find string in the wordfile.txt does not support the page break, but they will consider it for the next version.

Ok, so when is a next version due? :-)
User avatar
hepabolu
Newbie
 
Posts: 3
Joined: Mon Jan 24, 2005 12:00 am

Re: Is it possible to build a "TOC" of a TXT file?

Postby toddm » Thu Jan 27, 2005 9:30 am

Next version is due in February so your feature request probably missed that version.
User avatar
toddm
Advanced User
Advanced User
 
Posts: 83
Joined: Wed Jul 28, 2004 11:00 pm


Return to Macros