Set variable value based on Vegas current horizontal Zoom level

Rednroll wrote on 7/18/2019, 4:42 PM

Hi scripting gurus.

I was provided a script which I believe may have been originally written by Edward Troxel. It's a script which performs slip editing on an event which I can then assign to a keyboard short-cut in Vegas so I can essentially use a key to perform the slip editing function on a media event in Vegas. This solves my original problem I was trying to achieve.

I'ld like to be able to modify this script one step further so that it works more like all the other Vegas event editing keypad short-cut assignment commands.

Here's the script:

import System;
import System.IO;
import System.Windows.Forms;
import ScriptPortal.Vegas;var Slip = new Timecode("00:00:00:01"); //Change this to be slip amounttry {  
  var trackEnum = new Enumerator(Vegas.Project.Tracks);
  while (!trackEnum.atEnd()) {
    var track : Track = Track(trackEnum.item());    
    var eventEnum = new Enumerator(track.Events);
    while (!eventEnum.atEnd()) {
      var evnt : TrackEvent = TrackEvent(eventEnum.item());      if (evnt.Selected) {
          var tke = evnt.ActiveTake;
    var tkeoffset = tke.Offset;
        tkeoffset = tkeoffset + Slip;
               tke.Offset = tkeoffset;
} catch (e) {

As an example within Vegas.

"Move selected events one frame left/right = Numeric Keypad 1/3"

"Move selected events one pixel left/right = Numeric Keypad 4/6"

The script in it's current state allows me to define the Slip amount to be "one frame" thus solving the 1st part of allowing me to assign keys to a slip "one frame" (ie Num KB 1/3 assignment function), as well as any other specific value amount I wish to plug into the script. However, the "one pixel" value amount is based upon the user's current horizontal zoom level and that's what I'm trying to achieve within this script. I want that slip amount value to be based off of the current horizontal zoom level, where the further out the zoom level is, the higher the value of the slip amount value should be.

What I'm imagining needs to be added, is that the slip amount needs to be a variable instead of an actual value. Then the script needs to be able to get the users current horizontal zoom level value from Vegas and based upon that returned zoom value amount, set the variable value for the slip amount.

I looked through the Vegas API website and I couldn't find a defined command which would get the current horizontal zoom level of the track view.

Is this even possible? Can someone help me modify this script to do what I'm after?

I'm not a programmer, but I can typically understand what needs to happen within the code to achieve the results I'm after but the available commands, syntax, and accessing the information is where I need help from the experts. I took my 1st steps of scrolling through the API commands but now I'm stuck since nothing jumped out at me in being able get the horizontal zoom level from Vegas.





No comments yet - be the first to write a comment...