function HighestUVChannel = ( ch = 0 for o in $* where o.modifiers[#Unwrap_UVW] != undefined do ( if o.modifiers[#Unwrap_UVW].getMapChannel() > ch then ( ch = o.modifiers[#Unwrap_UVW].getMapChannel() ) ) ch) HighestUVChannel() will then return the greatest UV Channel number in the scene.
ExecuteHighestUVChannel() to get your result. Alternatively, run:function HighestUVChannel = ( ch = 0 obj for o in $* where o.modifiers[#Unwrap_UVW] != undefined do ( if o.modifiers[#Unwrap_UVW].getMapChannel() > ch then ( ch = o.modifiers[#Unwrap_UVW].getMapChannel() obj = o.name ) ) ch format "% has % channels.\n" obj…