2 Copyright (C) 2024 Rubén Beltrán del Río
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation, either version 3 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see https://captura.tranquil.systems.
20 class RecordCommand: NSScriptCommand {
21 override func performDefaultImplementation() -> Any? {
23 let args = self.directParameter as? [String: Any] ?? [:]
25 // Here you can extract the parameters from the args dictionary and configure your settings
26 let x = args["x"] as? Int
27 let y = args["y"] as? Int
28 let width = args["width"] as? Int
29 let height = args["height"] as? Int
30 let preventResize = args["prevent_resize"] as? Bool
31 let preventMove = args["prevent_move"] as? Bool
32 let fps = args["fps"] as? Int
33 let outputs = OutputFormatSetting(args["outputs"] as? String ?? "")
34 let backend = URL(string: args["backend"] as? String ?? "")
35 let backendOutput = OutputFormatSetting(args["backend_output"] as? String ?? "")
36 let keepLocalFiles = args["keep_local_files"] as? Bool
37 let autoStart = args["auto_start"] as? Bool
38 let maxLength = args["max_length"] as? Int
40 var skipBackend = false
41 if let backendString = args["backend"] as? String {
42 if backendString == "" {
47 let config = RecordAction(
53 preventResize: preventResize,
54 preventMove: preventMove,
58 backendOutput: backendOutput,
59 keepLocalFiles: keepLocalFiles,
61 skipBackend: skipBackend,
65 NotificationCenter.default.post(name: .setCaptureSessionConfiguration, object: nil, userInfo: [
68 NotificationCenter.default.post(name: .startAreaSelection, object: nil, userInfo: nil)
70 // Return a result if needed