Close Gap Script at DVinfo.net
DV Info Net

Go Back   DV Info Net > Windows / PC Post Production Solutions > What Happens in Vegas...
Register FAQ Today's Posts Buyer's Guides

What Happens in Vegas...
...stays in Vegas! This PC-based editing app is a safe bet with these tips.

Reply
 
Thread Tools Search this Thread
Old July 21st, 2010, 01:38 PM   #1
Regular Crew
 
Join Date: Nov 2009
Location: St. Louis, MO
Posts: 123
Close Gap Script

I am having a problem trying to get this script to work

/**
* Program:
* Description: This script will Delete Empty Space Between Events In Selected Tracks
* Author: Philip
*
* Date: August 31, 2003
**/

import Sony.Vegas;
import System.Windows.Forms;
import Microsoft.Win32;

//time intervals for split events.

try
{


// step through all selected video events:
var FirstTrack : Track = Vegas.Project.Tracks.Item(0);

// step through all selected video events:
for (var track in Vegas.Project.Tracks) {
if( !track.Selected) continue;
var tracktime = new Timecode(0);
for (var evnt in track.Events) {
var currTake = evnt.ActiveTake;
var CurrOffset = currTake.Offset;
evnt.Start = tracktime;
currTake.Offset = CurrOffset;
tracktime = tracktime + evnt.Length;
}
}
}

catch (errorMsg)
{
MessageBox.Show(errorMsg, "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}

I have it installed in Vegas Pro 9e and when I run the script it says that "An error occured during execution."

Error 0x80131600
Details are
C:\ProgramFiles\Sony\VegasPro9.0\Script Menu\DeleteEmptySpaceBetweenEvents.js(1) : Invalid character.

Any help would be appreciated.

Last edited by Jim Schuchmann; July 21st, 2010 at 02:53 PM. Reason: Corrected the Script to work
Jim Schuchmann is offline   Reply With Quote
Old July 21st, 2010, 01:48 PM   #2
Sponsor: JET DV
 
Join Date: Dec 2001
Location: Southern Illinois
Posts: 7,953
Is that the entire script? What's on line 1 of your .js file? It should be /** so if you have something else there, delete it.
Edward Troxel is offline   Reply With Quote
Old July 21st, 2010, 01:54 PM   #3
Regular Crew
 
Join Date: Nov 2009
Location: St. Louis, MO
Posts: 123
That is the entire script. I checked and there was a space following/**. I removed it and it still reports the same error.

Last edited by Jim Schuchmann; July 21st, 2010 at 02:03 PM. Reason: correction
Jim Schuchmann is offline   Reply With Quote
Old July 21st, 2010, 02:29 PM   #4
Sponsor: JET DV
 
Join Date: Dec 2001
Location: Southern Illinois
Posts: 7,953
This modified version worked for me. However, the problem I found was with the spelling of "currOffset" instead of "CurrOffset". Copy this version and replace your text with this:

Code:
/**
* Program:
* Description: This script will Delete Empty Space Between Events In Selected Tracks
* Author: Philip
*
* Date: August 31, 2003
**/

import Sony.Vegas;
import System.Windows.Forms;
import Microsoft.Win32;

//time intervals for split events.

try
{


	// step through all selected video events:
	var FirstTrack : Track = Vegas.Project.Tracks.Item(0);

	// step through all selected video events:
	for (var track in Vegas.Project.Tracks) {
		if( !track.Selected) continue;
		var tracktime = new Timecode(0);
		for (var evnt in track.Events) {
			var currTake = evnt.ActiveTake;
			var CurrOffset = currTake.Offset;
			evnt.Start = tracktime;
			currTake.Offset = CurrOffset;
			tracktime = tracktime + evnt.Length;
		}
	}
}

catch (errorMsg)
{
MessageBox.Show(errorMsg, "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
Edward Troxel is offline   Reply With Quote
Old July 21st, 2010, 02:41 PM   #5
Regular Crew
 
Join Date: Nov 2009
Location: St. Louis, MO
Posts: 123
Thanks for your help Ed.

The first part of the problem that I was having was the fact that I was creating this script in a word program and not in "Notepad". When I would open the file in my word program, it all "looked" good. When I opened it in "Notepad", it showed machine language instead of the characters I had typed.

As a Newbie to scripting I now "know" that to create or modify a script you must use "Notepad". I wonder how many other newbies have made this mistake and given up on scripting.

Hope this helps some others out there.
Jim Schuchmann is offline   Reply With Quote
Old July 21st, 2010, 02:47 PM   #6
Sponsor: JET DV
 
Join Date: Dec 2001
Location: Southern Illinois
Posts: 7,953
Yes, you definitely want to use a "plain text" editor. For those that have it, Visual Studio can make things even easier and you can set it up to do code completion for you - including the possibilities for Vegas. Makes it much easier when you can't think of the actual property name you want to get a list to choose from.
Edward Troxel is offline   Reply
Reply

DV Info Net refers all where-to-buy and where-to-rent questions exclusively to these trusted full line dealers and rental houses...

B&H Photo Video
(866) 521-7381
New York, NY USA

Scan Computers Int. Ltd.
+44 0871-472-4747
Bolton, Lancashire UK


DV Info Net also encourages you to support local businesses and buy from an authorized dealer in your neighborhood.
  You are here: DV Info Net > Windows / PC Post Production Solutions > What Happens in Vegas...


 



All times are GMT -6. The time now is 10:42 AM.


DV Info Net -- Real Names, Real People, Real Info!
1998-2024 The Digital Video Information Network