Example ====== Playback - Set fade-out time ====== ^ by: | Sebastian Beutel, July 2020 | ^ published: | here | ^ description: | sets some playbacks' fade-out time\\ also this is a good example for various was to select playback handles | ^ remarks: | | {{tag>playback fade-out time handles}} ==== functions ==== * [[:macros:function:Handles.ClearSelection]] * [[:macros:function:ActionScript.SetProperty]] * [[:macros:function:Handles.SetSourceHandle]] * [[:macros:function:Playbacks.IsCueHandle]] * [[:macros:function:Playbacks.Editor.EnsurePlaybackCueSelected]] ==== affected properties ==== * [[:macros:property:Playbacks.Editor.SelectedPlayback]] * [[:macros:property:Handles.SourceHandle]] * [[:macros:property:Playbacks.Editor.Times.CueFadeOutTime]] ==== control structures ==== * [[macros:control_structures|step condition]] ===== Code ===== Handles.ClearSelection() ActionScript.SetProperty("Playbacks.Editor.SelectedPlayback", null) Handles.SetSourceHandle("PlaybackWindow", 0) ActionScript.SetProperty("Playbacks.Editor.SelectedPlayback", Handles.SourceHandle) Playbacks.Editor.EnsurePlaybackCueSelected() ActionScript.SetProperty("Playbacks.Editor.Times.CueFadeOutTime", time:3) Handles.SetSourceHandle("PlaybackWindow", 1) ActionScript.SetProperty("Playbacks.Editor.SelectedPlayback", Handles.SourceHandle) Playbacks.Editor.EnsurePlaybackCueSelected() ActionScript.SetProperty("Playbacks.Editor.Times.CueFadeOutTime", time:3) Handles.ClearSelection() ActionScript.SetProperty("Playbacks.Editor.SelectedPlayback", null) Handles.ClearSelection() ActionScript.SetProperty("Playbacks.Editor.SelectedPlayback", null) ActionScript.SetProperty("Playbacks.Editor.SelectedPlayback", handle:"Location=Playbacks,1,1") ActionScript.SetProperty("Playbacks.Editor.Times.CueFadeOutTime", time:1.5) ActionScript.SetProperty("Playbacks.Editor.SelectedPlayback", handle:"Location=Playbacks,1,2") ActionScript.SetProperty("Playbacks.Editor.Times.CueFadeOutTime", time:1.5) Handles.ClearSelection() ActionScript.SetProperty("Playbacks.Editor.SelectedPlayback", null) Handles.ClearSelection() ActionScript.SetProperty("Playbacks.Editor.SelectedPlayback", null) ActionScript.SetProperty("Playbacks.Editor.SelectedPlayback", handle:"playbackHandleUN=101") ActionScript.SetProperty("Playbacks.Editor.Times.CueFadeOutTime", time:0) ActionScript.SetProperty("Playbacks.Editor.SelectedPlayback", handle:"playbackHandleUN=102") ActionScript.SetProperty("Playbacks.Editor.Times.CueFadeOutTime", time:0) Handles.ClearSelection() ActionScript.SetProperty("Playbacks.Editor.SelectedPlayback", null) ===== Explanation ===== This explains the functional steps within the sequence. For all the other XML details please refer to [[:macros:formats_and_syntax#xml_format|Formats and syntax]] This example shows various ways to select playback handles: by index on the current page, by location, and by user number. * the first and last two lines ''Handles.ClearSelection()'' and ''ActionScript.SetProperty("Playbacks.Editor.SelectedPlayback", null)'' always make sure that there is no playback selected from previous actions * in the first macro the playbacks are selected using ''Handles.SetSourceHandle("PlaybackWindow", 0)''. This refers to the index of the button on the current page of this windows. however we cannot be sure that an actual playback is there in this slot - and if there is not then the macro will cause an error. Thus we need to make sure that an actual playback is selected as soure handle: * '''' checks that this really is a cue handle * only if this check yields a positive result ''ActionScript.SetProperty("Playbacks.Editor.SelectedPlayback", Handles.SourceHandle)'' sets this as source handle for the next operations * ''Playbacks.Editor.EnsurePlaybackCueSelected()'' makes sure a cue is selected * ''ActionScript.SetProperty("Playbacks.Editor.Times.CueFadeOutTime", time:3)'' finally sets the fade-out time In the other two macros the playbacks are directly selected using either the location (''ActionScript.SetProperty("Playbacks.Editor.SelectedPlayback", handle:"Location=Playbacks,1,1")'') or the user number (''ActionScript.SetProperty("Playbacks.Editor.SelectedPlayback", handle:"playbackHandleUN=101")''). Thus it's possible to omit some of the checks. ===== How to use it ===== * [[:macros:deploying|make this macro available]] * it makes much sense to organise the playbacks in a certain way so that you know which playbacks are affected by your macros. * fire the macros to you liking in order to set your playbacks' fade-out time ~~DISCUSSION~~