Material assignment

I'm total noob in scripting. Please help me...

1. How to assign material from slate material editor to an object ?

$.material = sme.activeView[""]

doesn't work :(

2. What is "current material liblary" ?

3. How to assign material from material liblary located od disc (for example - C:\xxx\liblary.mat)

4. How to assign material from SME or liblary to Envirement map ?