~~Title: Embedded functions ~~
There are several internal Opus commands that can cause a new Lister or tab to be opened - the most commonly used of these is **Go NEW** and **Go NEWTAB**. Sometimes, you might want a button or hotkey that opens a new Lister (or tab), and then executes further commands in the context of that new element. This can be achieved quite simply by embedding a function that will be passed to the new element once it has been created.
The embedded function must be surrounded with square brackets - for example, the following command would open a new Lister and put it into thumbnails mode automatically:
Go /mypictures NEW
[Set VIEW=thumbnails]
More complicated multiple line functions can also be embedded, for example:
Go NEW
[
Go /mypictures
Set VIEW=thumbnails
]
Additionally, functions can be embedded in a **Go FINDTITLE** command. These functions will be run in **all** existing Listers that match the supplied string. If no matching Listers are found, by default the embedded command will not be run at all - you can use the **RUNEMBEDDEDIFNOTFOUND** argument to cause the function to be run in the current Lister in this situation.
You can also embed functions in several [[.editing_the_toolbar:dynamic_buttons|dynamic button]] commands - for example, **Go DRIVEBUTTONS**. This lets you define a command that is added to each of the buttons generated by the function. For example,
Go DRIVEBUTTONS OPENINLEFT
[
Set FOCUS=Left
]
This command would produce drive buttons that open their folders in the left-hand file display, and automatically set the focus to that file display at the same time.
The full list of commands that currently support embedded functions are:
* **Favorites** (dynamic button command)
* **Go NEW**
* **Go NEWTAB**
* **Go FINDTITLE**
* **Go DRIVEBUTTONS** (dynamic button command)
* **Go FTPSITELIST** (dynamic button command)
* **Go FOLDERCONTENT** (dynamic button command)
* **Prefs LAYOUT**
* **Properties SETLABEL** (dynamic button command)
* **Recent** (dynamic button command)
* **Show**