I think I've answered my own question, apparently WrapScript() requires the frame it wraps to be secure, otherwise it fails silently. CharacterMainHandSlot is not secure, and therefore the wrapped snippet won't run.
Still need to find a way to open/close the menu in combat.
Btw, is there a widget function to check if a given widget is secure? I think I remember that one existed, but can't find it.
Actually it works, I guess it has something to do with that the Character frame (paperdoll) is hidden and shown by a keypress, it probably wouldn't work if you called Show() / Hide() directly.
The only strange thing is that I can't hide or show the secure drop down menu anchored to the slot button, it just won't work (no errors, nothing) even outside combat, but I can move it off screen (and back), even in combat.
One more question: How do you get information about a temporary enchant on your ranged weapon? I know there's GetWeaponEnchantInfo(), but I can't find anything similar for the ranged slot. Is tooltip scanning the only option?