> For the complete documentation index, see [llms.txt](https://chaoses-ib.gitbook.io/directory-opus/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://chaoses-ib.gitbook.io/directory-opus/manual/reference/scripting_reference/scripting_events/onviewerevent.md).

# OnViewerEvent

The **OnViewerEvent** event can be implemented by a [script add-in](/directory-opus/manual/scripting/script_add-ins.md) to receive notification whenever certain events occur in the [standalone image viewer](/directory-opus/manual/additional_functionality/viewing_images.md). One possible use would be a script that automatically displays a floating toolbar whenever a standalone viewer is active, and hides it again when the window goes inactive or closes.&#x20;

| **Method Name:**   | OnViewerEvent                                                                                                                                                                                                                                                                                                                            |
| ------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Argument Type:** | [**ViewerEventData**](/directory-opus/manual/reference/scripting_reference/scripting_objects/viewereventdata.md)                                                                                                                                                                                                                         |
| **Return Type:**   | *none*                                                                                                                                                                                                                                                                                                                                   |
| **Description:**   | The **ViewerEventData.viewer** property identifies the [**Viewer**](/directory-opus/manual/reference/scripting_reference/scripting_objects/viewer.md) that the event occurred in. The **event** property returns a string identifying the event that occurred, and if applicable the **item** property identifies the **Item** involved. |
