# Embedded Winget

Source: https://ref.dm-lang.org/skin/commands/embed

Commands that are initiated by the skin (like button.command, map.on-show, etc.) have a special syntax that allows you to include information that would normally require a winget call. By including `[[*something*]]` in the command, the double-bracketed text will be replaced by the result of running a winget on that parameter.

A value of `[[id.parameter]]` will run a winget on the control with the given ID. Just using `[[parameter]]` will run a winget for the control that initiated this command. You can also use `parent` in place of the ID to do something with the parent of the control, or `parent.id` for access to a sibling control. Position and size parameters can be further broken down by appending `.x` or `.y` to get at the numbers directly.

Several commands already support some special cases like `[[*]]` or `[[width]]` or such, where the special-case values are relevant to the command. An example is that in `on-size` the value of `[[*]]` is a size value. The Any macro, gamepad macros, and mouse macros, also support this syntax; see [macros](https://ref.dm-lang.org/skin/macros.md) for more info.

You can choose how embedded wingets get formatted by following the value with `as` and a type, such as `[[window.size as string]]`. There are several types you can use, and different types of parameters get formatted differently:

- **arg**: Value is formatted as if it's an argument on a command line. Numbers are left alone; booleans are 0 or 1; size and position have their X and Y values separated by a space; pretty much everything else is DM-escaped and enclosed in quotes.
- **escaped**: DM-escape the value as if it's in a quoted string but do not include the quotes. Size and position values both use `,` to separate their X and Y values.
- **string**: Value is formatted as a DM-escaped string with surrounding quotes.
- **params**: Format value for a URL-encoded parameter list (see [list2params](https://ref.dm-lang.org/proc/list2params.md)), escaping characters as needed.
- **json**: JSON formatting. Numbers are left unchanged; size or position values are turned into objects with x and y items; boolean values are `true` or `false`.
- **json-dm**: JSON formatting, but DM-escaped so it can be included in a quoted string. Quotes are not included.
- **raw**: Does not change the value's text representation in any way; assumes it's already formatted correctly for the purpose. This is similar to `as arg` but does no escaping and no quotes.

The `arg` type is the default, unless the `[[`*...*`]]` expression has double quotes on both sides, in which case `escaped` is the default.

### See also
> [Client commands](https://ref.dm-lang.org/skin/commands/index.md)
