To make the script active, you need to save it and double-click the file. What it does is it pastes the text "My First Script" when you press Ctrl+J. If you open your file in Windows 10, an empty script will look like this: Don't worry, though - you don't have to be a programming guru to be able to write simple scripts for your subtitling work. This will open a text editor window in which you enter your code. To modify it, right-click on the file and click "Edit Script". You need to download and install the program, and after that you'll be able to work with macro scripts. There are many tools for creating macros, but I prefer the one called AutoHotkey, because it's quite powerful yet lightweight and unintrusive. Over the years, I've found that macros are the best way to do that due to their simplicity and effectiveness, and in this blog post I'd like to share some of the uses I've found for them. Monotonous work to me is what garlic's to vampires, but when it is inevitable, I strive to minimize it. I also just thought of another method that wouldn't require tracking deleted lines (merge all lines to 1.N inside the loop then truncate the list at N) but that's an exercise for another day.When I'm assigned a project that involves a large number of repetitive actions to complete, the first thing I usually do is try to find a way to somehow automate it. If you only want to merge two lines at a time, even if the result is a short line, change the inner while.do to an if.then. Advance current line to the next one, which should be after any merged lines next_line.textĬurrent_line.end_time = next_line.end_time Should this test that the next line time is immediately after the current line?Ĭurrent_line.text = current_line.text. If next_line then - Is there a next line? L_next, next_line = get_dialogue_line(l_next) While l_next <= #subs and string.len(current_line.text) < 55 do L_num,current_line = get_dialogue_line(l_num) Returned line number is >#subs if not found. Fetch a dialog line starting from this index. So with the desired result being that you want all lines to have a minimum length (ignoring that string length isn't text length in non-English languages). If that is short then you're merging 2+3 into line 2 which will end up being deleted. The next loop you check line 2 which is already merged into 1. So if line 1 is short then you change it to 1+2. The problem I see is that you're checking each line, even after merging a line. But the main site isn't working for me and I think this is an older copy of the docs I'm reading. So my question is does anybody know what that error is/ why Im getting it for something like assigning a variable?Īlso looking for any tips, advice, resources that will help me on my way.ĭoes the lete function accept line objects for deletion or only line numbers? The documentation I'm reading only shows an example using numbers. 'and string.len(l.text) File "", line -1 ? requested out-of-range line from subtitle file: 529' 'and string.sub(l.text, -1) = ending_character then ' It works as intended, so Ive been trying to edit the code to join lines under a certain character length by removing the ending character variable and replacing So this was the closest pre-existing script I could find. I want the script to join the first two lines in a script together until they hit a certain character limit, then move on to the next, so that all my lines are a similar character limit. I dont have alot of coding experience, but I am trying to automate a process in aegisub that will make my life alot easier.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |