|
|||||||||
|
Thread Tools | Search this Thread |
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 |
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 [SCVU] JETDV Scripts/Scripting Tutorials/Excalibur/Montage Magic/Newsletters |
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 |
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 [SCVU] JETDV Scripts/Scripting Tutorials/Excalibur/Montage Magic/Newsletters |
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. |
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 [SCVU] JETDV Scripts/Scripting Tutorials/Excalibur/Montage Magic/Newsletters |
| ||||||
|
|