Hello,
I’m searching for this too.
The only way I found is to load wp inside your script, without showing it.
You have to inlucde wp-blog-header.php with WP_USE_THEMES se to false.
I din’t try it already because it is not a solution for me..
The scripts that I have to run are cpu-consuming.. loading the entire wp just for the username is uneconomical.