Cleaning house using MIF

Situation

Sometimes Frame's regular tools just are not enough to dig in to files . . . to do what you really need to do. This page lists some handy find and replace strings to help clean up a file.

Presentation of code

Each situation presents three components: an example of the MIF you want to change; one or two find strings; and one or two replacement strings. I used two find and two replace strings to show a string with blackslash codes and hex codes. For instance, in the Find and Replace dialog, you can represent a left curly double quote with \` and with \xd2.

In some cases Word strings are provided.

Finally, because spaces may be hard to see, consider copying text from this page to the clipboard.

Removing font overrides that don't do anything

You see these commonly in imported Word documents: a point at which Frame is told to do a manual override, but no instructions are given. WARNING: This string serves a purpose in Frame, in that it acts as an off switch for both character tags and manual character overrides, so I would suggest that you don't use a "find all". If a passage in text turns from "the quick brown fox" to "the quick brown fox", then you removed one between quick and brown that should have remained.

MIF Example

<Font
 <FTag `'>
 <FLocked No>
> # end of Font

Frame Find

<FTag \{\">\p <FLocked No>

or

<FTag \x60\x27>\p <FLocked No>

Word Find

<Font^w^p^w<FTag `'>^p^w<FLocked No>^p^w> # end of Font

Replace

nothing

Removing manual point-size overrides

Good document construction never uses manual overrides to change the point size of a string. This find & replace assumes that you will be using named character tags for all overrides, and that you want to remove all manual overrides, where ever they occur. The following code is an example of a manual point-size override that sets text to 12 points:

Example MIF

<Font
 <FTag `'>
 <FSize 12.0 pt>
 <FLocked No>
> # end of Font

Find

<FTag \{\">\p <FSize 12.0 pt>\p <FLocked No>

or

<FTag \x60\x27>\p <FSize 12.0 pt>\p <FLocked No>

Replace

nothing

Removing the space at the end of a paragraph

Normally you don't concern yourself with spaces are the end of a paragraph. But once in a while you do, such as when you have a number of headings with a space, or when many paragraphs crowd the right margin (sadly, Frame does not ignore a space that's adjacent to the right margin). If you were to search for a [space]\p and replace with a \p in a regular Frame file, the file would be toast, since every paragraph that follows the one with the [space]\p would take on the tag of the one with the [space]\p.

Example MIF

<ParaLine
 <String `and the last line of the paragraph is here.'>
 > # end of ParaLine
> # end of Para

The searches below use a period at the front, but you could leave it off.

Find

. \">\p  > # end of ParaLine\p > # end of Para

or

. \x27>\p  > # end of ParaLine\p > # end of Para

Replace

.\">\p  > # end of ParaLine\p > # end of Para

Replace a string bolded by hand with the Bold character tag

Many users don't bother with using tags for things like bold, italic, or bold italic. But if you do (perhaps the file is destined for online help or other HTML output), then this becomes important. The following example uses a bold manually applied to a Times string.

Also note that there are handy plug-ins that can do this for you. Visit my page "List of handy third-party Frame tools", which is just above Other how to in the left column.

Example MIF

The code will always include explicit font names; this example uses Times:

<Font
 <FTag `'>
 <FPlatformName `W.Times.R.700'>
 <FWeight `Bold'>
 <FPostScriptName `Times-Bold'>
 <FEncoding `FrameRoman'>
 <FLocked No>
> # end of Font

This MIF is the replacement that uses the tag name Bold:

<Font
 <Ftag `Bold'>
 <FLocked No>
> # end of Font

Word find

<FTag `'>^p^w<FPlatformName `W.Times.R.^#00'>^p^w<FWeight `Bold'>^p^w<FPostScriptName `Times-Bold'>^p^w<FEncoding `FrameRoman'>^p^w<FLocked No>^p^w> # end of Font

Word replace

<FTag `Bold'>^p <FLocked No>^p > # end of Font

Frame find

<Font \p <FTag \x60\x27>\p <FPlatformName\x60W.Times.R.[0-9]00\x27>\p <FWeight \x60Bold\x27>\p <FPostScriptName \x60Times-Bold\x27>\p <FEncoding \x60FrameRoman\x27>\p <FLocked No>\p > # end of Font

Frame replace

<Font \p <FTag \x60Bold\x27>\p <FLocked No>\p > # end of Font