Window.SetTag
-------------

Sets tag for window.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [Window](component_Window.md) | [6.3](newinversion63.md) | ✅ Yes | ✅ Yes | ❌ No | ❌ No | ❌ No |

MBS( "Window.SetTag"; WindowRef { ; Tag } ) 

**MBS**( **"Window.SetTag";** /\* Sets tag for window. \*/  
**$WindowRef**; /\* Window Reference is the unique OS level window ID. You can obtain this by using the [Window.FindByTitle](WindowFindByTitle.md) or [Window.FindByIndex](WindowFindByIndex.md) functions. Pass zero to access the frontmost window.e.g. 0 \*/   
**$Tag**) /\* Optional; The new tag value.  
Empty text if not provided. \*/ 

### Parameters

| Parameter | Description | Example | Flags |
|---|---|---|---|
| WindowRef | Window Reference is the unique OS level window ID. You can obtain this by using the [Window.FindByTitle](WindowFindByTitle.md) or [Window.FindByIndex](WindowFindByIndex.md) functions. Pass zero to access the frontmost window. | 0 |  |
| Tag | The new tag value.   Empty text if not provided. |  | Optional |

### Result

Returns OK or error.

### Description

Sets tag for window.  
The MBS Plugin manages a list of open windows, so you can set tag value for a window.  
Please be aware that referencing windows just by name is not good as window names may not be unique.  
Use [Window.Current](WindowCurrent.md) to get ID for current window. Or use function [Window.SetCurrentTag](WindowSetCurrentTag.md) to set tag of current window.  
### See also

- [Window.Current](WindowCurrent.md)
- [Window.FindByIndex](WindowFindByIndex.md)
- [Window.FindByTitle](WindowFindByTitle.md)
- [Window.GetTag](WindowGetTag.md)
- [Window.GetTop](WindowGetTop.md)
- [Window.SetCurrentTag](WindowSetCurrentTag.md)

### Example Databases

- [Window/Schedule Moved Trigger](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Window/Schedule%20Moved%20Trigger.shtml#1ScriptAnchor_)

### Blog Entries

- [Script trigger for moving window](https://www.mbsplugins.de/archive/2022-10-07/Script_trigger_for_moving_wind/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 6.3pr3](https://www.mbsplugins.de/archive/2016-06-19/MBS_FileMaker_Plugin_version_6/monkeybreadsoftware_blog_filemaker)

This function is free to use.

Created 10th June 2016 , last changed 14th July 2022

  
[Window.SetShowsToolbarButton](WindowSetShowsToolbarButton.md) - [Window.SetTitle](WindowSetTitle.md)

[HTML Version](WindowSetTag.shtml)