Login through scripting

Possible to get a function to login a user through scripting?

Paul