Get run-time options

Syntax

int|lpstr getopt(option [context])

 

Parameters

option - one of options that can be set with opt, or one of options listed below.

speed macro speed (autodelay) in milliseconds. Speed can be set locally (spe) and globally (RtOptions).
itemid QM tem id.
itemname QM item name. Unlike other options, the return type is lpstr (string), not int. See also context 6 (below).
nargs number of arguments passed. Can be used in a function with optional parameters.
nthreads

number of threads currently running. Does not include special threads. If context is 4, returns total number of running threads. Otherwise, returns number of threads started by function defined by context.

 

See also: IsThreadRunning

context - one of values listed below. Default: 0.

0 Get option of current QM item (from which is called this function).
1 Get option of direct caller (if current item is function and it is called from other item).
2 Get option of callback entry function or thread entry function.
3 Get option of thread entry function (macro or function that started execution).
4 Get global option. Valid only for speed and nthreads.
5

QM 2.3.3. Get option of this function or of the nearest function in the call stack where the option is not 0. Return 0 if all 0.

 

Example:

There are 3 functions, calling each other like F1->F2->F3.

In F3 getopt returns 1 if the option is 1 in F3, F2 or F1.

6 QM 2.4.1. Get option of parent item of current sub-function. If not in a sub-function - same as 0.
<0

QM 2.3.5. Get option of -context caller in the function call stack. For example, if context is -2, gets option of caller's caller. Returns 0 if there is no caller at this level.

 

See also: GetCallStack

 

Remarks

Returns 0 if the option is unavailable in the specified context.

 

QM 2.2.1. Added slowmouse, slowkeys, keymark, keysync.

QM 2.3.0. Added hungwindow.

QM 2.3.3. Added nowarnings.

QM 2.3.5. Added nowarningshere, noerrorshere.

QM 2.4.1. Added itemname.

 

Example

 show number of passed arguments 
int na=getopt(nargs)
out na