Saymaad Mansoor Posted March 9, 2006 Share Posted March 9, 2006 is it possible to get the usernames in windows using Autoit and save them into a txt file or something ? If yes please tell me how and give me the code as I have never ever used Autoit Link to comment Share on other sites More sharing options...
MadBoy Posted March 9, 2006 Share Posted March 9, 2006 is it possible to get the usernames in windows using Autoit and save them into a txt file or something ?If yes please tell me how and give me the code as I have never ever used AutoitCurrent username ? or All usernames that ever logged in to your computer?Precise your question a bit more. My little company: Evotec (PL version: Evotec) Link to comment Share on other sites More sharing options...
Saymaad Mansoor Posted March 9, 2006 Author Share Posted March 9, 2006 Current username ? or All usernames that ever logged in to your computer?Precise your question a bit more.All the usernames as shown in user accounts in the control panel (for windows 2000 and above) Link to comment Share on other sites More sharing options...
kclteam Posted March 9, 2006 Share Posted March 9, 2006 This will give you all the folder names in Documents and Settings...which includes all the usernames plus some extra folders: #include <File.au3> $path = StringTrimRight (@DocumentsCommonDir,19); trims documents common directory path by removing All Users\Documents part to get Documents and settings folder path $folders = _FileListToArray($path); Lists all folders in Documents and settings folder $i = 0 For $i = 1 to $folders[0] Step 1 MsgBox(0,'',$folders[$i]) Next I believe we should all pay our tax with a smile. I tried - but they wanted cash! Link to comment Share on other sites More sharing options...
Saymaad Mansoor Posted March 9, 2006 Author Share Posted March 9, 2006 but where will I get the result ? and wont this script get any other folders created there ? Link to comment Share on other sites More sharing options...
Saymaad Mansoor Posted March 9, 2006 Author Share Posted March 9, 2006 And how can I distinguish between the username & other folders that the script fetches ? Link to comment Share on other sites More sharing options...
BigDod Posted March 9, 2006 Share Posted March 9, 2006 Have a look at This Topic it may help you get what you want. Time you enjoyed wasting is not wasted time ......T.S. Elliot Suspense is worse than disappointment................Robert Burns God help the man who won't help himself, because no-one else will...........My Grandmother Link to comment Share on other sites More sharing options...
Saymaad Mansoor Posted March 9, 2006 Author Share Posted March 9, 2006 Well I check the script can you guys please modify it to send the usernames to a .txt file so that I can make use of the usernames ? Link to comment Share on other sites More sharing options...
DaveF Posted March 9, 2006 Share Posted March 9, 2006 (edited) Well I check the script can you guys please modify it to send the usernames to a .txt file so that I can make use of the usernames ?May I write your script for you? Really? How about something that runs a command line like: net users > users.txt For other interested parties I've used something like this to get a list of users by group membership, works on Win XP and requires the AutoIt3 beta version: Dim $names, $users ; Run command line, keeping a connection to read the console output $net_exe = Run(@SystemDir & "\net.exe localgroup users", @SystemDir, @SW_HIDE, 2) ; Read all STDOUT-put While 1 $users &= StdoutRead($net_exe) If @error = -1 Then ExitLoop WEnd ; Split the output into lines and populate an array with the lines $user_array = StringSplit($users, @CRLF, 1) ; Step over each line For $userStep = 1 To $user_array[0] ; The user names start on line 7 of the NET.EXE output (in the US English version of XP), ; and there's a 'completed' message afterward, so check the line # and test only names. If ($userStep > 6) And ($userStep < ($user_array[0] - 2)) Then ; $user_array[$userStep] is an user name, do whatever you need with it $names = $names & $user_array[$userStep] & @CRLF EndIf Next ; For this example show the collected names MsgBox(0, "Debug", $names) [Edit: Clarified requirements.] Edited March 9, 2006 by DaveF Yes yes yes, there it was. Youth must go, ah yes. But youth is only being in a way like it might be an animal. No, it is not just being an animal so much as being like one of these malenky toys you viddy being sold in the streets, like little chellovecks made out of tin and with a spring inside and then a winding handle on the outside and you wind it up grrr grrr grrr and off it itties, like walking, O my brothers. But it itties in a straight line and bangs straight into things bang bang and it cannot help what it is doing. Being young is like being like one of these malenky machines. Link to comment Share on other sites More sharing options...
Saymaad Mansoor Posted March 9, 2006 Author Share Posted March 9, 2006 You mean I cant use this on win 2000 if that is what you mean I dont think its much usefull cause my program is multi windows platform and how to get the output to a text file 1 user per line please even reply to get usernames with the script http://www.autoitscript.com/forum/index.ph...059?entry121059 Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted March 9, 2006 Moderators Share Posted March 9, 2006 Well I check the script can you guys please modify it to send the usernames to a .txt file so that I can make use of the usernames ?You mean I cant use this on win 2000 if that is what you mean I dont think its much usefull cause my program is multi windows platform and how to get the output to a text file 1 user per line please even reply to get usernames with the script http://www.autoitscript.com/forum/index.ph...059?entry121059So you wrote a "Program", but... you need someone to 're-write the UDF' so it writes to a .txt file???Read FileWriteLine() in the help file. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Valuater Posted March 9, 2006 Share Posted March 9, 2006 So you wrote a "Program", but... you need someone to 're-write the UDF' so it writes to a .txt file???Read FileWriteLine() in the help file.i already did in his other post8) Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted March 9, 2006 Moderators Share Posted March 9, 2006 i already did in his other post8)Mine was total sarcasim...He asked for someone to re-write it before he even tried to do it himself is why. Either that, or he spent a total of 16 minutes trying ... (I spend longer answering post than that.) Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Valuater Posted March 9, 2006 Share Posted March 9, 2006 you just beat my ass ... on the other post i was on it way too long 8) Link to comment Share on other sites More sharing options...
sabine-uwe Posted April 10, 2006 Share Posted April 10, 2006 Hello I had the same Problem, but want to use the normal AutoIt Version (not a BETA-Version like DaveF-solution). Therefore I tried to write a script with only cmd-Commands. I use it on a German-WIN200-System, so you might change it . Hope it can be useful to someone. $Group = "Benutzer" $first = "-------------------------------------------------------------------------------"; one line bevore user-List = last Line in Header of the text-file $last = "Der Befehl wurde erfolgreich ausgef"; one line after user-List $val = RunWait(@ComSpec & " /c net localgroup " & $Group & " >Benutzer.txt", "C:\", @SW_HIDE) $file = FileOpen("C:\Benutzer.txt", 0) ; Check if file opened for reading OK If $file = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit EndIf ; Anfang der Benutzerliste suchen While 1 $line = FileReadLine($file) If @error = -1 or StringInStr($line, $first) Then ExitLoop Wend $Benutzer = "" ; Ende der Benutzerliste suchen While 1 $line = FileReadLine($file) If @error = -1 or StringInStr($line, $last) Then ExitLoop $Benutzer = $Benutzer & $line & @CRLF Wend FileClose($file) MsgBox(0, $Group &" :", $Benutzer) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now