Icon.SetIcon
------------

Sets the icon for the file or directory at the specified path.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [QuickLook](component_QuickLook.md) [Files](component_Files.md) | [2.7](newinversion27.md) | ✅ Yes | ❌ No | ❌ No | ✅ Yes, on macOS | ❌ No |

MBS( "Icon.SetIcon"; Path; Image ) 

**MBS**( **"Icon.SetIcon";** /\* Sets the icon for the file or directory at the specified path. \*/  
**$Path**; /\* The path to the file or folder.e.g. "/Applications" \*/   
**$Image**) /\* A container value with some picture. Can be JPEG, GIF, BMP, PNG or TIFF. \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| Path | The path to the file or folder. | "/Applications" |
| Image | A container value with some picture. Can be JPEG, GIF, BMP, PNG or TIFF. | $image |

### Result

Returns OK on success.

### Description

Sets the icon for the file or directory at the specified path.  
See also [App.SetDockIcon](AppSetDockIcon.md) to change the app icon.  
  
This function requires a native path. Use [Path.FileMakerPathToNativePath](PathFileMakerPathToNativePath.md) to convert a FileMaker path to a native path if required. If you like to have the user choose the path, you can use [FileDialog](component_FileDialog.md) functions.  
For Server be aware that server has limited permissions and may not be able to access all files on a computer.  
### Examples

Sets icon of a file on the desktop:

 MBS ("Icon.SetIcon"; "/Users/Christian/Desktop/test.pdf"; Data::image )  
### See also

- [App.SetDockIcon](AppSetDockIcon.md)
- [Icon.GetIcon](IconGetIcon.md)
- [Path.FileMakerPathToNativePath](PathFileMakerPathToNativePath.md)

### Release notes

- **Version 11.3**
    - Changed [Icon.GetIcon](https://www.mbsplugins.eu/IconGetIcon.shtml), [Icon.SetIcon](https://www.mbsplugins.eu/IconSetIcon.shtml) and [Icon.GetIconWithQuickLook](https://www.mbsplugins.eu/IconGetIconWithQuickLook.shtml) functions to better handle memory management on macOS.

### Example Databases

- [Mac only/Icon and QuickLook/SetIcon](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Mac%20only/Icon%20and%20QuickLook/SetIcon.shtml#1ScriptAnchor_)

### Blog Entries

- [MBS FileMaker Plugin, version 11.3pr5](https://www.mbsplugins.de/archive/2021-06-28/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)
- [MBS Filemaker Plugin, version 2.7fc](https://www.mbsplugins.de/archive/2012-05-08/MBS_Filemaker_Plugin_version_2/monkeybreadsoftware_blog_filemaker)
- [MBS Filemaker Plugin 2.7 Release notes](https://www.mbsplugins.de/archive/2012-05-08/MBS_Filemaker_Plugin_27_Releas/monkeybreadsoftware_blog_filemaker)
- [MBS Filemaker Plugin, version 2.7pr8](https://www.mbsplugins.de/archive/2012-05-03/MBS_Filemaker_Plugin_version_2/monkeybreadsoftware_blog_filemaker)

This function checks for a license.

Created 18th August 2014 , last changed 13th November 2023

  
[Icon.GetIconWithQuickLook](IconGetIconWithQuickLook.md) - [ImageCapture.CameraInfo](ImageCaptureCameraInfo.md)

[HTML Version](IconSetIcon.shtml)