Thursday, July 9, 2020

#1 2020-06-29 03:50:43 am

Fredrik71
Member
Registered: 2019-10-23
Posts: 280

metod: filterNamesInCategories:(missing value), filterName, Parameters

I thought it wouldn't be so difficult to convert this code to ASOC.

NSArray* filters = [CIFilter filterNamesInCategories:nil];
for (NSString* filterName in filters)
{
    NSLog(@"Filter: %@", filterName);
    NSLog(@"Parameters: %@", [[CIFilter filterWithName:filterName] attributes]);
}



Here is my code.

Applescript:

on ciFilterNamesInCategories()
   set theList to current application's CIFilter's filterNamesInCategories:(missing value)
   repeat with filterName in theList
       log "Filter: " & filterName as text
       -- log "Parameters: " & (current application's CIFilter's filterWithName:filterName)
   end repeat
end ciFilterNamesInCategories

I above code give me log list of filterNamesInCategories of 207 items in Mojave.
But I have little difficulty to get the parameters in this list to work. In the original code it use
attributes but I'm not sure that is correct in ASOC.

Regards.
Fredrik


I  have skied the highest mountain without logic, and still its the imagination that take me anywhere. Its the desire of something that matters for any knowledge I have or could learn.


Filed under: Core Image, CIImage, CIFilter

Offline

 

#2 2020-06-29 04:18:43 am

Shane Stanley
Member
From:: Australia
Registered: 2002-12-07
Posts: 6397

Re: metod: filterNamesInCategories:(missing value), filterName, Parameters

Using attributes is correct. The problem is that it returns a dictionary, which converts in AppleScript to a record. And records can't be coerced to text, for logging like that. You could try logging the records themselves:

Applescript:

set theList to current application's CIFilter's filterNamesInCategories:(missing value)
repeat with filterName in theList
   log "Filter: " & filterName as text
   log (current application's CIFilter's filterWithName:filterName)'s attributes() as record
end repeat

But even then you're going to strike the problem that some of them are Cocoa values, so you'll just get ocid values.

This is probably your best approach:

Applescript:

set theList to current application's CIFilter's filterNamesInCategories:(missing value)
set theArray to current application's NSMutableArray's array()
repeat with filterName in theList
   log "Filter: " & filterName as text
   set theProps to (current application's CIFilter's filterWithName:filterName)'s attributes()'s |description|() as text
   log "Properties: " & theProps
end repeat


Shane Stanley <sstanley@myriad-com.com.au>
www.macosxautomation.com/applescript/apps/
latenightsw.com

Offline

 

#3 2020-06-29 04:52:03 am

Fredrik71
Member
Registered: 2019-10-23
Posts: 280

Re: metod: filterNamesInCategories:(missing value), filterName, Parameters

Hi Shane, Thanks so much.

2 things happen with your code...

Your first code gave me this after ca 5 minutes running.

The funny thing Google translate believe it Chines language... but I couldn't read any word from it...

(*Filter: CIAccordionFoldTransition*)
    (*«class ktxt»:Parameters: 汤㉥瑵瑸萐Ā獵晲楬瑳瀐᠀瑵瑸 椀渀瀀甀琀吀愀爀最攀琀䤀洀愀最攀敲潣萁Ā獵晲楬瑳瀁ࠀ瑵瑸Ⰰ䌀䤀䄀琀琀爀椀戀甀琀攀䐀椀猀瀀氀愀礀一愀洀攀瑵瑸᠀吀愀爀最攀琀 䤀洀愀最攀瑵瑸Ⰰ䌀䤀䄀琀琀爀椀戀甀琀攀䐀攀猀挀爀椀瀀琀椀漀渀瑵瑸䐀吀栀攀 琀愀爀最攀琀 椀洀愀最攀 昀漀爀 愀 琀爀愀渀猀椀琀椀漀渀⸀瑵瑸 䌀䤀䄀琀琀爀椀戀甀琀攀䌀氀愀猀猀瑵瑸฀䌀䤀䤀洀愀最攀瑵瑸Ḁ䌀䤀䄀琀琀爀椀戀甀琀攀吀礀瀀攀瑵瑸⠀䌀䤀䄀琀琀爀椀戀甀琀攀吀礀瀀攀䤀洀愀最攀瑵瑸␀椀渀瀀甀琀一甀洀戀攀爀伀昀䘀漀氀搀猀敲潣ḂĀ獵晲楬瑳ਂက瑵瑸 䌀䤀䄀琀琀爀椀戀甀琀攀



Your best approach was so good it include information to filters that missing reference documents.
Apple claim they have over 500 filters.

Very useful code, thanks again.


I  have skied the highest mountain without logic, and still its the imagination that take me anywhere. Its the desire of something that matters for any knowledge I have or could learn.

Offline

 

#4 2020-06-30 05:25:53 am

maro
Member
From:: Nerima, Tokyo, Japan
Registered: 2004-05-30
Posts: 106
Website

Re: metod: filterNamesInCategories:(missing value), filterName, Parameters

It seems a kind of noise. It is not Chinese language sentences, though I'm not a Chinese speaker.


I wrote thousands of AppleScript to realize my idea. Natural language interface, voice recognition commander and so on. Though my mother toungue is strange language, Japanese, my most frequently write language is AppleScript. I believe it is for making things easy and powerful.

Offline

 

#5 2020-06-30 12:51:50 pm

Fredrik71
Member
Registered: 2019-10-23
Posts: 280

Re: metod: filterNamesInCategories:(missing value), filterName, Parameters

Shane Stanley wrote:

set theList to current application's CIFilter's filterNamesInCategories:(missing value)
repeat with filterName in theList
    log "Filter: " & filterName as text
    log (current application's CIFilter's filterWithName:filterName)'s attributes() as record
end repeat



Shane, I test again your first code... to see why I got some strange characters in my output.

So I include

|description|()

into the code...
And I got same result as the second code from you.

Applescript:

set theList to current application's CIFilter's filterNamesInCategories:(missing value)
repeat with filterName in theList
   log "Filter: " & filterName as text
   log "Parameters: " & (current application's CIFilter's filterWithName:filterName)'s attributes()'s |description|() as record
end repeat


I  have skied the highest mountain without logic, and still its the imagination that take me anywhere. Its the desire of something that matters for any knowledge I have or could learn.

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)