The predicate of an extended action activation rule does not hide an action when selecting several identical types

Hello, I am trying to make an extension of the action for working with only one GIF file. Here is my code (created using the snippet provided in the Apple documentation:

SUBQUERY ( extensionItems, $extensionItem, SUBQUERY ( $extensionItem.attachments, $attachment, ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "com.compuserve.gif" ) .@count == $extensionItem.attachments.@count ) .@count == 1 

This extension should work inside the Photos application, and I tried several scenarios: one GIF file, one non-GIF file, several non-GIF files, mixing GIF and non-GIF files, and several GIF files.

All of the scenarios described above work, except for a few GIF files - if I select several elements, the action reappears.

I want the action to appear only when using a single GIF. What am I doing wrong with the predicate above?

0
source share
1 answer

From debugging the code, it seems like this is a separate extension item with a bunch of attachments. Therefore, to support only one attachment, you must do the following:

Replace $ extensionItem.attachments. @count with 1.

This should hide the extension if you select more than one GIF file.

+1
source

Source: https://habr.com/ru/post/1260229/


All Articles