master ohmu/fastfetch-openbsd / src / common / apple / osascript.m
ohmu  ·  2026-10-15
 1#include "osascript.h"
 2
 3#import <Foundation/Foundation.h>
 4
 5bool ffOsascript(const char* input, FFstrbuf* result)
 6{
 7    NSAppleScript* script = [NSAppleScript.alloc initWithSource:@(input)];
 8    NSDictionary* errInfo = nil;
 9    NSAppleEventDescriptor* descriptor = [script executeAndReturnError:&errInfo];
10    if (errInfo)
11        return false;
12
13    ffStrbufSetS(result, descriptor.stringValue.UTF8String);
14    return true;
15}