Friday, December 15, 2017

#1 2015-10-16 05:27:53 pm

ozcanesen
Member
Registered: 2015-10-16
Posts: 2

How to list all handler applications for URL scheme?

For example this objective-c code lists all applications that can open https, can i do the same using applescript?

#import <Foundation/Foundation.h>
#import <ApplicationServices/ApplicationServices.h>

int main (int argc, const char * argv[])
{
                CFStringRef https = CFSTR("https");
                CFArrayRef availableBrowsers = LSCopyAllHandlersForURLScheme(https);
                CFIndex availableBrowserCount = CFArrayGetCount(availableBrowsers);
                NSUInteger i;
        for (i = 0; i < availableBrowserCount; i++) {
            NSString *browserBundleIdentifier = (NSString*)CFArrayGetValueAtIndex(availableBrowsers, i);
            printf(" %-45.45s", [browserBundleIdentifier UTF8String]);
            printf("\n");
        }
}

Offline

 

#2 2015-10-16 05:51:04 pm

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

Re: How to list all handler applications for URL scheme?

No, you can't do it directly from AppleScript. You'd need to add an Objective-C class with code similar to that you posted, and call it from your script.


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

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)