Comments

Grazie wrote on 10/23/2010, 9:16 AM
I don't have John's, but Gilles is working fine. I did a re-inmstall of it, maybe that did it?

Grazie
JohnnyRoy wrote on 10/23/2010, 9:17 AM
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;
}
}
}

return null;
}

}


~jr
Rosebud wrote on 10/23/2010, 10:45 AM
In Gilles Pialat script there is an error in configurator script and it's impossible to set up location of editor exe file.

Please, can you add more details.
My script works fine here with VP10.
RRA wrote on 10/24/2010, 4:37 AM
Hi John,

Thank you for answer. It has showed me, that mistake is on my side : error in copying, "code block" as a part of script.

Now scripts works properly.

Best regards,
RRA wrote on 10/24/2010, 4:44 AM
Hi Rosebud,

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)

-----------------------------------------------------------------------------

PS> SVP10 64 is installed as only one instance of Vegas on this computer (there was no upgrade from 8,9 as usually).

What do you mean "reinstall" ? I have only DDLs and PNG file and I'm just copying them to :

C:\Program Files\Sony\Vegas Pro 10.0\Script Menu

Best regards.
RRA wrote on 10/24/2010, 5:14 AM
Hi Rosebud,

One more remark :

can execute SETTING script from :

C:\Users\RRA\AppData\Roaming\Sony\Vegas Pro\Application Extensions

... and it creates "Open In Graphic Editor Setting.config" file.

But in this case can't run V1 without error and can't see OpenInGraphicEditor in script list under "Customize Toolbar" command.

My system is Windows 7 64 Ulimate.

Best regards,
RRA wrote on 10/24/2010, 5:28 AM
Hi Rosebud,

Problem solved. I have created folder :

C:\Users\RRA\AppData\Roaming\Sony\Vegas Pro\Script Menu

and now script works properly and is visible in Customize Toolbar list.

Problem was connected with user rights. In my setup this script can't run from default script folder which is located in :

C:\Program Files\Sony\Vegas Pro 10.0\Script Menu

Best regards,