www.jetdv.com Forum Index Edward Troxel
Vegas Scripting and Newsletters
Home of Excalibur and Montage Magic
 
 FAQ   Search   Memberlist   Usergroups   Register   Profile 
 Log in to check your private messagesLog in to check your private messages   Log inLog in 

Pre / Post Toggle?

 
Post new topic   Reply to topic    www.jetdv.com Forum Index -> Scripting FAQ
View previous topic :: View next topic  
Author Message
fredfillis



Joined: 19 Aug 2007
Posts: 27
Location: Washington DC via Australia!

PostPosted: Tue Aug 21, 2007 12:41 am    Post subject: Pre / Post Toggle? Reply with quote

Hi all,

My first post here after some reading. Great information, most of it over my head Embarassed

I'm very definitely a newb to scripting and vegas generally.

I've modified the Add B&W Effect to Selected Events to apply a Border preset and that works fine. What I really need though is to toggle the pre/post toggle when the effect is applied. Can anyone point me in the right direction?
Back to top
View user's profile Send private message
Edward Troxel
Site Admin


Joined: 14 Jul 2004
Posts: 5475

PostPosted: Tue Aug 21, 2007 2:22 am    Post subject: Reply with quote

Absolutely. You need to add the last line here. The rest is added for your reference so you can get the variable names correct:

Effect effect = new Effect(plugIn);
videoEvent.Effects.Add(effect);
effect.Preset = presetName;
effect.ApplyBeforePanCrop = true;
Back to top
View user's profile Send private message Send e-mail
fredfillis



Joined: 19 Aug 2007
Posts: 27
Location: Washington DC via Australia!

PostPosted: Tue Aug 21, 2007 11:35 am    Post subject: Reply with quote

Edward,

Thanks very much for help and the quick response. Very Happy

I noticed after the script successfully completed that Vegas was sluggish and when I selected View->Project Media that Vegas would appear to lock-up.

Do I need to release or clear some stuff out of memory after importing at the start of the script?
Back to top
View user's profile Send private message
Edward Troxel
Site Admin


Joined: 14 Jul 2004
Posts: 5475

PostPosted: Tue Aug 21, 2007 1:05 pm    Post subject: Reply with quote

Running that script should not affect Vegas in any adverse way. The script should not cause any "sluggishness". All it does is add the effect and set the pre/post flag just like you would manually do so.
Back to top
View user's profile Send private message Send e-mail
fredfillis



Joined: 19 Aug 2007
Posts: 27
Location: Washington DC via Australia!

PostPosted: Wed Aug 22, 2007 12:42 am    Post subject: Reply with quote

Thanks Edward. Probably just windows.

I've used your B&W "free" script and modified according. I'm somewhat confused (situation normal) about the differences between that script and the code snippets you posted above.

The free script is full of stuff like
Code:
var z59eba499bf=Vegas.VideoFX;
var z952c58c88c=z59eba499bf.GetChildByName(z2c9d3d09d6);


Not exactly english. Is this just your preferred way of coding or do those esoteric variable names actually relate to something?

I figured out what I needed to change, but found it a struggle keeping track of what variable was what. Maybe I'm missing the point?
Back to top
View user's profile Send private message
Edward Troxel
Site Admin


Joined: 14 Jul 2004
Posts: 5475

PostPosted: Wed Aug 22, 2007 1:03 pm    Post subject: Reply with quote

That particular script was "obfuscated" making it more difficult to read. As you can see, scripts are simply text files. And it's kind of hard to protect a text file. This was definitely more important with a product such as Excalibur. That particular script was written when I was testing ways to protect Excalibur. I just did some looking and found the "clear" version still on my hard drive:

Code:
/**
 * This script will add the B&W effect to all selected events.
 *
 * Written By: Edward Troxel
 * Copyright 2004 - JETDV Scripts
 * Modified: 10-01-2004
 **/

import System;
import System.IO;
import System.Windows.Forms;
import Sony.Vegas;


try {

  //Go through the list of Tracks
  var trackEnum = new Enumerator(Vegas.Project.Tracks);
  while (!trackEnum.atEnd()) {
    var track : Track = Track(trackEnum.item());

    //Go through the list of Events
    var eventEnum = new Enumerator(track.Events);
    while (!eventEnum.atEnd()) {
      var evnt : TrackEvent = TrackEvent(eventEnum.item());

      if (evnt.Selected) {

        var ve : VideoEvent = VideoEvent(evnt);

        var plugInName = "Sony Black and White";
        var presetName = "100% Black and White";
        var fx = Vegas.VideoFX;
        var plugIn = fx.GetChildByName(plugInName);

        var effect = new Effect(plugIn);
        ve.Effects.Add(effect);
        if (null != presetName) {
          effect.Preset = presetName;
        }

      }
      eventEnum.moveNext();
    }
    trackEnum.moveNext();
  }


} catch (e) {
    MessageBox.Show(e);
}



This version should make MUCH more sense.
Back to top
View user's profile Send private message Send e-mail
fredfillis



Joined: 19 Aug 2007
Posts: 27
Location: Washington DC via Australia!

PostPosted: Wed Aug 22, 2007 9:23 pm    Post subject: Reply with quote

Edward Troxel wrote:
That particular script was "obfuscated" making it more difficult to read.

This version should make MUCH more sense.


Thanks again Edward. I suspected that was the case. And yes, MUCH easier Very Happy
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    www.jetdv.com Forum Index -> Scripting FAQ All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB 2.0.11 © 2001, 2002 phpBB Group