dreamer2908

Add tags (demo)

Jun 7th, 2014
300
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. export script_name = "Add tags"
  2. export script_description = "Just a demo script"
  3. export script_author = "dreamer2908"
  4. export script_version = "0.1"
  5.  
  6. processSubtitle = (subtitle, selected, active, tags) ->
  7. for si,li in ipairs(selected)
  8. line = subtitle[li]
  9. line.text = "{"..tags.."}"..line.text
  10. subtitle[li] = line
  11. return selected
  12.  
  13. mainDialog = {
  14. {class:"label",x:0,y:0,width:1,height:1,label:"Tags to add:"},
  15. {class:"edit", name:"tags", value:"", x:1, y:0}
  16. }
  17.  
  18. macro_function = (subtitle, selected, active) ->
  19. pressed, results = aegisub.dialog.display(mainDialog, {"OK", "Cancel"}, {cancel:"Cancel", ok:"OK"})
  20. if pressed == "OK"
  21. tags = results.tags
  22. processSubtitle(subtitle, selected, active, tags)
  23. aegisub.set_undo_point(script_name)
  24. else aegisub.cancel()
  25. return selected
  26.  
  27. aegisub.register_macro(script_name, script_description, macro_function)
Advertisement
Add Comment
Please, Sign In to add comment