MyBASIC2 Script Language  -  Lite and Standard Editions

Previous  Next

 

Most of the features in MaxTRAQ can be controlled using MyBASIC2 function calls.  Parameters to the functions can be constants or standard MyBASIC2 variables.  The entire language of MyBASIC2 is available including extension libraries and making external calls into the operating system.  By using ScriptBars you can create complete turn-key systems and make MaxTRAQ even more easy to use for novice users.  You can also automate repetitive tasks and create/restore different environments for different tasks.

 

The following is a list of available function calls.  They are sorted by the objects they operate on.  Each object uses their own MyBASIC2 Namespace so that you can use WITH..ENDWITH.  Functions that operates on objects such as create/delete etc., sets a property or value or invokes a dialog will return the completion status of 0 if successful.  Otherwise it will return an error code.  Errors such as bad parameters are signalled uisng MyBASIC2 error processing.  Functions that return a property or value will return the appropriate data type.  This will vary depending on the function.  See the table below.  All frames, points and object numbers are 1 indexed (first element is always 1).  You can use TRUE or FALSE or 0/1 for INTEGERs that define a state (boolean) value.  See MyBASIC2 documentation for more information about data types.

 

To make full use of MyBASIC2 scrfipting, it is recommended that you download and install the MyBASCI2 Developers IDE from our web-site.  This IDE will install the following include files:

 

MaxTRAQ.mqb

MaxTRAQ.mqc

MaxTRAQ_Widgets.mqb

MaxTRAQ_Widgets.mqc

 

These include files contains constants for most of the parameters that requires a type or property string as well as error codes.

 

Here are a MyBASIC2 Script Example, and another one and the defined MaxTRAQ constants.

 

Available Objects

Angle

App

Caliper

Channel

Com

Data

Distance

Dlg

File

Graph

Grid

Note

Options

Point

Projected

Recorder

Scale

Stick

Video

Widget

 

MaxTRAQ Function Calls sorted by Objects

Object: ANGLE

Angle.Create

( nType AS INTEGER,
strName AS STRING,
nPoint1 AS INTEGER,
nPoint2 AS INTEGER,
nPoint3 AS INTEGER,
nPoint4 AS INTEGER )

INTEGER
(0 = Success)

Create an angle named strName using specified points.  The type is specified as:

2 = 2 point angle (point3 and point4 not used)
3 = 3 point angle (point4 not used)
4 = 4 point angle

Angle.Delete

( nAngle AS INTEGER )

INTEGER
(0 = Success)

Deletes the Angle specified by the nAngle parameter.

Angle.Get

( nFrame AS INTEGER,
nAngle AS INTEGER )

REAL

Returns the value of the angle specified by frame and angle number.

Angle.GetName

( nAngle AS INTEGER )

STRING

Get the name of the angle specified by the angle number.

Angle.GetNoOf

( )

INTEGER

Get the number of angles created.

Angle.GetNumber

( strName AS STRING )

INTEGER

Get the angle number of the named angle.

Angle.GetVisible

( nAngle AS INTEGER )

INTEGER

Returns TRUE if the specified angle is visible otherwise FALSE.

Angle.Invoke

( )

INTEGER
(0 = Success)

Invokes the angle tool and displays the angle tool dialog

Angle.SetName

( nAngle AS INTEGER,
strAngle AS STRING )

INTEGER
(0 = Success)

Sets the name of the specified angle.

Angle.SetVisible

( nAngle AS INTEGER,
nState AS INTEGER )

INTEGER
(0 = Success)

Sets the visible state of the specified angle

Object: APP

App.About

( )

INTEGER

Displays the Applications About box.  This is the same as using Help->About from the application.

App.Abort

( )

INTEGER
(0 = Success)

Aborts the current script and returns with ERR_SS_ABORT.

App.EnableEvents

( nEventMask AS INTEGER )

INTEGER
(0 = Success)

Enables or Disables events using the nEventMask parameter.  Each event is identified by the corresponding bit.  To enable event 1, you need to set bit 1 (0x00000001), for event 2, bit2 and so on.  Any bit set to 0 will be disabled.

App.Exit

( [bSaveChanges AS INTEGER=TRUE] )

 

Terminates the application.  If bSaveChanges is set to TRUE (Default), the app will prompt to save any modified files before exiting.

App.Function

( nFunctionKey AS INTEGER )

INTEGER
(0 = Success)

Executes function key nFunctionKey.  The function keys are numbered 1 through 8 (F1..F8) for user defined and 9 through 16 (F9..F16) for system functions.

App.GetCurrentEvent

( bClearEvent AS INTEGER )

INTEGER

Returns the current event with the first event being 1.  If no events is being processed, the function returns 0.

App.GetInfo

( strInfo AS STRING )

STRING

Returns information about the MaxTRAQ application.  The following information can be retrieved:

"edition"
"company"
"name"
"folder"
"path"
"version"
"oem"
"license"

App.GetInstance

( )

INTEGER

Get the MaxTRAQ instance number with the first instance being 0

App.GetMode

( )

INTEGER

Returns the current application mode.  The 2 modes are:

1 = Recording Mode
2 = Tracking Mode

App.GetMultiView

( )

INTEGER

Returns the state of MultiView for the current instance.

App.GetWindow

( [strType AS STRING=NULL] )

HANDLE

Returns a Windows HANDLE to one of the following windows:

"application" (Default)
"tracker"
"recorder"

If the specified window is not available, the function returns NULL.

App.IsMaster

( )

INTEGER

Returns TRUE if current instance of MaxTRAQ is a Master

App.LogFile

( strMessage AS STRING )

INTEGER

This is for internal debugging only.  Outputs a string to the current MaxTRAQ LogFile.

App.MsgBox

( strMessage AS STRING,
[nType AS INTEGER=0] )

INTEGER

Displays a windows message box.  The type can be one of
0 = OK with ICON Exclamation (Default)
1 = OK with ICON Information
2 = OK/CANCEL with ICON Exclamation
3 = OK/CANCEL with ICON Information

The function will return
0 = ERR_SUCCESS , User pressed OK
1 = ERR_CANCEL, User pressed CANCEL

App.Run

( strApplication AS STRING,
strParameters AS STRING )

INTEGER
(0 = Success)

Runs an external application with the specified parameters.  The strParameters string may contain Substitute Variables.

App.ScriptBar

( strFolder AS STRING,
strName AS STRING )

INTEGER
(0 = Success)

Loads or Hides a ScriptBar from specified folder.  If the strFolder parameters is empty or NULL then it will try to load strName persisten ScriptBar.  If both parameters are omitted or NULL, then the current ScripBar is unloaded/hidden.

App.SendMessage

( nWindow AS INTEGER,
nMessage AS INTEGER,
wParam AS INTEGER,
lParam AS INTEGER )

INTEGER

This is a low level Windows interface used to send Windows messages to the specified nWindow retrieved by App.GetWindow().

App.SetMultiView

( bState AS INTEGER )

INTEGER
(0 = Success)

Sets the state of MultiView for the current instance to on or off.

App.SetShortcutKey

( nCtrl AS INTEGER,
cKey AS INTEGER,
strScriptFile AS STRING )

INTEGER
(0 = Success)

Set a shortcutkey to run a scriptfile.  The nCtrl is a mask where each of the following bits correspond to one of the control keys:

CTRL_VK_SHIFT = 0x00000001
CTRL_VK_CONTROL = 0x00000002
CTRL_VK_ALT = 0x00000004

You can combine any of these as needed by adding them together.  The cKey parameter is a single keyboard key code.  You can use ASC( "H" ) if using one of the character keys.  The last parameters is the script file to run.

For a list of key codes see Virtual-Keys

App.StatusText

( strText AS STRING )

INTEGER
(0 = Success)

Displays strText in the status bar.

App.View

( strProperty AS STRING,
nState AS INTEGER )

INTEGER
(0 = Success)

Set the state of the specified view property.  The property parameter is specified as one of the following:

"Checkboxes"
"Continuous"
"Graph"
"Grid"
"Scalenumbers"
"Timedisplay"
"Trackingoutline"
"Zoom"
"Sidebar"
"Toolbar"
"Menubar"
"Widgetbar"
"MultiViewbar"
"Functionbar"
"Statusbar"

For Zoom, the state parameter specifies one of the zoom levels below.  For all others 0 = off and 1 = on.

Zoom Levels:

0 = Scale Image
1 = Keep Aspect
2 = Original Size

Object: CALIPER

Caliper.Get

( nType AS INTEGER )

REAL

Returns the value of the specified caliper.  Calipers are specified as:

0 = Horizontal
1 = Vertical

Caliper.GetVisible

( nType AS INTEGER )

INTEGER

Returns TRUE if the specified caliper is visible otherwise FALSE.  Calipers are specified as:

0 = Horizontal
1 = Vertical

Caliper.SetVisible

( nType AS INTEGER,
bState AS INTEGER )

INTEGER
(0 = Success)

Sets the visible state of the specified caliper.  Calipers are specified as:

0 = Horizontal
1 = Vertical

Object: CHANNEL

Channel.Get

( nFrame AS INTEGER,
nChan AS INTEGER )

REAL

Get the value of the specified channel in the current data section at the specified frame.

Channel.GetName

( nChan AS INTEGER )

STRING

Reurns the channel name for the specified channel number

Channel.GetNoOf

( )

INTEGER

Get the number of channels in the current data section.

Channel.GetNumber

( strName AS STRING )

INTEGER

Get the channel number for the specified channel name.

Channel.GetVisible

( nChan AS INTEGER )

INTEGER

Returns TRUE if the specified channel is visible otherwise FALSE.

Channel.Set

( nFrame AS INTEGER,
nChan AS INTEGER,
fValue AS REAL )

INTEGER
(0 = Success)

Sets the value of yje specified channel in the current data section at the specified frame

Channel.SetName

( nChan AS INTEGER,
strName AS STRING )

INTEGER
(0 = Success)

Set the channel name for the channel number

Channel.SetVisible

( nChan AS INTEGER
bState AS INTEGER )

INTEGER
(0 = Success)

Sets the visible state of the specified channel.

Object: COM

Com.Invoke

( )

INTEGER
(0 = Success)

Invokes the COM tool and displays the COM tool dialog.

Object: DATA

Data.Create

( strName AS STRING,
nChannels AS INTEGER,
nSamples AS INTEGER,
nFrequency AS INTEGER,
strUnits AS STRING )

INTEGER
(0 = Success)

Creates a data section to store external data such as analog, force or EMG.  Specify the number of channel, no of samples, sample frequency and the units.

Sections are identified by names or numbers.  First section is 1.

Data.Delete

( nSection AS INTEGER )

INTEGER
(0 = Success)

Delete specified data section.

Data.GetCurrent

( )

INTEGER

Returns the current data section

Data.GetFrameRate

( nSection AS INTEGER )

INTEGER

Get the frame rate of the specified data section.

Data.GetName

( nSection AS INTEGER )

STRING

Returns the name of the specified section number.

Data.GetNoOf

( )

INTEGER

Returns the number of data sections

Data.GetNoOfFrames

( nSection AS INTEGER )

INTEGER

Returns the number of frames in the specified data section

Data.GetNumber

( strName AS STRING )

INTEGER

Get the section number for the named section

Data.GetUnits

( nSection AS INTEGER )

STRING

Returns the units as a string of the specified data section

Data.SetCurrent

( nSection AS INTEGER )

INTEGER
(0 = Success)

Sets the current data section

Object: DISTANCE

Distance.Create

( nType AS INTEGER,
strName AS STRING,
nPoint1 AS INTEGER,
nPoint2 AS INTEGER )

INTEGER
(0 = Success)

Create a distance named strName using specified points.  The type is specified as:

1 = Distance from origin to point1 (nPoint2 not used)
2 = Distance between the point1 and nPoint2

Distance.Delete

( nDistance AS INTEGER )

INTEGER
(0 = Success)

Delete the specified distance.

Distance.Get

( nFrame AS INTEGER,
nDistance AS INTEGER )

REAL

Returns the value of the distance specified by frame and distance number.

Distance.GetName

( nDistance AS INTEGER )

STRING

Returns the name of the distance specified by the distance number.

Distance.GetNoOf

( )

INTEGER

Returns the number of distances created.

Distance.GetNumber

( strName AS STRING )

INTEGER

Returns the distance number for the named distance

Distance.GetVisible

( nDistance AS INTEGER )

INTEGER

Returns TRUE if the specified Distance is visible otherwise FALSE

Distance.Invoke

( )

INTEGER
(0 = Success)

Invokes the Distance tool and displays the Distance tool dialog

Distance.SetName

( nDistance AS INTEGER,
strName AS STRING )

INTEGER
(0 = Success)

Sets the name of the specified distance.

Distance.SetVisible

( nDistance AS INTEGER,
bState AS INTEGER )

INTEGER
(0 = Success)

Sets the visible state of the specified distance

Object: DLG

Dlg.FileProperties

( )

INTEGER
(0 = Success)

Displays the file property dialog.

Dlg.Options

( nPageNumber AS INTEGER )

INTEGER
(0 = Success)

Displays the Options Dialog and selects the options page specified as nPageNumber.

Dlg.Recorder

( nDialog AS INTEGER )

INTEGER
(0 = Success)

Display one of the camera control, setup or information dialogs.  Type can be one of:

1 = Camera Control
2 = Camera Setup
3 = Video Format
4 = Camera Status/Information

Dlg.Subject

( )

INTEGER
(0 = Success)

Display the Subject Information dialog.

Object: FILE

File.Close

( [bSaveChanges AS INTEGER=TRUE] )

INTEGER
(0 = Success)

Closes the current file and prompts to save file if it has been modified.  You can discharge changes by setting the bSaveChanges parameters to FALSE.

File.Exists

( strFileName AS STRING )

INTEGER

Returns TRUE if specified file exists otherwise returns FALSE.

File.GetDescription

( )

STRING

Returns the file description as a string.  This can be a XML formatted string if you have set the Subject Information.

File.GetFolder

( )

STRING

Returns the current document folder.

File.GetModified

( )

INTEGER

Returns the file modified status. This status indicates that you have modified the file since it was last saved.

File.GetName

( nFileType AS INTEGER,
[strOptions AS STRING=NULL] )

STRING

Returns the name or a portion of the name of the currently opened file.  The file type can be one of the following:

0 = Data File (MQF)
1 = Video File (AVI)

You can specify to return only a portion of the file name.  By default, the entire path is returned.  Specify one of the following return types:

"name"
"extension"
"folder"
"drive"
"noextension"

File.Import

( strFileName AS STRING,
[strTemplate AS STRING=NULL],
[strSubstitute AS STRING=NULL] )

INTEGER
(0 = Success)

Imports a file with external data such as analog data.  Currently MaxTRAQ supports import of MaxDAQ files and Motus Global Baseball Files.  The strTemplate and strSubstitute can be used to replace parts of the filename such as an extension with the strSubstitute string.  For example;
File.Import( "Kalle.MQF", ".MQF", ".MDQ" ) will reaplce the extension MGF with MDQ before importing the file.

External data are imported into data sections.

File.IsOpen

( )

INTEGER

Returns TRUE if a file has been opened.

File.New

( nType AS INTEGER )

INTEGER
(0 = Success)

Creates a new file.  The file can be a new tracking or a new recording depending on the type.  This is the same as File->New menu.  The type can be one of the following:

0 = Tracking
1 = Recording

File.Open

( [strFileName AS STRING=NULL],
[bBroadCast AS INTEGER=FALSE] )

INTEGER
(0 = Success)

Opens a file.  This can be any of he files that MaxTRAQ recognizes.  If you omit the filename, the function prompt to open a file.  Specift TRUE to bradcast the open function to all instances connected by MultiView.

File.Print

( [strTemplate AS STRING=NULL],
[nPrintType AS INTEGER=0] )

INTEGER
(0 = Success)

Prints the current file by using the optional print template.  The type of printing can be one of the following:

0 = Print with standard Print Dialog
1 = Print to current printer without Print Dialog
2 = Print Preview
3 = Print to PDF

File.Save

( )

INTEGER
(0 = Success)

Saves the current file.  If the file has not yet been named, then it will use SaveAs instead to prompt for file name.

File.SaveAs

( [strFileName AS STRING=NULL] )

INTEGER
(0 = Success)

Saves the current file to the supplied file name.  If the file name is omitted, the the File Save As dialog is displayed.

File.SetDescription

( strDescription AS STRING )

INTEGER
(0 = Success)

Sets the file description.  This can be a XML formatted string to use as Subject Information.

File.SetFolder

( strFolder AS STRING )

INTEGER

Sets the current document folder to strFolder.  This can contain any of the following Substitute Variables:

%AppFolder%
%CurrentDocFolder%
%FileName%
%Subject%
%SubjectFolder%
%Time%
%Date%
%Year%
%Month%
%Day%
%Hour%
%Min%
%Sec%

If you specify "?" as the folder, a dialog will be displayed end the function will return ERR_CANCEL.if the user pressed CANCEL otherwise the function will return ERR_SUCCESS.

File.SetModified

( bModified AS INTEGER )

INTEGER
(0 = Success)

Sets the file modified status on or off.  If this status is set to off, neither App.Exit or File.Close will prompt to save and any changes to the file will be discharged.

Object: GRAPH

Graph.GetCurrent

( )

INTEGER

Returns the currently selected graph type.  See Graph.SetCurrent for a list of types.

Graph.GetNoOf

( )

INTEGER

Get the numbers of curves in the graph.

Graph.GetVisible

( nCurve AS INTEGER )

INTEGER

Returns TRUE if the specified Curve is visible otherwise FALSE

Graph.Redraw

( [bRedraw AS INTEGER=TRUE] )

INTEGER
(0 = Success)

Redraws/Updates the graph.

Graph.SetCurrent

( nGraph AS INTEGER )

INTEGER
(0 = Success)

Sets the graph to one of the following types:

0 = None Selected
1 ="X Position vs Time
2 = Y Position vs Time
3 = X Velocity vs Time
4 = Y Velocity vs Time
5 = X Acceleration vs Time
6 = Y Acceleration vs Time
7 = Distance vs Time
8 = Angle vs Time
9 = Analog vs Time
10 = Force vs Time

Graph.SetVisible

( nCurve AS INTEGER,
bState AS INTEGER )

INTEGER
(0 = Success)

Sets the visible state to on or off for the specified Curve.

Object: Grid

Grid.Create

( nFrame AS INTEGER,
nVertical AS INTEGER,
nHorizontal AS INTEGER,
x1 AS INTEGER,
y1 AS INTEGER,
x2 AS INTEGER,
y2 AS INTEGER )

INTEGER
(0 = Success)

Creates a new grid in specified frame using the default grid properties.  The position of the grid is specifed in pixels as X1/Y1 as upper left corner and X2/Y2 as lower right corner. 

Grid.Delete

( nGrid AS INTEGER )

INTEGER
(0 = Success)

Delete the specified grid

Grid.GetNoOf

( )

INTEGER

Returns the number grids

Grid.Invoke

( )

INTEGER
(0 = Success)

Invokes the Grid tool and displays the Grid tool dialog

Object: NOTE

Note.Create

( nFirstFrame AS INTEGER,
nLastFrame AS INTEGER,
x1 AS INTEGER,
y1 AS INTEGER,
x2 AS INTEGER,
y2 AS INTEGER,
x3 AS INTEGER,
y3 AS INTEGER,
strText AS STRING )

INTEGER
(0 = Success)

Create a note with the specified text in frame frameno.  If frameno is set to -1, the note is created in all frames, if frameno is set to 0, it is created in the current frame otherwise it is created in the specified frame..  The location and size is specified as:

x1 = x coordinate of pointer
y1 = y coordinate of pointer
x2 = y coordinate of left side of note
y2 = y coordinate of top of note
x3 = x coordinate of right side of note
y3 = y coordinate of bottom of note

Note that frameno is using the setting of Video.SetOffsetT0.

Note.Delete

( nNote AS INTEGER )

INTEGER
(0 = Success)

Delete the specified note

Note.Get

( nNote AS INTEGER )

STRING

Return the note text

Note.GetNoOf

( )

INTEGER

Get the number of notes

Note.Invoke

( )

INTEGER
(0 = Success)

Invokes the Note tool and displays the Note tool dialog

Object: OPTIONS

Options.Grid

( nGrid AS INTEGER,
nLineWidth AS INTEGER,
nLineType AS INTEGER,
nVert AS INTEGER,
nHoriz AS INTEGER,
fgColor AS INTEGER,
bgColor AS INTEGER )

INTEGER
(0 = Success)

Sets the grid options for nGrid

Options.PointFont

( nPoint AS INTEGER,
strFontName AS STRING,
nFontSize AS INTEGER,
nFontHeight AS INTEGER,
bFontItalic AS INTEGER )

INTEGER
(0 = Success)

Set marker/point font for nPoint

Options.Points

( nPoint AS INTEGER,
nShow AS INTEGER,
nShape AS INTEGER,
nSize AS INTEGER,
nDec AS INTEGER,
fgColor AS INTEGER,
bgColor AS INTEGER)

INTEGER
(0 = Success)

Set marker/point options for nPoint.

Options.Traces

( nPoint AS INTEGER,
nLineWidth AS INTEGER,
nTraceBefore AS INTEGER,
nTraceAfter AS INTEGER,
traceColor AS INTEGER )

INTEGER
(0 = Success)

Set Trace options for pointno.  Specify line width, traces before and after and the color.

Options.Tracking

( strProperty AS STRING,
[nValue AS INTEGER] )

INTEGER
(0 = Success)

Sets or gets tracking options.  If nValue is omitted, this is a get option operation.  The following Tracking options can be set:

The following properties are valid:

Property

Valid Range

Description

Threshold

-1 - 255

Image threshold.  Set to -1 for Autothreshold

Background

0 - 2

0 = Light Background
1 = Dark background
2 = Autodetect

MatchAccuracy

0 - 100

Match Accuracy in percent

WindowSize

1 - 100

Window Size in percent of resolution

SizeAdjustment

1 - 100

Size adjustment factor as percent

MinMarkerSize

1 - 32000

Min marker size in pixels

MaxMarkerSize

1 - 32000

Max Marker size in pixels

CentroidCalcMethod

0 - 2

0 = Average
1 = Center of Mass
2 = Circle Fit

UseOriginalImage

0 - 1

0 = Off
1 = On

StopOnLost

0 - 1

0 = Off
1 = On

UsePrediction

0 - 1

0 = Off
1 = On

BiDirectional

0 - 1

0 = Off
1 = On

StopAtEof

0 - 1

0 = Off
1 = On

ShowSearchWindow

0 - 1

0 = Off
1 = On

ShowExplanation

0 - 1

0 = Off
1 = On

ShowTrackingWindow

0 - 1

0 = Off
1 = On

Object: Point

Point.Add

( nPoint1 AS INTEGER,
nPoint2 AS INTEGER )

INTEGER
(0 = Success)

Add nPoint1 with nPoint2.  This is same as C/C++

point2 += point1;

Point.Clear

( nPoint AS INTEGER )

INTEGER
(0 = Success)

Clears the specified point in the current frame only.  You can specify nPoint as -1 to clear all points in current frame.

Point.Copy

( nPoint1 AS INTEGER,
nStartFrame1 AS INTEGER,
nPoint2 AS INTEGER,
nStartFrame2 AS INTEGER,
[NoOfFrames AS INTEGER=-1],
[Dimension AS INTEGER=2] )

INTEGER
(0 = Success)

Copy data from one point to another starting at frame nStartFrame1 and then copied to nPoint2 starting at nStartFrame2 copying the specified number of frames or all frames (nFrames = -1).  You can copy each dimension separately or both at once.  Specify nDim as

0 = X
1 = Y
2 = Both

Point.CopyFrame

( [nFrame AS INTEGER],
[nPoint AS INTEGER],
[nStartFrame AS INTEGER],
[nNoOfFrames AS INTEGER] )

INTEGER
(0 = Success)

Copy specified frame in nPoint to all frames or selected number of frames.  If nStartFrame is -1 then copied from first frame.  If nNoOfFrames is -1 then frame is copied to all frames.

Point.Data2Point

( strData AS STRING,
nChan1 AS INTEGER,
nChan2 AS INTEGER,
nPoint AS INTEGER,
fScale1 AS REAL,
fOffset1 AS REAL,
fScale2 AS REAL,
fOffset2 AS REAL )

INTEGER
(0 = Success)

Create a point from dataname using chan1 as X and chan2 as Y.  You can scale the X/Y coordinates using scale/offset

Point.Delete

( nPoint AS INTEGER )

INTEGER
(0 = Success)

Delete the specified point.

Point.Digitize

( nPoint AS INTEGER,
strStatusMessage AS STRING )

INTEGER
(0 = Success)

Digitize point nPoint and display a message in the status bar.

Point.Divide

( nPoint1 AS INTEGER,
nPoint2 AS INTEGER )

INTEGER
(0 = Success)

Divide nPoint2 with nPoint1.  This is same as C/C++

point2 /= point1;

Point.Filter

( nPoint AS INTEGER,
nType AS INTEGER,
nLength AS INTEGER,
nLowFreq AS INTEGER,
nHighFreq AS INTEGER,
bCreateNew AS INTEGER,
strSuffix AS STRING,
bHide AS INTEGER )

INTEGER
(0 = Success)

Filter specified pointno using filter of type.  If creating new output point specify the suffix and if old point should be hidden.  Filter type can be one of following:

0 = Average
1 = Median
2 = Smoothing
3 = Lowpass
4 = Highpass
5 = Bandpass
6 = Notch

Point.Get

( nFrame AS INTEGER,
nPoint AS INTEGER,
nDim AS INTEGER,
[nMask AS INTEGER] )

REAL or
INTEGER

Get the point coordinate or status for the specified frame.  The dimension can be one of the following:

0 = X
1 = Y
2 = Status

Note; Mask only valid with status and will be applied as a binary AND with the point status.

Point.GetCurrent

( )

INTEGER

Returns the currently seleceted point

Point.GetName

( nPoint AS INTEGER )

STRING

Returns the name of the specified Point Number

Point.GetNoOf

( )

INTEGER

Get the number of points

Point.GetNumber

( strName AS STRING )

INTEGER

Get the point number for the point named strName

Point.GetVisible

( nPoint AS INTEGER )

INTEGER

Returns TRUE if the specified Point is visible otherwise FALSE

Point.Initialize

( nPoint AS INTEGER,
fX AS REAL,
fY AS REAL )

INTEGER
(0 = Success)

Initialize point with the specified x and y coordinates.

Point.Interpolate

( nPoint AS INTEGER,
nMaxGap AS INTEGER )

INTEGER
(0 = Success)

Perform spline interpolation on point.  Don't interpolate any gaps greater than nMaxGap frames.

Point.Invalidate

( nPoint AS INTEGER,
fMinX AS REAL,
fMaxX AS REAL,
fMinY AS REAL,
fMaxY AS REAL )

INTEGER
(0 = Success)

Make samples that are greater than max x/y or less than min x/y invalid.

Point.Multiply

( nPoint1 AS INTEGER,
nPoint2 AS INTEGER )

INTEGER
(0 = Success)

Multiply nPoint2 with nPoint1.  This is same as C/C++

point2 *= point1;

Point.Scale

( nPoint AS INTEGER,
fScaleX AS REAL,
fOffsetX AS REAL,
fScaleY AS REAL,
fOffsetY AS REAL )

INTEGER
(0 = Success)

Scale specified point by applying scale and offset.

Point.Set

( nFrame AS INTEGER,
nPoint AS INTEGER,
nDim AS INTEGER,
fValue AS REAL )

INTEGER
(0 = Success)

Sets the coordinate or the status of the point.  The dimension is one of the following:

0 = X
1 = Y
2 = Status

The point status will always be treated as an INTEGER mask.  See MaxTRAQ.mqb for available status flags.

Point.SetCurrent

( nPoint AS INTEGER )

INTEGER
(0 = Success)

Set the point as the currently selected point

Point.SetName

( nPoint AS INTEGER,
strName AS STRING )

INTEGER
(0 = Success)

Set the name of the specified point.

Point.SetVisible

( nPoint AS INTEGER,
bState AS INTEGER )

INTEGER
(0 = Success)

Set the visible state of the specified point to:

0 = Hidden
1 = Visible

Point.Subtract

( nPoint1 AS INTEGER,
nPoint2 AS INTEGER )

INTEGER
(0 = Success)

Subtract nPoint1 from nPoint2.  This is same as C/C++

point2 -= point1;

Point.Swap

( nPoint1 AS INTEGER,
nPoint2 AS INTEGER )

INTEGER
(0 = Success)

Swap the identity of the specified 2 points

Point.UseAsOrigin

( nPoint AS INTEGER )

INTEGER
(0 = Success)

Use specified point as Origin

Object: Projected

Projected.Create

( nPoint1 AS INTEGER,
nPoint2 AS INTEGER,
fOffset AS REAL,
bScaled AS INTEGER,
fAngle AS REAL,
strName AS STRING )

INTEGER
(0 = Success)

Creates a Projected Point using the 2 points, an offset and an angle.  The offset can be scaled to world coordinates or unscaled (pixels).  The strName parameter will be used to name the new point.

Projected.Invoke

( )

INTEGER
(0 = Success)

Invokes the Projected Point tool and displays the Projected Point tool dialog

Object: Recorder

Recorder.IsRecording

( )

INTEGER

Returns the state of the recorder.

Recorder.Preview

( bState AS INTEGER )

INTEGER
(0 = Success)

Turns video preview on or off

Recorder.Record

( bState AS INTEGER )

INTEGER
(0 = Success)

Starts or Stops recording.

Recorder.SetCamera

( strCamera AS STRING )

INTEGER
(0 = Success)

Sets the current camera and optionally the camera type.  the format of the camera type and name is:

"CameraType\CameraName"

If camera type is omitted, it will look for the camera using the current camera type.

Recorder.SetFrameRate

( nFrameRate AS INTEGER )

INTEGER
(0 = Success)

Sets the camera frame rate

Recorder.SetNoOfFrames

( nFrames AS INTEGER )

INTEGER
(0 = Success)

Sets the number of frames to record

Recorder.SetResolution

( nXRes AS INTEGER,
nYRes AS INTEGER )

INTEGER
(0 = Success)

Sets the camera resolution to use

Object: Scale

Scale.Create

( fLength AS REAL,
strUnits AS STRING,
x1 AS INTEGER,
y1 AS INTEGER,
x2 AS INTEGER,
y2 AS INTEGER )

INTEGER
(0 = Success)

Creates a Scale tool by specifying two points as X and Y coordinates in pixels, the length between these two points in real world units and the units as a string.

Scale.Delete

( )

INTEGER
(0 = Success)

Deletes a scale

Scale.GetUnits

( )

STRING

Returns the units as a string

Scale.Invoke

( )

INTEGER
(0 = Success)

Invokes the Scale tool and displays the Scale tool dialog

Object: Stick

Stick.Create

( nPoint1 AS INTEGER,
nPoint2 AS INTEGER )

INTEGER
(0 = Success)

Create a stick between Point1 and Point2.

Object: Video

Video.Copy2Clip

( )

INTEGER
(0 = Success)

Copies current video frame to the clipboard.

Video.Delete

( strObject AS STRING,
[nObject AS INTEGER=0] )

INTEGER
(0 = Success)

Delete the specified object(s).  The object can be specified as:

"All" = Deletes all points and tools
"All_points" = Deletes all points
"All_tools" = Deletes all tools

In this case the nObject is used as a confirm option. This determines if a confirmation dialog will be displayed.  0 = no confirmation (Default), 1 = confirmation.

You can also use this function to delete specific object.  In this case the strObject can be one of the following:

"Point" = Deletes point number nObject
"Tool" = Deletes tool number nObject

Note; When deleting a tool, the number of tools decreases and the objectno may change.  For example, if we created 3 angles and dlete the first, the second angle becomes objectno 1 and the third is now the 2nd

Video.DeleteByName

( strType AS STRING,
strName AS STRING,
[bAllFrames AS INTEGER=TRUE] )

INTEGER
(0 = Success)

Delete point or tool specified by name.  If bAllFrames is set to TRUE (Default), the point or tool is delete from all frames.  Type is one of following:

Point = Delete Point
Tool = Delete Tool

Video.Digitize

( bState AS INTEGER,
bAutoPoint AS INTEGER,
bAutoFrame AS INTEGER,
bAutoTrack AS INTEGER )

INTEGER
(0 = Success)

Turns digitizing on or off.  Set any of the parameters to 1 to turn the feature on and 0 to turn it off.  You can also use Video.SetDigitize to turn on/off one at a time.

Video.Flip

( )

INTEGER
(0 = Success)

Mirrors the current image.

Video.GetControl

( strControl AS STRING )

INTEGER

Returns the value of one of these video controls:

"brightness"
"contrast"
"bw"
"playspeed"

Video.GetDigitize

( strDigitizeItem AS STRING )

INTEGER

Returns the state of one of the following:

"digitize"
"autopoint"
"autoframe"
"autotrack"

Video.GetFrame

( [bOffsetT0 AS INTEGER=GetOffsetT0()] )

INTEGER

Returns the current frame number.  If the bOffsetT0 is omitted, then the current setting of Video.SetOffsetT0 is being used.

Video.GetFrameRate

( )

INTEGER

Returns the current frame rate

Video.GetInfo

( strInfo AS STRING )

INTEGER

Returns the specified information of the current video file.  The  strInfo string can be one of the following:

"framerate"
"noofframes"
"noofpoints"
"nooftools"
"noofnotes"
"xresolution"
"yresolution"
"currentframe"
"currentview"
"frameoffset"

Video.GetNoOfFrames

( )

INTEGER

Returns the number of frames in the current video

Video.GetNoOfPoints

( )

INTEGER

Returns the current number of points

Video.GetOutput

( )

INTEGER

Returns the state of the Video.SetOutput setting

Video.GetPixel

( xStart AS REAL,
yStart AS REAL,
[xEnd AS REAL=xStart],
[yEnd AS REAL=yStart],
[nProcess AS REAL=
     PIX_AVERAGE+PIX_FL_SCALED])

INTEGER

Returns the RGB value of the pixel specified by a region.  If the size of the regioin is a 1x1 pixel then no processing can be done.  However, you can specify an area that can be process by:

0 = Average Filter
1 = Median Filter

Set upper word to 1 if coordinates are in real worl (scaled).  Example:

PIX_AVERAGE+PIX_FL_SCALED

Video.GetScaledCoord

( rCoord AS REAL,
nDim AS INTEGER,
[bScaled AS INTEGER=TRUE] )

REAL

Returns the scaled video coordinate in world coordinate system.  If bScaled is FALSE, then the return is in Pixels otherwise it's in scaled units.

Note that the video coordinate system has the origin in upper left coorner as opposed to the measurement coordinate system that has it in lower right corner.

Video.GetStepLength

( )

INTEGER

Returns the current step length

Video.GetSubtractFrame

( )

INTEGER

Returns the current SubtractFrame value.  Returns one of the following:

0 = Subtract None (Default)
1 = First Frame
2 = Last Frame
3 = Current Frame
4 = Every Previous Frame

Video.GetTableType

( )

INTEGER

Returns the currently selected display of objects in the side bar table.  Can be one of:

0 = Points
1 = Angles
2 = Distances
3 = Analog
4 = Force

Video.GetT0

( )

INTEGER

Returns the current T0

Video.GetT1

( )

INTEGER

Returns the current T1

Video.GetUnits

( [strDefault AS STRING=NULL] )

STRING

Get the current units as a string.  Units are set by the scaling too.  You can specify default units.

Video.GetUnscaledCoord

( rCoord AS REAL,
nDim AS INTEGER,
[bScaled AS INTEGER=TRUE] )

REAL

"Unscales" a world coordinate system coordinate into video coordinate.  If bScaled is FALSE, then the coordinate is assumed to be in pixels and the returned coordinate will be in video coordinate system.

Note that the video coordinate system has the origin in upper left coorner as opposed to the measurement coordinate system that has it in lower right corner.

Video.GetVisible

( strObject AS STRING,
nObject AS INTEGER )

INTEGER

Returns the visible state of an object.  The Object is specified by the Object Type (strObject) and the Object Number (nObject).  valid Object Types are

"Point"
"Angle"
"Distance"
"Caliper"

Video.Play

( strDirection AS STRING )

INTEGER
(0 = Success)

Play current file forward or backwards.  Specify the direction as:

"Forward"
"Reverse"

Video.Rotate

( nDegrees AS INTEGER )

INTEGER
(0 = Success)

Rotates the current image in steps of 90 degrees clockwise.  Valid argument is 90, 180, 270 degrees.

Video.SetControl

( strControl AS STRING,
nValue AS INTEGER )

INTEGER
(0 = Success)

Set video controls to improve video quality or adjust replay speed.  The control can be specified as:

"brightness" - Valid Values = 0-100
"contrast" - Valid values = 0-100
"bw" - Valid Values = 0 or 1
"playspeed" - Valid Values = 0-9

Video.SetDigitize

( strDigitizeItem AS STRING,
bState AS INTEGER )

INTEGER
(0 = Success)

Sets the state of any of these digitizing controls:

"digitize"
"autopoint"
"autoframe"
"autotrack"

This is essentially the same as using the Video.Digitize function.  Difference is that this is changing the state of one control at a time.

Video.SetFrame

( nFrameNo AS INTEGER,
[bOffsetT0 AS INTEGER=GetOffsetT0()] )

INTEGER
(0 = Success)

Sets the current frame to the specified frame number.  You can specify if you want the frame number to be offset to T0.  You can specify -1 if you want to go to the first frame.
 
Note; If you don't specify bOffsetT0 it will use the current state of the OffsetT0 setting.  See Video.SetOffsetT0

Video.SetNoOfPoints

( nPoints AS INTEGER )

INTEGER
(0 = Success)

Sets the number of points.

Video.SetOffsetT0

( bState AS INTEGER )

INTEGER
(0 = Success)

Defines if the MaxTRAQ script functions should offset T0 or not.  By default, all frame numbers are references to the start of the file.  To enable frame numbers to offset T0, call this function with bState set to 1 (TRUE)

Video.SetOutput

( bState AS INTEGER )

INTEGER
(0 = Success)

Enables or disables the update of the application.  Use this if you're performing multiple operations to speed up performance.  Once you enable output again the application will get updated.

Video.SetStepLength

( nLength AS INTEGER )

INTEGER
(0 = Success)

Set the video step length.

Video.SetSubtractFrame

( nType AS INTEGER )

INTEGER
(0 = Success)

This will enable or disable frame subtraction.  This feature is used to subtract out backgrounds by selecting a frame without the subject.  This frame will then be subtracted from each frame leaving just the moving subject in the image.  You can also select to subtract each previous frame to subtract a more dynamic background scene. 

Type can be one of the following:

0 = Subtract None (Default)
1 = First Frame
2 = Last Frame
3 = Current Frame
4 = Every Previous Frame

Video.SetSubject

( strInfoType AS STRING,
strValue AS STRING )

INTEGER
(0 = Success)

Set specified subject information.  Info-type can be one of the following:

"name"
"location"
"folder"
"comments"

Video.SetTableType

( nType AS INTEGER )

INTEGER
(0 = Success)

Sets the display of objects in the side bar table.  Can be one of:

0 = Points
1 = Angles
2 = Distances
3 = Analog
4 = Force

Video.SetT0

( nFrameNo AS INTEGER )

INTEGER
(0 = Success)

Set T0 to specified frame number

Video.SetT1

( nFrameNo AS INTEGER )

INTEGER
(0 = Success)

Set T1 to specified frame number

Video.SetVisible

( strObject AS STRING,
nObject AS INTEGER,
bState AS INTEGER )

INTEGER
(0 = Success)

Sets the visible state of an object.  The bState is specified as 0 = off and 1 = on (FALSE/TRUE).  The nObject can be set to -1 for all objects.  The nObject parameter can be one of the following:

"Point"
"Angle"
"Distance"
"Caliper"

Video.Step

( strDirection AS STRING )

INTEGER
(0 = Success)

Step one frame either forward or backward.  Specify direction as:

"Forward"
"Reverse"

Video.Stop

( )

INTEGER
(0 = Success)

Stop video playback.

Video.Tool

( nToolType AS INTEGER )

INTEGER
(0 = Success)

Invoke tool.  The tool is specified as a number where:

0 = Distance Tool
1 = Angle Tool
2 = Note Tool
3 = Scale Tool
4 = Projected Point Tool
5 = Center of Max Tool
7 = Grid Tool

Object: Widget

Widget.Event

( nEventNo AS INTEGER,
nState AS INTEGER,
[strWidgetName AS STRING=NULL] )

INTEGER
(0 = Success)

Set or clear an Event in widgets.  Note, Currently only recEvent supports events.
 
if strWidgetName is omitted, send to Widgets

Widget.Get

( strWidgetName AS STRING,
[nType AS INTEGER=0],
[nParam1 AS INTEGER=0],
[nParam2 AS INTEGER=0] )

VALUE

Returns the current or specified contents of a Widget.  The parameters depends on the Widget and are defined as follows:

Type 0 = Default
Type 1 = INTEGER
Type 2 = REAL
Type 3 = STRING
Type 4 = Event

Param1 and Param2 currently used with Events and are defined as follows:

Param1 and
Param2 = 0

Get No Of Events

Param1 <> 0 and
Param2 = 0

Get Number Of Events Set for Event Number specified in nParam1

Param1 <> 0 and
Param2 <>  0

Get Event State for Event No in nParam1 and Frame No in nParam2

For most Widgets you should only have to specify the Widget name and it will return the appropriate data type.

Widget.New

( bPrompt AS INTEGER,
[strWidgetName AS STRING=NULL] )

INTEGER
(0 = Success)

Send New command to Widget(s).  If bPrompt is set, then Widget(s) will prompt to save if modified before closing current file.
 
if strWidgetName is omitted, send to all Widgets

Widget.Open

( [strFileName AS STRING=NULL],
[strWidgetName AS STRING=NULL] )

INTEGER
(0 = Success)

Opens a Widget file.  is strFileName is NULL or empty then the Widget(s) will display its file open dialog.
 
if strWidgetName is omitted, send to all Widgets

Widget.Property

( nItem AS INTEGER,
nParam AS INTEGER,
[strWidgetName AS STRING=NULL] )

INTEGER
(0 = Success)

Sets a Widget property.  The property type can be one of the following:

WIDGET_PROP_NOTHING     = 0
WIDGET_PROP_READONLY    = 1
WIDGET_PROP_MULTISELECT = 2
WIDGET_PROP_WEEKNUMBERS = 3

The parameter depends on the Widget.  if strWidgetName is omitted, send to all Widgets

Widget.Save

( [strFileName AS STRING=NULL],
[strWidgetName AS STRING] )

INTEGER
(0 = Success)

Saves the current Widget file to specified file.  If strFileName is NULL or omitted, then it will save to current file otherwise it will do a Save As.
 
if strWidgetName is omitted, send to all Widgets

Widget.Set

( VALUE v,
[strWidgetName AS STRING=NULL] )

INTEGER
(0 = Success)

Sends a value to a Widget.  The value and the type depends on the Widget.  For example, myNotes accepts strings while aCalendar accepts strings with dates (can be ranges such as "1/1/20..1/7/20").  If the VALUE is 0 or NULL, then this is a clear (screen) command.  Note; To set an event, use the Widget.Event function.
 
if strWidgetName is omitted, send to all Widgets

Widget.Show

( bShow AS INTEGER,
[strWidgetName AS STRING=NULL] )

INTEGER
(0 = Success)

Show or Hide a Widget.
 
if strWidgetName is omitted, send to all Widgets