Icon.GetIconWithQuickLook
-------------------------

Queries the Finder icon for the file or folder with the given path.

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

MBS( "Icon.GetIconWithQuickLook"; Path; Size { ; Flags } ) 

**MBS**( **"Icon.GetIconWithQuickLook";** /\* Queries the Finder icon for the file or folder with the given path. \*/  
**$Path**; /\* The path to the file or folder.e.g. "/Applications" \*/   
**$Size**; /\* The size of the icon picture you'd like to have. Suggested range is from 16 to 512 pixel.e.g. 512 \*/   
**$Flags**) /\* Optional; Various flags.  
Pass 1 to not frame quicklook previews.  
Pass 2 to not return an icon, if quicklook is not available.  
Pass 3 to use both flags.e.g. 0 \*/ 

### Parameters

| Parameter | Description | Example | Flags |
|---|---|---|---|
| Path | The path to the file or folder. | "/Applications" |  |
| Size | The size of the icon picture you'd like to have. Suggested range is from 16 to 512 pixel. | 512 |  |
| Flags | Various flags.   Pass 1 to not frame quicklook previews.   Pass 2 to not return an icon, if quicklook is not available.   Pass 3 to use both flags. | 0 | Optional      Added in version **13.2**. |

### Result

Container value.

### Description

Queries the Finder icon for the file or folder with the given path.   
This method tries first to get QuickLook preview for the file, before it tries the icon. QuickLook requires macOS 10.5. Size specifies the icon size from 16 to 512 pixel. The container value returned includes PNG data with alpha, JPEG preview, filename and size.  
  
Version 4.3 adds support for Windows. We now query same thumbnail as explorer uses.  
See also [Icon.GetIcon](IconGetIcon.md).  
  
Does not work on server due to missing quicklook services without an user account.  
  
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

Queries preview on iPhoto app:

 MBS ( "Icon.GetIconWithQuickLook"; "/Applications/iPhoto.app"; 512 )  
Add picture to field:

 Set Field \[ test::pic ; MBS ("Icon.GetIconWithQuickLook"; "/Users/cs/Desktop/solar-system.png"; 512) \]  
Make preview via QuickLook:

 # try [quickLook](component_QuickLook.md) functions   
Set Variable \[ $fpath ; Value: GetAsText($input ) \]   
If \[ Position ( $fpath ; "/" ; 1 ; 1 ) &gt; 0 \]   
 Set Variable \[ $path ; Value: MBS ( "[Path.FileMakerPathToNativePath](PathFileMakerPathToNativePath.md)"; $fpath ) \]   
 If \[ Length ( $path ) &gt; 0 \]   
 Set Variable \[ $image ; Value: MBS ( "Icon.GetIconWithQuickLook"; $path ; 512; 1 ) \]   
 If \[ MBS ("IsError") = 0 \]   
 Set Field \[ Get Preview::Preview ; $image \]   
 Set Field \[ Get Preview::Made using ; "QuickLook File" \]   
 Exit Script \[ Text Result: \]   
 End If  
 End If  
Else If \[ Position ( $types ; "FNAM" ; 1 ; 1 ) &gt; 0 \]   
 # write temp file  
 Set Variable \[ $path ; Value: MBS ( "[Path.AddPathComponent](PathAddPathComponent.md)"; MBS ( "[Folders.UserTemporary](FoldersUserTemporary.md)" ); $fpath ) \]   
 Set Variable \[ $r ; Value: MBS ("[Container.WriteFile](ContainerWriteFile.md)"; $input ; $path ) \]   
 If \[ MBS ("IsError") = 0 \]   
 Set Variable \[ $image ; Value: MBS ( "Icon.GetIconWithQuickLook"; $path ; 512; 1 ) \]   
 If \[ MBS ("IsError") = 0 \]   
 Set Field \[ Get Preview::Preview ; $image \]   
 Set Field \[ Get Preview::Made using ; "QuickLook Container" \]   
 Set Variable \[ $r ; Value: MBS ("[Files.Delete](FilesDelete.md)"; $path ) \]   
 Exit Script \[ Text Result: \]   
 End If  
 Set Variable \[ $r ; Value: MBS ("[Files.Delete](FilesDelete.md)"; $path ) \]   
 End If  
End If  
### See also

- [Container.WriteFile](ContainerWriteFile.md)
- [Files.Delete](FilesDelete.md)
- [Folders.UserTemporary](FoldersUserTemporary.md)
- [Icon.GetIcon](IconGetIcon.md)
- [IsError](IsError.md)
- [Path.AddPathComponent](PathAddPathComponent.md)
- [Path.FileMakerPathToNativePath](PathFileMakerPathToNativePath.md)
- [QLPreviewPanel.Show](QLPreviewPanelShow.md)

### Release notes

- **Version 13.2**
    - Added flags parameter for [Icon.GetIconWithQuickLook](https://www.mbsplugins.eu/IconGetIconWithQuickLook.shtml) function.
- **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

- [Containers/Create Container Preview](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Containers/Create%20Container%20Preview.shtml#1ScriptAnchor_)
- [Mac only/Icon and QuickLook/Icons](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Mac%20only/Icon%20and%20QuickLook/Icons.shtml#7ScriptAnchor_)

### Blog Entries

- [MBS FileMaker Plugin, version 13.2pr1](https://www.mbsplugins.de/archive/2023-04-01/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)
- [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.3pr3](https://www.mbsplugins.de/archive/2011-04-13/MBS_Filemaker_Plugin_version_2/monkeybreadsoftware_blog_filemaker)
- [MBS Filemaker Plugin, version 2.3pr2](https://www.mbsplugins.de/archive/2011-03-28/MBS_Filemaker_Plugin_version_2/monkeybreadsoftware_blog_filemaker)

### FileMaker Magazin

- [Ausgabe 4/2020, Seite 34](https://filemaker-magazin.de/neuigkeit/4103-Appetithappen-FMM_202004)

This function checks for a license.

Created 18th August 2014 , last changed 15th April 2023

  
[Icon.GetIcon](IconGetIcon.md) - [Icon.SetIcon](IconSetIcon.md)

[HTML Version](IconGetIconWithQuickLook.shtml)