omlfilename

Returns the filename of the currently running script.

Syntax

R = omlfilename(detailstring)

Inputs

detailstring (optional)
If nargin is 0, the script filename (without extension) is returned.
If nargin is 1, valid values are:
  • 'fullpath' - return the path and the filename (without extension).
  • 'fullpathext' - return the path and the filename with extension.
Type: string

Outputs

R
The script filename; path and filename; or path, filename and file extension, depending on nargin.

Example

R = omlfilename()
R = omlfilename('fullpath')
R = omlfilename('fullpathext')
R = testscript
R = C:\tests\testscript
R = C:\tests\testscript.oml

Comments

If the OML script is being run from the editor, the filename will only be returned if the script is saved and unmodified since being saved.