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 theISelectioninterface. As with all FVC interfaces, we get this from theIScriptinginterface.
csharp
ISelection selection = scripting.GetSelection();
If we look at the documentation forISelection, 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.
GetSelectedVideoswill return the currently selected videos. We will get a list of all the selected videos.
csharp
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.