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”);
}
}
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.