Application (object)

<< Click to Display Table of Contents >>

Application (object)

Access path: Application

 1  Description

Application is the "root object" for all other objects in TextMaker. It is the central control object that is used to carry out the whole communication between your Basic script and TextMaker.

 2  Access to the object

There is exactly one instance of the Application object. It is available during the whole time that TextMaker is running and accessed directly through the object variable returned by the CreateObject function:

Set tm = CreateObject("TextMaker.Application")

MsgBox tm.Application.Name

As Application is the default property of TextMaker, it can generally be omitted:

Set tm = CreateObject("TextMaker.Application")

MsgBox tm.Name ' has the same meaning as tm.Application.Name

 3  Properties, objects, collections and methods

Properties:

FullName R/O

Name R/O (default property)

Path R/O

Build R/O

Bits R/O

Visible

Caption R/O

Left

Top

Width

Height

WindowState

DisplayScrollBars

 

Objects:

ActiveDocument Document

ActiveWindow Window

Options Options

UserProperties UserProperties

CommandBars CommandBars

AutoCorrect AutoCorrect

Application Application

 

Collections:

Documents Documents

Windows Windows

RecentFiles RecentFiles

FontNames FontNames

 

Methods:

CentimetersToPoints

MillimetersToPoints

InchesToPoints

PicasToPoints

LinesToPoints

Activate

Quit

FullName (property, R/O)

Data type: String

Returns the name and path of the program (e.g. "C:\Program Files\SoftMaker Office\TextMaker.exe").

Name (property, R/O)

Data type: String

Returns the name of the program, in this case "TextMaker".

Path (property, R/O)

Data type: String

Returns the path of the program, for example "C:\Program Files\SoftMaker Office\".

Build (property, R/O)

Data type: String

Returns the build number of the program as a string, for example "1000".

Bits (property, R/O)

Data type: String

Returns a string with the "bitness" of the program: "32" for the 32-bit version of TextMaker and "64" for the 64 bit version.

Visible (property)

Data type: Boolean

Gets or sets the visibility of the program window:

tm.Application.Visible = True ' TextMaker becomes visible

tm.Application.Visible = False ' TextMaker becomes be invisible

Important: By default, Visible is set to False – thus, TextMaker is initially invisible until you explicitly make it visible.

Caption (property, R/O)

Data type: String

Returns a string with the contents of the title bar of the program window (e.g. "TextMaker - Readme.tmdx").

Left (property)        

Data type: Long

Gets or sets the horizontal position (= left edge) of the program window on the screen, measured in screen pixels.

Top (property)

Data type: Long

Gets or sets the vertical position (= top edge) of the program window on the screen, measured in screen pixels.

Width (property)

Data type: Long

Gets or sets the width of the program window on the screen, measured in screen pixels.

Height (property)

Data type: Long

Gets or sets the height of the program window on the screen, measured in screen pixels.

WindowState (property)

Data type: Long (SmoWindowState)

Gets or sets the current state of the program window. The possible values are:

smoWindowStateNormal   = 1 ' normal

smoWindowStateMinimize = 2 ' minimized

smoWindowStateMaximize = 3 ' maximized

DisplayScrollBars (property)

Data type: Boolean

Gets or sets the option which indicates whether the document is shown with both a horizontal and a vertical scrollbar.

ActiveDocument (pointer to object)

Data type: Object

Returns the currently active Document object that you can use to access the active document.

ActiveWindow (pointer to object)

Data type: Object

Returns the currently active Window object that you can use to access the active document window.

Options (pointer to object)

Data type: Object

Returns the Options object that you can use to access global program settings of TextMaker.

UserProperties (pointer to object)

Data type: Object

Returns the UserProperties object that you can use to access the name and address of the user (as entered on the General tab of the ribbon command File | Options).

CommandBars (pointer to object)

Data type: Object

Returns the CommandBars object that you can use to access the toolbars of TextMaker.

Note: Toolbars work only in classic mode. They do not work with ribbons.

AutoCorrect (pointer to object)

Data type: Object

Returns the AutoCorrect object that you can use to access the automatic correction settings of TextMaker.

Application (pointer to object)

Data type: Object

Returns the Application object, i.e. the pointer to itself. This object pointer is basically superfluous and only provided for the sake of completeness.

Documents (pointer to collection)

Data type: Object

Returns the Documents collection, a collection of all currently open documents.

Windows (pointer to collection)

Data type: Object

Returns the Windows collection, a collection of all currently open document windows.

RecentFiles (pointer to collection)

Data type: Object

Returns the RecentFiles collection, a collection of the recently opened documents (as displayed at the bottom of TextMaker's File menu).

FontNames (pointer to collection)

Data type: Object

Returns the FontNames collection, a collection of all installed fonts.

CentimetersToPoints (method)

Converts the given value from centimeters (cm) to points (pt). This function is useful when you make calculations in centimeters, but a TextMaker function accepts only points as its measurement unit.

Syntax:

 CentimetersToPoints(Centimeters)

Parameters:

Centimeters (type: Single) specifies the value to be converted.

Return type:

Single

Example:

' Set the top margin of the active document to 3cm

tm.ActiveDocument.PageSetup.TopMargin = tm.Application.CentimetersToPoints(3)

MillimetersToPoints (method)

Converts the given value from millimeters (mm) to points (pt). This function is useful if you make calculations in millimeters, but a TextMaker function accepts only points as its measurement unit.

Syntax:

 MillimetersToPoints(Millimeters)

Parameters:

Millimeters (type: Single) specifies the value to be converted.

Return type:

Single

Example:

' Set the top margin of the active document to 30mm

tm.ActiveDocument.PageSetup.TopMargin = tm.Application.MillimetersToPoints(30)

InchesToPoints (method)

Converts the given value from inches to points (pt). This function is useful if you make calculations in inches, but a TextMaker function accepts only points as its measurement unit.

Syntax:

 InchesToPoints(Inches)

Parameters:

Inches (type: Single) specifies the value to be converted.

Return type:

Single

Example:

' Set the bottom margin of the active document to 1 inch

tm.ActiveDocument.PageSetup.BottomMargin = tm.Application.InchesToPoints(1)

PicasToPoints (method)

Converts the given value from picas to points (pt). This function is useful if you make calculations in picas, but a TextMaker function accepts only points as its measurement unit.

Syntax:

 PicasToPoints(Picas)

Parameters:

Picas (type: Single) specifies the value to be converted.

Return type:

Single

Example:

' Set the bottom margin of the active document to 6 picas

tm.ActiveDocument.PageSetup.BottomMargin = tm.Application.PicasToPoints(6)

LinesToPoints (method)

Identical to the PicasToPoints method (see there).

Syntax:

 LinesToPoints(Lines)

Parameters:

Lines (type: Single) specifies the value to be converted.

Return type:

Single

Example:

' Set the bottom margin of the active document to 6 picas

tm.ActiveDocument.PageSetup.BottomMargin = tm.Application.LinesToPoints(6)

Activate (method)

Brings the program window to the foreground and sets the focus to it.

Syntax:

 Activate

Parameters:

none

Return type:

none

Example:

' Bring TextMaker to the foreground

tm.Application.Activate

Note: This command is only successful if Application.Visible = True.

Quit (method)

Ends the program.

Syntax:

 Quit

Parameters:

none

Return type:

none

Example:

' End TextMaker

tm.Application.Quit

If there are any unsaved documents open, the user will be asked if they should be saved. If you want to avoid this question, you need to either close all opened documents in your program or set the property Saved for the documents to True (see Document).