Cannot get (meta) data per image in hyperstack

Trying the following in imagej macro using bio-formats;

run("Bio-Formats Macro Extensions");
Ext.setId(path);
Ext.getCurrentFile(file);
Ext.getSeriesCount(seriesCount);

for (s=1; s<=seriesCount; s++) {
Ext.getSeriesName(seriesName);
Ext.getMetadataValue(seriesName + " ATLCameraSettingDefinition|ObjectiveName", myObjective);
}

Ext.getSeriesName(seriesName) will always return the name of the first image in the stack
Ext.getMetadataValue("…") will always return 0

It seems you cannot loop through the hyperstack this way. Any ideas?

The series name will be the name for the entire series. To loop through the images in a series you will use imageCount. Here is an example which uses it to return the timings for each plane: https://github.com/openmicroscopy/bioformats/blob/develop/components/bio-formats-plugins/utils/macros/planeTimings.txt

If you open the image normally and use Show Info to display the metadata, what is the exact name of the metadata value you are trying to retrieve? Is it prefixed with the series name?