im trying to make it easier for myself i have 2 scripts i am working on and i am not good at coding and i am running into error after error i wanted to be able to use a script to take the information from the earliest event on the timeline selected and then put that information onto the other selected events further ahead that are selected so bassically 1 would be giving the information to the others but i dont want to paste event attributes i want to only paste the events onto the other events that have picture in picture on them but only the first picture in picture on each even so all the events have 2 pip on them and i want to take the info from the first one and then paste it to the other ones but just on the first pip in the fx line sorry if what i am saying is confusing or doesnt make any sense but here is the script ive come up with so far
using System; using System.Windows.Forms; using ScriptPortal.Vegas; using System.Collections.Generic;public class EntryPoint { public void FromVegas(Vegas vegas) { CopyPIPSettings(vegas); } public void CopyPIPSettings(Vegas vegas) { // Get the selected events var selectedEvents = new List<TrackEvent>(); foreach (Track track in vegas.Project.Tracks) { foreach (TrackEvent evnt in track.Events) { if (evnt.Selected) { selectedEvents.Add(evnt); } } } if (selectedEvents.Count < 2) { MessageBox.Show("Select at least two events.", "Error"); return; } // Get the source PIP event TrackEvent sourceEvent = selectedEvents[0]; // Find all Picture in Picture effects on the source event List<Effect> sourcePIPs = new List<Effect>(); if(sourceEvent is VideoEvent) { foreach (Effect fx in ((VideoEvent)sourceEvent).Effects) { if (fx.PlugIn.Name == "Picture in Picture") { sourcePIPs.Add(fx); } } } if (sourcePIPs.Count == 0) { MessageBox.Show("The first selected event does not have a Picture in Picture effect.", "Error"); return; } // Apply the effect to the remaining events for (int i = 1; i < selectedEvents.Count; i++) { TrackEvent targetEvent = selectedEvents[i]; // Apply each of the PIP effects foreach(Effect sourcePIP in sourcePIPs){ // Get the source PIP effect settings var sourcePIPsettings = new Dictionary<string, object>(); if(sourcePIP.PlugIn.IsOFX) { foreach (OFXParameter prop in sourcePIP.OFXEffect.Parameters) { if(prop is OFXParameter<object, OFXKeyframe>) { sourcePIPsettings[prop.Name] = ((OFXParameter<object, OFXKeyframe>)prop).Value; } } } Effect targetPIP = null; if(targetEvent is VideoEvent) { foreach (Effect fx in ((VideoEvent)targetEvent).Effects) { if (fx.PlugIn.Name == "Picture in Picture") { targetPIP = fx; break; } } if (targetPIP == null) { targetPIP = ((VideoEvent)targetEvent).Effects.AddEffect(vegas.VideoFX.FindChildByName("Picture in Picture")); } if(targetPIP.PlugIn.IsOFX) { foreach (OFXParameter prop in targetPIP.OFXEffect.Parameters) { if (sourcePIPsettings.ContainsKey(prop.Name)) { if(prop is OFXParameter<object, OFXKeyframe>) { ((OFXParameter<object, OFXKeyframe>)prop).Value = sourcePIPsettings[prop.Name]; } } } } } } } MessageBox.Show("Picture in Picture settings copied.", "Success"); } }