Components | All | New | MacOS | Windows | Linux | iOS | ||||
Examples | Mac & Win | Server | Client | Guides | Statistic | FMM | Blog | Deprecated | Old |
Icon.GetIconWithQuickLook
Queries the Finder icon for the file or folder with the given path.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
QuickLook Files | 2.3 | ✅ Yes | ✅ Yes | ❌ No | ✅ Yes, on macOS and Windows | ❌ No |
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 | Available in MBS FileMaker Plugin 13.2 or newer. 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 |
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.
Does not work on server due to missing quicklook services without an user account.
This function requires a native path. Use Path.FileMakerPathToNativePath 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 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 functions
Set Variable [ $fpath ; Value: GetAsText($input) ]
If [ Position ( $fpath ; "/" ; 1 ; 1 ) > 0 ]
Set Variable [ $path ; Value: MBS( "Path.FileMakerPathToNativePath"; $fpath) ]
If [ Length ( $path ) > 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 ) > 0 ]
# write temp file
Set Variable [ $path ; Value: MBS( "Path.AddPathComponent"; MBS( "Folders.UserTemporary" ); $fpath) ]
Set Variable [ $r ; Value: MBS("Container.WriteFile"; $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"; $path) ]
Exit Script [ Text Result: ]
End If
Set Variable [ $r ; Value: MBS("Files.Delete"; $path) ]
End If
End If
See also
- Container.WriteFile
- Files.Delete
- Folders.UserTemporary
- Icon.GetIcon
- IsError
- Path.AddPathComponent
- Path.FileMakerPathToNativePath
- QLPreviewPanel.Show
Release notes
- Version 13.2
- Added flags parameter for Icon.GetIconWithQuickLook function.
- Version 11.3
- Changed Icon.GetIcon, Icon.SetIcon and Icon.GetIconWithQuickLook functions to better handle memory management on macOS.
Example Databases
Blog Entries
- MBS FileMaker Plugin, version 13.2pr1
- MBS FileMaker Plugin, version 11.3pr5
- MBS Filemaker Plugin, version 2.3pr3
- MBS Filemaker Plugin, version 2.3pr2
- Getting icons from Files
FileMaker Magazin
This function checks for a license.
Created 18th August 2014, last changed 15th April 2023