I did a quick search in the console, and found that the list of sprites is here
ide = this.parentThatIsA(IDE_Morph)
sprites = ide.sprites.asArray()
You can then loop over this, and get the costumes and sounds as in the script that you have before, only this must be replaced by the current sprite in the sprites list. The name of the sprite is just sprite.name.
Just as a side note, if you want to access snap from the console for searching for something quickly, just do
ide = world.children[0]
Then you can access anything in the snap environment just through the ide variable, and the console also gives you all the attributes and functions that the ide has, just by typing in ide.