Get run-time options

Syntax

int 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 globally (in Options dialog) and locally (spe).
itemid item id
nargs number of arguments passed. Can be used in a function to know which optional arguments were omitted.
nthreads number of threads currently running. This 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.

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

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

QM 2.3.3. Return 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.

 

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.

 

Examples

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

 show name of current item:
_s.getmacro(getopt(itemid) 1)
out _s