How to retrieve a sample file length [Solved]

Hi.

Is there a way to retrieve a sample file length of the currently loaded sample of a sample zone?

I’m trying to create a script to replace sample by changing the “SampleOsc.Filename” parameter and I’d like to set the SampleEnd parameter to the full length of the sample.

Any ideas?

Edit: https://developer.steinberg.help/display/HSD/AudioFile

Thanks Matthias.