RTF functions

When you load the RTF functions, you can use the following functions with RTF objects:

L
Function Syntax Description
rtfCreate
Id := rtfCreate(Left, Top, Width, Height, "Source", Scrolling, Prevent¬
AutomaticErase, StartPage, EndPage)

This function creates an RTF object with the specified Width and Height on your screen at point (Left, Top) and then reads the RTF document identified by "Source".

This function allows you to set the layer of an RTF Object's position from back to front, relative to other objects on the screen

If StartPage and EndPage are supplied, then this function reads the pages from StartPage to EndPage. Otherwise it reads all pages.

This function returns the RTF object Id if successful; otherwise it returns 0.

Note: This function does not show the object. If you want to display the object in the Authorware Presentation window, you need to call rtfShow() explicitly.

rtfErase
Result := rtfErase(Id)

This function erases the RTF object identified by Id.

This function returns 1 (TRUE) if successful; otherwise it returns 0 (FALSE).

rtfFindText
Result := rtfFindText(Id, StartPos, "TextOrPhrase")

This function searches a given range in the RTF object identified by Id for some specific text or a phrase.

Use this function to search a range of text in an RTF object for some specific text or a phrase. Only the text in the range starting at the position StartPos will be searched.

This function returns the position of the text or phrase, where 0 is the position of the first character in the RTF object. If the text or phrase does not appear in the indicated range, this function returns -1.

rtfGetCurrent¬
Printer
Result := rtfGetCurrent¬
Printer()

This function returns the position of the currently selected printer in the list of installed printers, with the first printer having a value of 1.

Note: the list of installed printers is returned by the rtfGetPrinterNames() function.

rtfGetLinkCode
Result := rtfGetLink¬
Code(Id, Num)

This function returns the code of the hyperlink identified by Num in the RTF object identified by Id.

rtfGetLinkCoor
Result := rtfGetLinkCoor¬
(Id, Num)

This function returns the coordinates of the hyperlink identified by Num in the RTF object identified by Id.

Coordinates are relative to the Authorware Presentation window. The return value is a property list that looks like this:

[#Left:20, #Top:10, #Width:120, #Height:21]

Note: If the RTF object is not visible, this function returns an empty property list.

rtfGetLinkCount
Result := rtfGetLink¬
Count(Id)

This function returns the number of hyperlinks found in the RTF object identified by Id.

rtfGetLinkText
Result := rtfGetLinkText¬
(Id, Num)

This function returns the text of the hyperlink identified by Num in the RTF object identified by Id.

rtfGet¬
Orientation
Result := rtfGet¬
Orientation()

This function returns the currently selected printer orientation:

0: Your RTF document prints vertically on the page (default).

1: Your RTF document prints horizontally on the page.

rtfGetPageCount
Result := rtfGetPage¬
Count("Source")

This function returns the number of pages in the RTF document identified by "Source".

rtfGetPrinter¬
Names
Result := rtfGetPrinter¬
Names()

This function returns a list of all printers installed in Windows.

rtfGetTextRange
Result := rtfGetText¬
Range(Id, StartPos, EndPos)

This function returns the text between StartPos and EndPos for the RTF object identified by Id.

rtfHide
Result := rtfHide(Id)

This function hides the RTF object identified by Id.

This function returns 1 (TRUE) if successful; otherwise it returns 0 (FALSE).

rtfLineFromPos
Result := rtfLineFrom¬
Pos(Id, Position)

This function returns the whole line where the specified linear character position appears for the RTF object identified by Id.

rtfPrint
Result := rtfPrint¬
("Source", MarginLeft, MarginTop, MarginRight, MarginBottom, StartPage, EndPage)

This function prints the RTF document identified by "Source".

Margin parameters specify the dimensions, in 1/1000 inches, of the page size used when printing your RTF document.

If StartPage and EndPage are supplied, then this function prints the pages from StartPage to EndPage; otherwise it prints all pages.

This function returns 1 (TRUE) if successful, otherwise 0 (FALSE).

rtfSave
Result := rtfSave¬
(Id, FileType, "FileName")

This function exports the RTF object identified by Id to the file specified by "FileName".

FileType can be one of these:

0: RTF

1: BMP

2: JPG

3: GIF

This function returns 1 (TRUE) if successful; otherwise it returns 0 (FALSE).

rtfSetCurrent¬
Printer
Result := rtfSetCurrent¬
Printer(Index)

This function sets the currently selected printer.

Index is the printer referenced by its position in the list of installed printers, with the first printer having a value of 1.

Note: The list of installed printers is returned by the rtfGetPrinterNames() function.

This function returns 1 (TRUE) if successful; otherwise it returns 0 (FALSE).

rtfSet¬
Orientation
Result := rtfSet¬
Orientation¬
(Orientation)

This function determines if your RTF document prints vertically or horizontally on a page.

These are the possible values for Orientation:

0: Your RTF document prints vertically on the page (default).

1: Your RTF document prints horizontally on the page.

This function returns 1 (TRUE) if successful; otherwise it returns 0 (FALSE).

rtfShow
Result := rtfShow(Id)

This function displays the RTF object identified by Id.

This function returns 1 (TRUE) if successful; otherwise it returns 0 (FALSE).

rtfUpdate
Result := rtfUpdate(Id)

This function updates the RTF object identified by Id.

This function returns 1 (TRUE) if successful; otherwise, it returns 0 (FALSE).

Changing the text appearance of RTF objects

RTF objects include the ability to dynamically change font face, size, and style through scripting. You can use the following tags to change text style:

Aside from setting the font color as shown above, you can also set the font color using hexadecimal color values, such as {font-color=#FF0000}...{/font-color}.