From 472fc5337dc41abc9545256720f3265f466f9b16 Mon Sep 17 00:00:00 2001 From: garret Date: Sat, 9 Oct 2021 15:20:50 +0100 Subject: add depctrl thing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit no feed yet, will get round to it eventuallyâ„¢ --- macros/garret.a-b.lua | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 macros/garret.a-b.lua (limited to 'macros/garret.a-b.lua') diff --git a/macros/garret.a-b.lua b/macros/garret.a-b.lua new file mode 100644 index 0000000..aa0ccd9 --- /dev/null +++ b/macros/garret.a-b.lua @@ -0,0 +1,45 @@ +script_name = "A-B" +script_description = "makes checking pre-timing possible." +script_author = "garret" +script_version = "2.1.0" + +local haveDepCtrl, DependencyControl, depctrl = pcall(require, "l0.DependencyControl") +if haveDepCtrl then + depctrl = DependencyControl { + --feed="TODO", + } +end + +function switch_number(i) + if i == "a" then + return "b" + elseif i == "b" then + return "a" + end +end + +function main(sub, sel) + local i = "a" + for si,li in ipairs(sel) do + line = sub[li] + if line.actor == "" then + indicator = i + else + indicator = line.actor.." "..i + end + if line.text == "" then + line.text = indicator + elseif line.text:gsub("{[^}]-}","") == "" then + line.text = indicator.." "..line.text + end + sub[li] = line + i = switch_number(i) + end + aegisub.set_undo_point(script_name) +end + +if haveDepCtrl then + depctrl:registerMacro(main) +else + aegisub.register_macro(script_name, script_description, main) +end -- cgit v1.2.3-70-g09d2