Miscellaneous Functions


The functions listed below are useful for many different purposes.

Miscellaneous Functions

All of the functions below are non-class functions. Most were defined 10 to 20 years ago, before Mira adopted new rules for using upper and lower case in names. The older function names use mixed case, as do class names and class members. All new function names use purely lower-case names.

AbbrevPath

Returns a shorter name that removes the middle folders from a file path name.

Assert

Exits the script with an optional message if a condition or value fails, with a result of 0, false, or nil.

Beep

Issues a default "beep" sound from the computer.

booltostr

Returns the string "true" or "false" for a boolean value.

Exit

Exists the script immediately with an optional message.

FileOpen

Opens a file and returns a CFile class object for accessing it.

GetFileList

Returns a lua table containing the names of files in a folder.

GetFileName

Opens the Windows File > Open dialog to browse for a file name string.

GetFolder

Returns the name of a folder selected using a File > Open dialog.

GetFileOpenDlgTitle

Returns the current title used for Open dialogs.

GetFileSaveDlgTitle

Returns the current title used for Save As dialogs.

GetKeyState

Returns the state of a Windows virtual key. Use this function to poll the status of keyboard keys and mouse buttons.

GetMathErVal

Sets a replacement value for math errors.

GetMathErrValStr

Returns the math error value as a string.

GetViewportSize

Returns the width and height of the interior of the main Mira window.

PixelTypeToStr

Converts a numeric pixel type code to a string.

Include

round

Returns the width and height of the interior of the main Mira window.

SetFileOpenDlgTitle

 Changes the title of all subsequent File > Open dialogs.

SetFileSaveDlgTitle

Changes the title of all subsequent File > Save As dialogs.

StrToPixelType

Returns the pixel type number corresponding to the pixel type name.

SetResampleParams

Sets default parameters for resampling images. This is used by

SetMathErrVal

Converts a string pixel type to a numeric pixel type code.

Related Topics

Contents, Date, Time, and Angle Functions, Plotting Functions, Script Classes, Table and Array Functions, Text Formatting Functions


Mira Pro x64 Script User's Guide, Copyright Ⓒ 2024 Mirametrics, Inc. All Rights Reserved.