Oooh thanks for that Ray. That is going in my Library. :-) Bob
On Mar 26, 2012, at 11:47 AM, Ken Ray wrote: > > On Mar 26, 2012, at 1:38 AM, Tiemo Hollmann TB wrote: > >> Hi Bob, >> thanks for your hints. >> For windows standalones you can set the UAC Execution Level to "require >> Admin". So LC knows, who's logged in. I wonder, if we can retrieve this >> information from LC? > > You can get the name of the user that is logged in by checking the > environment variables $USERNAME (on Windows) and $USER (on Mac). As to the > user's permission level, this is what I use (watch line wraps): > > > function stsIsAdminUser pName, pComputer > put stsAdminUserList(pComputer) into tList > return (pName is among the lines of tList) > end stsIsAdminUser > > function stsAdminUserList pOpt_ComputerName > switch (the platform) > case "MacOS" > put shell("dscl . read /groups/admin") into tData > filter tData with "GroupMembership:*" > put line 1 of tData into tList -- strip other lines if there are any > delete word 1 of tList > replace space with CR in tList > break > case "Win32" > put "Set objGroup = GetObject(" & q("WinNT://" & pOpt_ComputerName & > "/administrators,group") & ")" & cr & \ > "For Each objMember in objGroup.Members" & cr & \ > "If tAdminList =" && quote & quote && "Then" & cr & \ > "tAdminList = objMember.name" & cr & "Else" & cr & \ > "tAdminList = tAdminList + vbCrLf + objMember.name" & cr & \ > "End If" & cr & \ > "Next" & cr & \ > "result = tAdminList" into tScript > > do script tScript as "VBScript" > put the result into tList > break > end switch > return tList > end stsAdminUserList > > Hope this helps, > > Ken Ray > Sons of Thunder Software, Inc. > Email: k...@sonsothunder.com > Web Site: http://www.sonsothunder.com/ > > _______________________________________________ > use-livecode mailing list > use-livecode@lists.runrev.com > Please visit this url to subscribe, unsubscribe and manage your subscription > preferences: > http://lists.runrev.com/mailman/listinfo/use-livecode _______________________________________________ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode