forked from mia/Aegisub
a067bd560d
1. cd aegisub/ 2. svn mv *cpp *h src/ 3. svn mv Makefile.am MatroskaParser.c auto4_perldata.inc bitmaps boost \ changelog.txt config gl include libosxutil libresrc md5.c msvc mythes.cxx \ mythes.hxx res.rc src/ 4. cd .. 5. svn mv FFmpegSource2/ INSTALL Makefile.am README acinclude.m4 \ autogen.sh automation/ bin build configure.in desktop dummy.txt lib \ libass/ m4macros/ packages/ po/ scripts/ universalchardet/ aegisub/ 6. mkdir -p docs/wiki_convert 7. svn add docs/wiki_convert 8. cd docs 9. svn mv aegisub_convert_docs.pl convert.bat output wiki_convert/ * See r2749 for full description. Originally committed to SVN as r2752.
32 lines
1,006 B
Lua
32 lines
1,006 B
Lua
-- Automation 4 test file
|
|
-- Create a Macro feature, that displays some text
|
|
|
|
script_name = "Automation 4 set-selection test"
|
|
script_description = "Test setting the grid selection"
|
|
script_author = "Niels Martin Hansen"
|
|
script_version = "1"
|
|
|
|
|
|
function selecttest(subtitles, selected_lines, active_line)
|
|
-- get line-id of first selected line
|
|
local lid = selected_lines[1]
|
|
-- insert a copy of line 'lid' before itself
|
|
subtitles[-lid] = subtitles[lid]
|
|
-- append a copy of the copy of the copied line
|
|
subtitles[0] = subtitles[lid]
|
|
-- grab the copied line
|
|
local l = subtitles[lid]
|
|
-- modify it
|
|
l.text = "A4 was here!"
|
|
-- and store it back
|
|
subtitles[lid] = l
|
|
-- select some new lines
|
|
selected_lines = { lid-1, lid, lid+1 }
|
|
-- and set undo point (never forget!)
|
|
aegisub.set_undo_point("Insert+select Stuff")
|
|
-- return the new selection
|
|
return selected_lines
|
|
end
|
|
|
|
|
|
aegisub.register_macro("Insert+select stuff", "Inserts some lines near the active line and selects the new lines", selecttest, nil)
|