diff --git a/Classes/AppDelegate.swift b/Classes/AppDelegate.swift index 2240b28..a11c12f 100644 --- a/Classes/AppDelegate.swift +++ b/Classes/AppDelegate.swift @@ -229,14 +229,14 @@ final class AppDelegate: NSObject, NSApplicationDelegate { extension AppDelegate { func application(_ sender: NSApplication, delegateHandlesKey key: String) -> Bool { - if key == "items" { + if key == "queueItems" { return true } else { return false } } - @objc(items) func items() -> [QueueItem] { + @objc(queueItems) func queueItems() -> [QueueItem] { let queue = QueueController.shared let indexes = IndexSet(integersIn: 0.. Any? { guard let args = directParameter as? [URL] else { return nil } - QueueController.shared.insert(contentOf: args, at: 0) + QueueController.shared.insert(contentOf: args, at: QueueController.shared.count) + return nil + } + +} + +@objc(SBQueueStartAndWaitScriptCommand) class QueueStartAndWaitScriptCommand: NSScriptCommand { + + override func performDefaultImplementation() -> Any? { + QueueController.shared.add(script: self) + QueueController.shared.start(self) + self.suspendExecution() return nil } @@ -21,7 +32,6 @@ import Foundation override func performDefaultImplementation() -> Any? { QueueController.shared.start(self) - self.suspendExecution() return nil } diff --git a/Queue.sdef b/Queue.sdef index 1dc85f6..b61a574 100644 --- a/Queue.sdef +++ b/Queue.sdef @@ -2,8 +2,10 @@ - + + + @@ -16,34 +18,18 @@ - - - - - - - - - - - - - - - + + + - - - - - + + + - + @@ -52,6 +38,10 @@ + + + + @@ -60,38 +50,35 @@ - - + + - + - + - + - + - + - - - - + - +