Click or drag to resize

Getting input

Learning how to get user input to your scripts

Getting user input

Next, we will look at getting the current selection state into our script. Commonly, we want to create a script that inputs what the user has selected for videos, thumbnails, etc.

We get a selection from the ISelection interface. As with all FVC interfaces, we get this from the IScripting interface.

C#
ISelection selection = scripting.GetSelection();

If we look at the documentation for ISelection, we can see it has many Get and Set functions. Use the get functions to get the current selection from the video, actor, bins, playlist, and thumbnails window. Use the Set function to change the current selection.

GetSelectedVideos will return the currently selected videos. We will get a list of all the selected videos.

C#
List<long> selected_videos = selection.GetSelectedVideos();

Each of the selected videos is represented with a unique ID.

In FVC, you can see the number in the ID column. The concept is the same for selecting thumbnails, actors, and playlists.