Simple and HyperScript Commands  -  Lite and Standard Editions

Previous  Next

 

You can control MaxTRAQ in several ways.  You can control it programmatically by using the Automation Interface or you can create SimpleScript files with commands to facilitate repetitive tasks.  SimpleScript files are text files with the extension .mqs.  Additionally, the script commands can be used as hyperlink commands preceded by MaxTRAQ: in the theWiz Widget application.

 

While we will keep updating SimpleScript commands it is recommended that you use MyBASIC2 Scripts instead since it has a more comprehensive list of functions.

 

Here are some Script Examples

 

Command

Description

! This is a comment

Inserts a comment into the script.

abort()

Aborts/stops the current script.

addpoints( point1, point2 )

Add Point1 with Point2.  This is same as C/C++

point2 += point1;

angle( type, name, point1, point2, point3, point4 )

Create an angle named name 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

appexit()

Terminates MaxTRAQ.

appexit2( save )

Terminates MaxTRAQ.  If save is set to 0, then any changes made to the current file will not be saved.

caliper( type, state )

Turns the horizontal or vertical calipers on or off.  Type is specified as:

horizontal
vertical

camera( camera )

Selects the camera to use.  the camera parameter specifies the name of the camera.

clear( object, objectno )

Clears the specified object(s) in the current frame only.  The object can be specified as:

Point = Clear specified point
All_points = Clears all points

close()

Closes the current file.

close2( save )

Close the current file.  If save is set to 0, then any changes made to the current file will be discarded.

copy2clip()

Copies current video frame to the clipboard

copyframe( pointno, frame, startframe, noofframes )

Copy specified frame in pointno to all frames or selected number of frames.  If startframe is -1 then copied from first frame.  If noofframes is -1 then frame is copied to all frames.

data2point( dataname, chan1, chan2, pointno, scale1, offset1, scale2, offset2 )

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

delete( object, objectno/confirm )

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

The confirm parameter determines if a confirmation dialog will be displayed.  0 = no confirmation, 1 = confirmation.

Point = Deletes point number objectno
Tool = Deletes tool number objectno

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.

deletebyname( type, name, allframes )

Delete point or tool specified by name.  If allframes is set to 1, the point or tool is delete from all frames.  Type is one of following:

Point = Delete point
Tool = Delete tool

description( text )

Sets the file description of the currently opened file.  If text equals ? a dialog box is displayed.

digitize( state, autopoint, autoframe, autotrack )

Turns digitizing on or off.  Set any of the parameters to 1 to turn the feature on and 0 to turn it off.

digitizepoint( pointno, statusmsg )

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

distance( type, name, point1, point2 )

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

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

divpoints( point1, point2 )

Divide Point2 with Point1.  This is same as C/C++

point2 /= point1;

dlg.recorder( dialog-type )

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()

Display the Subject Information dialog.

filepropdlg()

Displays the file property dialog.

filter( pointno, type, length, lowfreq, highfreq, createnew, suffix, hide )

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

folder( foldername )

Sets the current folder.

flip()

Mirrors the current image.

frame( frameno )

Go to frameno.  To rewind to beginning of file, set frameno to -1.  Note;  First frame is always 1 and is referenced to T0.

framerate( rate )

Sets the recording frame rate.

function( keyno )

Executes function key keyno

getfileinfo( info-type )

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

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

if.not( condition, cmd )

Checks the condition and if not met executes the SimpleScript command specified by the cmd parameter.

The condition parameter can be one of the following:

fileopen = Tests if a file is open

if.else( condition, cmdtrue, cmdfalse )

Checks the condition and if met then executes the cmdtrue command otherwise the cmdfalse command is executed.

The condition parameter can be one of the following:

fileopen = Tests if a file is open
caliper.horizontal = True if Horizontal caliper tool is displayed
caliper.vertical = True of Vertical caliper tools is displayed

import( filename, nametemplate, namesubstitute )

Import file specified by the filename.  Replace string specified by nametemplate with namesubstitute string

initialize( pointno, x-coord, y-coord )

Initialize point with the specified x and y coordinates.

interpolate( pointno, max-gap )

Perform spline interpolation on point.  Don't interpolate any gaps greater than max-gap frames.

invalidate( pointno, min-x, max-x, min-y, max-y )

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

msgbox( message, type )

Displays a message box.  The type parameter can be one of the following:

0 = Ok Button/Exclamation Icon
1 = Ok Button/Information Icon
2 = Ok and Cancel Buttons/Exclamation Icon
3 = Ok and Cancel Buttons/Information Icon

mulpoints( point1, point2 )

Multiply Point2 with Point1.  This is same as C/C++

point2 *= point1;

multisync( state )

Turns Multisync on or off.

name( object, objectno, name )

Names the specified object.  The object can be one of the following:

Point
Angle
Distance

new( doctype )

Create a new document.  The doctype parameter can be one of the following:

0 = Tracking
1 = Recording

nframes( nframes )

Set number of frames to record.  If set to -1, MaxTRAQ will record until the user stops the recording.

note( frameno, x1, y1, x2, y2, x3, y3, text )

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 referenced to T0.    If text equals ? a dialog box is displayed so that the user can enter the note text.

npoints( npoints )

Set the number of points to digitize.

open( filename )

Open the named file.  If the string is empty ('') then the file open dialog will be displayed.

You can execute another SimpleScript file by opening the file using this command.

options.points( pointno, show, shape, size, decimals, fg-color, bg-color )

Set marker/point options for pointno.

options.pointfont( pointno, fontname, size, weight, italic )

Set marker/point font for pointno

options.traces( pointno, linewidth, before, after, color )

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

optionsdlg( pageno )

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

output( state )

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.

play( direction )

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

Forward
Reverse

point( pointno )

Set current point.

preview( state )

Turns the recorder preview on or off.  Specify 1 to turn preview on and 0 to off.

print( report-template, type )

Prints report using specified report-template.  Type can be one of following:

0 = Print to printer using print dialog
1 = Print to default printer without dialog
2 = Print Preview
3 = Print to PDF

record( state )

Starts recording a video.  To start set state to 1 and to stop recording specify 0.

repeat( count, start, cmd )

Repeat the command cmd count times.  The start parameter specifies the starting index of the repeat substitute variable %r.  If either count or start is set to -1 a dialog box will be displayed.

resolution( xres, yres )

Set the camera resolution.

rotate( degrees )

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

run( application, parameters )

Runs the specified application.  This can also point to a file that has an application associated with it.  For example, index.htm would be opened in the default browser.

save( filename )

Save the current file.  If the filename is empty ('') then the Save As dialog is displayed.

scalepoint( pointno, scaleX, offsetX, scaleY, offsetY )

Scale specified pointno by applying scale and offset.

status( text )

Displays text in the status bar.

step( direction )

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

Forward
Reverse

steplength( steplength )

Set step length.

stick( point1, point2 )

Create a stick between point1 and point2.

stop()

Stop video playback.

subject( info-type, value )

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

name
location
folder
comments

subpoints( point1, point2 )

Subtract Point1 from Point2.  This is same as C/C++

point2 -= point1;

subtractframe( type )

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

swap( point1, point2 )

Swap point1 with point2.

t0( frameno )

Set T0 to frameno.

t1( frameno )

Set T1 to frameno.

tool( toolno )

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

options.tracking( property, value )

Set Tracking properties/options.  The following properties can be set:

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

view( property, state )

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

visible( object, objectno, state )

Sets the visible state of an object.  The state is specified as 0 = off and 1 = on.  The objectno can be set to -1 for all objects.  The object parameter can be one of the following:

Point
Angle
Distance
Caliper

 

Examples