Scripts - Get selected event path name


#1

Hello, I’m trying to use an FMOD Studio script to generate a list of the path names for selected events.

I’m currently using this, but it only returns the event name not the full “event:/foldername/eventname”
function findEventsRecursively(items, filter)
{
var result = [];
items.forEach(function(item) {
if(item.isOfType(“Event”)) {
result.push(item);
}
if(item.isOfType(“Folder”)) {
result = result.concat(findEventsRecursively(item.items));
}
});
return result;
}

        var allEvents = studio.window.browserSelection();           
        allEvents = findEventsRecursively(allEvents);
        allEvents.forEach(function(item) 
        {
            if( item.isOfType("WorkspaceItem") )
            {   
                console.log(item.name);                    
            }                
        });

#2

Also, is there any documentation for what we can call from (item) ? Other than just item.name.


#3

If you are using FMOD Studio 1.10 then you can use studio.project.model.Event.findInstances() to find all events in your project.

Also, the “name” of the item would just return the actual name of the event and not its path. Again, in FMOD Studio 1.10 you can use item.getPath() to get it’s path. Otherwise you would need to edit the findEventsRecursively() function to grab the item.folder and check if it’s the master folder otherwise grab that folders name to recursively create a path yourself.

You can call item.dump() to get a list of all valid properties and helper functions on that item.