mirror of
https://github.com/FBukovina/Atoll.git
synced 2026-10-27 15:14:33 +00:00
Working Indicators
This commit is contained in:
parent
79eb1311bf
commit
1a45d4e7f4
16 changed files with 629 additions and 17 deletions
28
DynamicIsland/helpers/AppleScriptRunner.swift
Normal file
28
DynamicIsland/helpers/AppleScriptRunner.swift
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
//
|
||||
// AppleScriptRunner.swift
|
||||
// DynamicIsland
|
||||
//
|
||||
// Adapted from TheBoringWorker-HUD
|
||||
// Created by GitHub Copilot on 06/09/25.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
class AppleScriptRunner {
|
||||
private init() {}
|
||||
|
||||
static func run(script: String) throws -> String {
|
||||
var error: NSDictionary?
|
||||
if let scriptObject = NSAppleScript(source: script) {
|
||||
let output: NSAppleEventDescriptor = scriptObject.executeAndReturnError(&error)
|
||||
guard error == nil else {
|
||||
throw AppleScriptError.runtimeError
|
||||
}
|
||||
if let outputString = output.stringValue {
|
||||
return outputString
|
||||
}
|
||||
throw AppleScriptError.emptyOutput
|
||||
}
|
||||
throw AppleScriptError.initScriptFailed
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue