4 class RecordCommand: NSScriptCommand {
5 override func performDefaultImplementation() -> Any? {
7 let args = self.directParameter as? [String: Any] ?? [:]
9 // Here you can extract the parameters from the args dictionary and configure your settings
10 let x = args["x"] as? Int
11 let y = args["y"] as? Int
12 let width = args["width"] as? Int
13 let height = args["height"] as? Int
14 let preventResize = args["prevent_resize"] as? Bool
15 let preventMove = args["prevent_move"] as? Bool
16 let fps = args["fps"] as? Int
17 let outputs = OutputFormatSetting(args["outputs"] as? String ?? "")
18 let backend = URL(string: args["backend"] as? String ?? "")
19 let backendOutput = OutputFormatSetting(args["backend_output"] as? String ?? "")
20 let keepLocalFiles = args["keep_local_files"] as? Bool
21 let autoStart = args["auto_start"] as? Bool
22 let maxLength = args["max_length"] as? Int
24 var skipBackend = false
25 if let backendString = args["backend"] as? String {
26 if backendString == "" {
31 let config = RecordAction(
37 preventResize: preventResize,
38 preventMove: preventMove,
42 backendOutput: backendOutput,
43 keepLocalFiles: keepLocalFiles,
45 skipBackend: skipBackend,
49 NotificationCenter.default.post(name: .setCaptureSessionConfiguration, object: nil, userInfo: [
52 NotificationCenter.default.post(name: .startAreaSelection, object: nil, userInfo: nil)
54 // Return a result if needed