| Methods | Return Value | Description |
| --- | --- | --- |
| set_timeout(callback, delay) | None |Runs the callback in the main thread after the given delay (in milliseconds). Callbacks with an equal delay will be run in the order they were added. |
|set_timeout_async(callback, delay) | None| Runs the callback on an alternate thread after the given delay (in milliseconds).|
|error_message(string)|None | Displays an error dialog to the user. |
|message_dialog(string)| None | Displays a message dialog to the user.|
|ok_cancel_dialog(string, <ok_title>) |bool| Displays an ok / cancel question dialog to the user. If `ok_title` is provided, this may be used as the text on the ok button. Returns True if the user presses the ok button. |
| yes_no_cancel_dialog(string, <yes_title>, <no_title>)| int| Displays a yes / no / cancel question dialog to the user. If `yes_title` and/or `no_title` are provided, they will be used as the text on the corresponding buttons on some platforms. Returns `sublime.DIALOG_YES`, `sublime.DIALOG_NO` or `sublime.DIALOG_CANCEL`. |
|load_resource(name)|str|Loads the given resource. The name should be in the format `Packages/Default/Main.sublime-menu`|
|load_binary_resource(name) | bytes|Loads the given resource. The name should be in the format `Packages/Default/Main.sublime-menu`. |
|find_resources(pattern)|[str]|Finds resources whose file name matches the given pattern.|
|encode_value(value, \<pretty\>)|str| Encode a JSON compatible `value` into a string representation. If `pretty` is set to `True`, the string will include newlines and indentation|
|decode_value(string)| value|Decodes a JSON string into an object. If the `string` is invalid, a `ValueError` will be thrown|
|expand_variables(value, variables)| value|Expands any variables in the string `value` using the variables defined in the dictionary `variables`. `value` may also be a `list` or dict, in which case the structure will be recursively expanded. Strings should use snippet syntax, for example: `expand_variables("Hello, ${name}", {"name": "Foo"})`|
|load_settings(base_name)| Settings|Loads the named settings. The name should include a file name and extension, but not a path. The packages will be searched for files matching the `base_name`, and the results will be collated into the settings object. Subsequent calls to `load_settings`() with the `base_name` will return the same object, and not load the settings from disk again.|
|save_settings(base_name)|None|Flushes any in-memory changes to the named settings object to disk.|
|windows()| [Window]|Returns a list of all the open windows.|
|active_window()| Window|Returns the most recently used window.|
|packages_path()|str|Returns the path where all the user's loose packages are located.|
|installed_packages_path()| str|Returns the path where all the user's .sublime-package files are located.|
|cache_path()|str |Returns the path where Sublime Text stores cache files.|
|get_clipboard(<size_limit>)|str|Returns the contents of the clipboard. `size_limit` is there to protect against unnecessarily large data, defaults to 16,777,216 characters |
|set_clipboard(string)|None|Sets the contents of the clipboard.|
|score_selector(scope, selector)|int|Matches the `selector` against the given `scope`, returning a score. A score of `0` means no match, above `0` means a match. Different selectors may be compared against the same scope: a higher score means the selector is a better match for the scope.|
|run_command(string, \<args>)|None|Runs the named ApplicationCommand with the (optional) given `args`|
|get_macro()|[dict] |Returns a list of the commands and args that compromise the currently recorded macro. Each `dict` will contain the keys `command` and `args`.|
|log_commands(flag)|None|Controls command logging. If enabled, all commands run from key bindings and the menu will be logged to the console.|
|log_input(flag)|None|Controls input logging. If enabled, all key presses will be logged to the console.|
|log_result_regex(flag)|None |Controls result regex logging. This is useful for debugging regular expressions used in build systems. |
|version()|str| Returns the version number|
|platform()|str|Returns the platform, which may be `"osx"`, `"linux"` or `"windows"`|
|arch()|str|Returns the CPU architecture, which may be `"x32"`or `"x64"`|