summaryrefslogtreecommitdiffstats
path: root/src/common/apple/osascript.m
diff options
context:
space:
mode:
authorsumuel <samuel@yakubos.org>2026-08-17 20:44:55 +0000
committersumuel <samuel@yakubos.org>2026-08-17 20:44:55 +0000
commit76424950e373d3b04ac3dd13019151bfba3e8423 (patch)
tree4c3cfdbda039e592b9186be3e28f8d7cfd439e8a /src/common/apple/osascript.m
Add the files
Diffstat (limited to 'src/common/apple/osascript.m')
-rw-r--r--src/common/apple/osascript.m15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/common/apple/osascript.m b/src/common/apple/osascript.m
new file mode 100644
index 0000000..f17af03
--- /dev/null
+++ b/src/common/apple/osascript.m
@@ -0,0 +1,15 @@
+#include "osascript.h"
+
+#import <Foundation/Foundation.h>
+
+bool ffOsascript(const char* input, FFstrbuf* result)
+{
+ NSAppleScript* script = [NSAppleScript.alloc initWithSource:@(input)];
+ NSDictionary* errInfo = nil;
+ NSAppleEventDescriptor* descriptor = [script executeAndReturnError:&errInfo];
+ if (errInfo)
+ return false;
+
+ ffStrbufSetS(result, descriptor.stringValue.UTF8String);
+ return true;
+}