Skip to content

Instantly share code, notes, and snippets.

@that4chanwolf
Created February 10, 2014 06:06
Show Gist options
  • Save that4chanwolf/8911081 to your computer and use it in GitHub Desktop.
Save that4chanwolf/8911081 to your computer and use it in GitHub Desktop.
inb4, an aegisub script that adds content before a line. This has probably been done 200 billion times but whatever.
-- Do whatever you want.
script_name = "inb4"
script_description = "Adds content before selected lines. Useful for OPs where you want \\fads or \\blurs, like every Commie OP ever."
script_author = "t4w"
script_version = "0.0.1a"
function inb4(subs, sel)
local t = ipairs(sel)
for __, i in ipairs(sel) do
aegisub.progress.task("inb4ing line " .. string.format("%d", i+1))
local line = subs[i]
line.text = res.inb4 .. line.text
subs[i] = line
end
end
function dialog(subs, sel)
gooey = {
{ x = 0, y = 0, width = 10, height = 1, class = "edit", name = "inb4", value = "{\\fad(200,200)\\blur4}" },
}
buttons = { "Insert Before", "Cancel" }
pressed, res = aegisub.dialog.display(gooey,buttons,{cancel='Cancel'})
if pressed=="Insert Before" then
inb4(subs, sel)
end
end
function main(subs, sel)
dialog(subs, sel)
aegisub.set_undo_point(script_name)
return sel
end
aegisub.register_macro(script_name, script_description, main)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment