Topics   All   MacOS (Only)   Windows (Only)   Linux (Only, Not)   iOS (Only, Not)  
Components   Crossplatform Mac & Win   Server   Client   Old   Deprecated   Guides   Examples   Videos
New in version: 10.1   10.2   10.3   10.4   10.5   11.0   11.1   11.2   11.3   11.4    Statistic    FMM    Blog  

MetaDataQuery.SetQueryString

Sets the predicate to search.

Component Version macOS Windows Linux Server iOS SDK
MetaDataQuery 8.0 ✅ Yes ❌ No ❌ No ✅ Yes, on macOS ✅ Yes
MBS( "MetaDataQuery.SetQueryString"; Query; QueryString )   More

Parameters

Parameter Description Example
Query The reference number of the query. $query
QueryString The query string. "kMDItemContentType=\"com.apple.application-bundle\""

Result

Returns OK or error.

Description

Sets the predicate to search.
The plugin will build the predicate with the given query string.
Setting this property while a query is running stops the query and discards the current results. The receiver immediately starts a new query.

See list of metadata keys here:
https://developer.apple.com/documentation/coreservices/file_metadata/mditem/common_metadata_attribute_keys

Expression syntax:
https://developer.apple.com/library/archive/documentation/Carbon/Conceptual/SpotlightQuery/Concepts/QueryFormat.html#//apple_ref/doc/uid/TP40001849-CJBEJBHH

Examples

Search for applications

MBS( "MetaDataQuery.SetQueryString"; $Query; "kMDItemContentType=\"com.apple.application-bundle\"")

Start a query:

Set Variable [ $query ; Value: MBS( "MetaDataQuery.Create" ) ]
Set Variable [ $r ; Value: MBS( "MetaDataQuery.SetQueryString"; $Query; "kMDItemContentType=\"com.apple.application-bundle\"") ]
Set Variable [ $r ; Value: MBS( "MetaDataQuery.StartQuery"; $Query) ]

See also

Example Databases

Blog Entries

Created 16th December 2017, last changed 17th July 2020


MetaDataQuery.SetEvaluate - MetaDataQuery.SetScript

Feedback: Report problem or ask question.