GetAliasWildcard
Script function

world.GetAliasWildcard

DOC_scripting Read about scripting

Type

Method

Summary

Returns the contents of the specified wildcard for the named alias

Prototype

VARIANT GetAliasWildcard(BSTR AliasName, BSTR WildcardName);

DOC_data_types View list of data type meanings


Description

Once a alias has matched you can extract any of the wildcards for that alias using this function.

The wildcards can be specified by name or number (if by number pass a string which is the appropriate number).

You can set up a named wildcard like this:

Match: Tell (?P<who>.*?) (?P<what>.*)

In this case we have 2 wildcards, named "who" and "what".

Now we can extract wildcards like this:

x = GetAliasWildcard ("myalias", "who") ' get wildcard named 'who'
x = GetAliasWildcard ("myalias", "what") ' get wildcard named 'what'
x = GetAliasWildcard ("myalias", "22") ' get wildcard 22 (if it exists)

You can have up to 999 wildcards, plus wildcard 0 which represents the entire matching string.

You can use GetAliasInfo selector 24 to find how many wildcards matched.

Each wildcard will have a number and may optionally have a name.



VBscript example

dim x

x = GetAliasWildcard ("myalias", "who")  ' get wildcard named 'who'
x = GetAliasWildcard ("myalias", "what") ' get wildcard named 'what'
x = GetAliasWildcard ("myalias", "22")   ' get wildcard 22 (if it exists)



Lua example

local x

x = GetAliasWildcard ("myalias", "who")  -- get wildcard named 'who'
x = GetAliasWildcard ("myalias", "what") -- get wildcard named 'what'
x = GetAliasWildcard ("myalias", "22")   -- get wildcard 22 (if it exists)



Lua notes

Inside an alias script function you can access named wildcards by simply putting the name after the wildcards argument. eg.

function myAliasFunction (name, line, wildcards)
  Note (wildcards.who)  --> access named wildcards "who"
end



Return value

The contents of the specified alias wildcard, as described above.

An EMPTY variant, if the alias does not exist.

A NULL variant if the alias name is invalid.

An empty string if the wildcard does not exist. An empty string is the string "", this is different from an EMPTY variant.




See Also ...

Topics

DOC_aliases Aliases
DOC_mapper Auto-mapper
DOC_defaults Default triggers/aliases/timers/macros/colours
DOC_starting Getting started
DOC_group Groups
DOC_keypad Keypad navigation
DOC_macros Macro keys
DOC_plugins Plugins
DOC_regexp Regular Expressions
DOC_speed_walking Speed walking
DOC_timers Timers
DOC_triggers Triggers

Functions

FNC_AddAlias AddAlias (Adds an alias)
FNC_DeleteAlias DeleteAlias (Deletes an alias)
FNC_DeleteAliasGroup DeleteAliasGroup (Deletes a group of aliases)
FNC_DeleteTemporaryAliases DeleteTemporaryAliases (Deletes all temporary aliases)
FNC_EnableAlias EnableAlias (Enables or disables an alias)
FNC_EnableAliasGroup EnableAliasGroup (Enables/disables a group of aliases)
FNC_GetAlias GetAlias (Gets details about an alias)
FNC_GetAliasInfo GetAliasInfo (Gets details about an alias)
FNC_GetAliasList GetAliasList (Gets the list of aliases)
FNC_GetAliasOption GetAliasOption (Gets the value of a named alias option)
FNC_GetPluginAliasInfo GetPluginAliasInfo (Gets details about a named alias for a specified plugin)
FNC_GetPluginAliasList GetPluginAliasList (Gets the list of aliases in a specified plugin)
FNC_IsAlias IsAlias (Tests to see if an alias exists)
FNC_SetAliasOption SetAliasOption (Sets the value of a named alias option)

(Help topic: function=GetAliasWildcard)

DOC_contents Documentation contents page