# Inline Functions

**Requirement:** Rainmeter 4.1 or later.

**Syntax of inline functions:**

{% code title="" %}

```
[&Measure:Function(parameter, parameter, ...)]
```

{% endcode %}

{% hint style="info" %}
Comma is used for separating inline function parameters. If your script or string have comma , draps them inside double quotes.
{% endhint %}

&#x20;`DynamicVariables = 1` MUST be set on any measures or meters where inline function is used.

**Example usage:**

{% code title="" %}

```php
[Psrm]
Measure = Plugin
Plugin = PowershellRM
Line = function Nuzzle($num) { return "Rawr x$($num)!" }
Line2 = $weedNumber = 420

[TextMeter]
Meter = String
Text = [&Psrm:Invoke(Nuzzle 3)]
W = [&Psrm:Variable(weedNumber)]
SolidColor = 000000
FontColor = FFFFFF
FontSize = 30
DynamicVariables = 1
```

{% endcode %}

![](/files/-LWzkAcVHIlwvp30hZR2)

## `Invoke`

**Syntax: `[&Measure:Invoke(script)]`**

invokes **`script`** and last output object will be section variable value.

## `Variable`

**Syntax:** `[&Measure:Variable(variableName[, defaultValue])`

Get a PowerShell variable value.&#x20;

Optionally, you can set `defaultValue` to fallback to when runspace is not ready or variable is not available. Default `defaultValue` is blank string.

## `Expand`

**Syntax:** `[&Measure:Expand(input)]`

Returns `input` string with all of the variable and expression substitutions done.

{% code title="Example Expand usage" %}

```
[&Weather:Expand(Today is $($condition)`nTemp: $($tempC * 9 / 5 + 32) F)]
```

{% endcode %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://khanhas.gitbook.io/powershellrm/inline-functions.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
