View Single Post
Old 15th March 2007, 18:28   #617  |  Link
qwerpoi
Registered User
 
qwerpoi's Avatar
 
Join Date: Oct 2002
Posts: 298
Quote:
Originally Posted by Veiga View Post
Portugues translation release for v1.3.7
Thanks for the translation update, I updated the links on the first post and website accordingly.

Quote:
Originally Posted by nibbles View Post
What I've done is write a macro that when activated adds a
Code:
c2=c2.DeleteFrame(1234)
type of command in that script. Once I delete a frame from c2 for instance, I was hoping I could add some python code to my macro that reads in the second line and adds 1 to the Trim command final frame value so that the total number of frames is unchanged, like this:
Code:
c1=AVISource("K:\B\1.avi", audio=true, pixel_type="YUY2").Trim(4,143101).Crop(8,0,-8,-10,true)
c2=AVISource("J:\B\2.avi", audio=true, pixel_type="YUY2").Trim(97,143196).Crop(8,0,-8,-10,true)
c3=AVISource("J:\B\3.avi", audio=true, pixel_type="YUY2").Trim(97,143195).Crop(8,0,-8,-10,true)
But I have no idea how to parse the line and add 1 to the value.
Hmm, this is not the easiest of tasks. Unfortunately, currently there's no way to replace sections of the text with macros, but it shouldn't be difficult to add to the next version. In the meantime, you can try something like this. Change your script to be:
Code:
x = 143195

c1=AVISource("K:\B\1.avi", audio=true, pixel_type="YUY2").Trim(4,143101).Crop(8,0,-8,-10,true)
c2=AVISource("J:\B\2.avi", audio=true, pixel_type="YUY2").Trim(97,x).Crop(8,0,-8,-10,true)
c3=AVISource("J:\B\3.avi", audio=true, pixel_type="YUY2").Trim(97,143195).Crop(8,0,-8,-10,true)
where "x = 143195" is the very first line of your script (note the change "Trim(97,x)" in the c2 line). Then you can use this simple macro:
Code:
avsp.InsertText(' + 1', pos=(0,-1))
which will add a " + 1" to the end of the first line every time you run the macro. Note that the line "x = 143195" must remain in the same place, but does not need to be on the first line - if it was the 10th line then you would use a pos=(9,-1), etc. Not the prettiest solution if you plan on running this macro hundreds of times, but otherwise it gets the job done. I'll try and have some macros for positioning and replacing in the next version, but keep in mind that even with the ability to replace sections, a macro like this will likely be fragile (ie, might not work properly if you add lines to the beginning of the script, or change the name of variables, etc.) If anyone has a more clever solution, feel free to jump in.

Last edited by qwerpoi; 15th March 2007 at 18:34.
qwerpoi is offline   Reply With Quote