AW: Getting the currently logged in user under Windows

Tiemo Hollmann TB toolbook at kestner.de
Mon May 17 12:59:19 EDT 2010


Tested: It works also on XP with a non admin user.

Perhaps it would be good to check, if it also works on Win home editions,
because there is in some cases only a subset of shell commands allowed in
these editions.
Tiemo

> -----Ursprüngliche Nachricht-----
> Von: use-revolution-bounces at lists.runrev.com [mailto:use-revolution-
> bounces at lists.runrev.com] Im Auftrag von Malte Pfaff-Brill
> Gesendet: Montag, 17. Mai 2010 16:06
> An: use-revolution at lists.runrev.com
> Betreff: Getting the currently logged in user under Windows
> 
> Hi all,
> 
> I am using this under Vista to identify the currently logged in user:
> 
> function getUserName
>   local tUser
>   set the hideconsolewindows to true
>   put shell("set user") into tUser
>   set the itemDel to "="
>   repeat for each line theLine in tUser
>      if item 1 of theLine="USERNAME" then
>         return item 2 to -1 of theLine
>      end if
>   end repeat
>   return tUser
> end getUserName
> 
> Is there a simpler way? Can anyone test if this works under XP and / or
> WIn 7, even when not logged in with admin rights?
> 
> All the best,
> 
> malte
> 
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution




More information about the Use-livecode mailing list