Alice Community  

Go Back   Alice Community > Alice 2 > How do I...?

Reply
 
Thread Tools Display Modes
Jython
Old
Lordcorvin
Senior Member
 
Lordcorvin's Avatar
 
Status: Offline
Posts: 59
Join Date: Feb 2011
Location: Hogwarts:)
Default Jython - 05-17-2011, 04:12 PM

Does anyone know how to get username of a person loged in on Windows using python?
   
Reply With Quote
Old
Lordcorvin
Senior Member
 
Lordcorvin's Avatar
 
Status: Offline
Posts: 59
Join Date: Feb 2011
Location: Hogwarts:)
Default 05-28-2011, 01:35 PM

Ok here it goes... Bump...
   
Reply With Quote
zzzzzzzzzzzzzz, uh, what?, who bumped me?
Old
MrMoke
Senior Member
 
MrMoke's Avatar
 
Status: Offline
Posts: 501
Join Date: Sep 2007
Location: Austin, Texas
Default zzzzzzzzzzzzzz, uh, what?, who bumped me? - 05-28-2011, 06:03 PM

Java would do something like

String userName = System.getProperty("user.name");
// Print to be sure worked
System.out.println("Currently logged Username: " + userName);
   
Reply With Quote
Old
arty-fishL
Senior Member
 
arty-fishL's Avatar
 
Status: Offline
Posts: 1,878
Join Date: Mar 2008
Location: In the corner of your eye
Arrow 05-29-2011, 04:34 PM

Quote:
Originally Posted by MrMoke View Post
Java would do something like

String userName = System.getProperty("user.name");
// Print to be sure worked
System.out.println("Currently logged Username: " + userName);
Im going to presume this is correct and translate it into jython for you:

Code:
userName = java.lang.System.getProperty("user.name")
# Print to be sure worked
print("Currently logged Username: " + userName)


█░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░█
█░░▓░░░░░░░▓░░░░░░░░░░░▓▓░░▓░░░░░░▓░░░▓░░░░█
█░▓░▓░▓▓▓░▓▓▓░▓░▓░░░░░░▓▒▒░░▒░░▓▓░▓▓▓░▓▒░░░█
█░▓▓▓▒▓▒▒▒░▓▒▒▓▓▓▒▓▓▓░▓▓▓░░▓░░░▓▒▒▓▒▓▒▓▒░░░█
█░▓▒▓▒▓▒░░░▓▓░░▒▓▒░▒▒▒░▓▒▒░▓▓░▓▓▒░▓▒▓▒▓▒░░░█
█░▓▒▓▒░▒░░░░▒▒▓▓▓▒░░░░▓▓▒░░░▒▒░▒▒░░▒░▒▓▓▓░░█
█░░▒░▒░░░░░░░░░▒▒▒░░░░░▒▒░░░░░░░░░░░░░░▒▒▒░█
█░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░█

I have mostly moved on from Alice, but may still respond to messages if important [¬º-°]¬
   
Reply With Quote
It Works
Old
MrMoke
Senior Member
 
MrMoke's Avatar
 
Status: Offline
Posts: 501
Join Date: Sep 2007
Location: Austin, Texas
Default It Works - 05-29-2011, 05:14 PM

And with only a minor modification to the jython code you can link userName to a World String variable. That research should be left to you.
   
Reply With Quote
Old
ikrypt
Junior Member
 
Status: Offline
Posts: 3
Join Date: Sep 2011
Default 09-27-2011, 02:17 PM

I'll say thank you
   
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



Copyright ©2024, Carnegie Mellon University
Alice 2.x © 1999-2012, Alice 3.x © 2008-2012, Carnegie Mellon University. All rights reserved.