Mine works fine for me in Vegas Pro 10. Did you change the path to point to your graphics editor? What error are you getting?
Here it is again right from my PC where I've been using it all morning in SVP10. You have to change the String graphicsProgram = ... to point to your graphics program:
//*******************************************************************
//* Program: OpenInGraphicEditor.cs
//* Author: John Rofrano
//* Updated: December 27, 2009
//* Copyright: (c) 2009, John Rofrano, All Rights Reserved
//********************************************************************
using System;
using System.Diagnostics;
using System.Windows.Forms;
using Sony.Vegas;
public class EntryPoint
{
String graphicsProgram = @"C:\Program Files (x86)\Adobe\Adobe Photoshop CS5\Photoshop.exe";
public void FromVegas(Vegas vegas)
{
try
{
VideoEvent videoEvent = FindFirstSelectedVideoEvent(vegas.Project);
if (videoEvent != null && videoEvent.ActiveTake != null)
{
Process.Start(graphicsProgram, "\"" + videoEvent.ActiveTake.MediaPath + "\"");
}
else
{
MessageBox.Show("You must select a video event before running this script", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
catch (Exception e)
{
MessageBox.Show(e.Message, "Critical Error", MessageBoxButtons.OK, MessageBoxIcon.Stop);
}
}
/// <summary>
/// Returns the first selected video event
/// </summary>
/// <param name="project"></param>
/// <returns>The first selected video event or null if no video event selected</returns>
public VideoEvent FindFirstSelectedVideoEvent(Project project)
{
foreach (Track track in project.Tracks)
{
// only check video tracks
if (!track.IsVideo()) continue;
foreach (VideoEvent videoEvent in track.Events)
{
if (videoEvent.Selected)
{
return videoEvent;
}
}
}
I can't run main script, because before I have to run SETTINGS script (to set up path for graphic editor and to decide open and edit original or take. I run SETTING script, browse for path, decide "as take" and when push OK error message appears :
-----------------------------------------------------------------------------
Exeption thrown by method called.
Details :
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Security.SecurityException: The source was not found, but some or all event logs could not be searched. Inaccessible logs: Security.
at System.Diagnostics.EventLog.FindSourceRegistration(String source, String machineName, Boolean readOnly)
at System.Diagnostics.EventLog.SourceExists(String source, String machineName)
at System.Diagnostics.EventLog.VerifyAndCreateSource(String sourceName, String currentMachineName)
at System.Diagnostics.EventLog.WriteEvent(EventInstance instance, Byte[] data, Object[] values)
at System.Diagnostics.TraceSource.TraceEvent(TraceEventType eventType, Int32 id, String format, Object[] args)
at Sony.Vegas.ScriptHost.HandleScriptThreadException(Object sender, ThreadExceptionEventArgs args)
at System.Windows.Forms.Application.ThreadContext.OnThreadException(Exception t)
at System.Windows.Forms.Control.WndProcException(Exception e)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Form.ShowDialog(IWin32Window owner)
at EntryPoint.FromVegas(Vegas vegas)
The Zone of the assembly that failed was:
MyComputer
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at Sony.Vegas.ScriptHost.ScriptManager.Run(Assembly asm, String className, String methodName)
at Sony.Vegas.ScriptHost.RunScript(Boolean fCompileOnly)