PrevUpNext usersguide-7.htmlThe Example Scripts usersguide-5.htmlUser Scripting
usersguide-9.htmlSkencil's API
The Script Registry
The script registry contains all user scripts and its contents are used
to create the 
Script menu. The script registry is implemented in
the (sub-)package 
Sketch.Scripting. Because the Scriptingpackage is not automatically imported by the 
Sketch package, you
have to 
import Sketch.Scripting explicitly before accessing the
registry functions.
Functions in the registry package:
AddFunction(name, title, function[, kwargs])Add the function function to the registry under the name
name. name is used internally to identify the script
and should be unique. 
The parameter title defines the text for the menu-entry.
The function accepts these optional keyword arguments:
script_type = typeThe type of the script. It can be either SafeScriptor 
AdvancedScript. Both values are defined in the
Scripting package. The default is SafeScript.
menu = menu_specDefines the sub-menu the script should appear in. The
menu_spec can be either a string or a tuple of
strings. Each string is the title of a sub-menu.
args = argtupleDefines additional positional parameters passed to the
script function after the context parameter.
argtuple must be a tuple containing these
arguments. It defaults to the empty tuple.
Example: Registering the abut_horizontal script in the sub-menu
"Arrange"
Sketch.Scripting.AddFunction('abut_horizontal', 'Abut Horizontal',
                             abut_horizontal, menu = 'Arrange')
usersguide-7.htmlThe Example Scripts usersguide-5.htmlUser Scripting
usersguide-9.htmlSkencil's API
PrevUpNext