Show in Frame No Frame
Up Previous Next Title Page Index Contents Search

10.2 Command line string functions

While command line parameters simply carry out an action and return nothing, command line string functions return a string, mostly with no action as a side effect. These functions are most useful from within MERL using internal...read (Section 6.4.8), or when called as API functions; on the actual command line their return values are not available.

commandLine

Returns the command that started MetaEdit+ and its parameters, one per line. This is as received by MetaEdit+, so after the shell has parsed the command line, stripping quoting and processing escapes. To reuse, you may need to add quoting and escapes.

dbDir

Returns the repository directory specified when logging in, or an empty string if not logged in. The directory will be in the same format as in the roots file, so may be absolute, relative or a UNC

dbName

Returns the repository name specified when logging in, or an empty string if not logged in

defaultProject

Returns the name of the current default project, or an empty string if not logged in, or if no default project is set (e.g. if no projects are open)

exists:

Takes a single string argument representing a filename, and answers T if that filename exists or an empty string if not (or if testing it results in an error).

getCurrentDir

Returns the current working directory of the MetaEdit+ process.

getVar:

Returns the value of the named session-persistent variable. Includes text formatting in the result when called in MERL's internal...read. E.g. in MERL:
internal 'getVar: username' read
would output ‘John Smith’ (or whatever value had been set earlier in the session).

setVar:value:

Sets the value of the named session-persistent variable. Saves text formatting in the value when called in MERL's internal...execute/read. E.g. in MERL:
internal 'setVar:value: username "John Smith"' execute

textForMERL:

Runs the arguments as a MERL snippet and returns the result. The snippet is run with no context, just a single empty string on the stack.
This can also be useful for running generators as scripts from the command line. E.g. to login and automatically run _vcsSync:
mep55.exe login textForMERL: "_vcsSync()"
Can be used even when not logged in (obviously providing no operations are performed that require graphs on the stack). E.g. to run _vcsInitClone, with settings supplied in the .vcsPaths file:
mep55.exe textForMERL: "_vcsInitClone()"
Subgenerators will be looked up from Graph; note that when not logged in these are the Graph generators supplied in the MetaEdit+ executable, not those in a particular repository.

unconvertedVersion

When logged in to a repository from an earlier MetaEdit+ version, and before conversion to the current version is committed, returns the short version string of the earlier MetaEdit+ program version corresponding to the repository. Function available from 5.1, with values '3.0', '4.0', '4.5', '5.0', '5.1', '5.5' etc. Returns an empty string if not logged in, or if the repository does not need conversion, or its conversion has already been committed.

user

Returns the name of the currently logged in repository user, or an empty string if not logged in.

vcsComment

Returns the version comment of the most recent saved Version (of any user) visible in this transaction. The first line is the version number, user and date, and the remainder is the version comment.

vcsDirty

Are there changes after the last Saved Version / vcsComment? Either in this transaction, in any users’ working versions’ commits and not included in the latest Saved Version by subsequent commits, or in generators newer than the latest Saved Version. Note this does not notice other metamodel changes, nor uncommitted changes by other users. Returns an empty string for false or T for true.

vcsComment

Returns the full version comment of the parent of the most recent saved Version. The first line is the version number, user and date, and the remainder is the version comment.

version

Returns a string containing the short version information of the MetaEdit+ program, e.g. '5.1'.

versionVerbose

Returns a string containing the verbose version information of the MetaEdit+ program, including type of license, build and patches, e.g.:
MetaEdit+ Workbench 5.1 Single User Version #('MetaEdit+ 5.1 Build 13')
The string format is (all on one line; each line below ends in a space):
MetaEdit+ [Workbench |API |][5.1|5.5|...] [Multi-|Single]User
[Evaluation |Time-Limited ]Version
#('MetaEdit+ X.X Build X*'[ 'patchTimestampOrName']*)


Show in Frame No Frame
Up Previous Next Title Page Index Contents Search