ending Posted July 6, 2006 Posted July 6, 2006 Ok, I've got everything working fine except for some reason I cannot parse out a carrage return no matter what. What I'm doing is using the net localgroup command in DOS to get the computer's workgroup name. Here's the code:$pid = Run(@ComSpec & " /c net localgroup","",@SW_HIDE,"2") While 1 $line = StdoutRead($pid) If @error = -1 Then ExitLoop If StringLeft($line,14) = "Aliases for \\" Then $localname = StringStripCr(StringAddCr(StringTrimLeft($line,14))) ExitLoop EndIf WEnd FileWrite("testoutput.txt",$localname) I made it output to a file so you could see the extra carrage return. It doesn't show up when you display it in a message box. I've tried everything from StringTrimLeft to StringStripWS and StringStripCR. All seemed to add in extra characters. Any sort of help on this, or even another method of grabbing the computer's name.
Skruge Posted July 6, 2006 Posted July 6, 2006 Welcome to the forums! "Net Localgroup" gives you the groups present on the local machine, not the workgroup the machine is in. You can parse this information from "Net config workstation", or better yet, read it from the registry. Look at HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\DefaultDomainName [font="Tahoma"]"Tougher than the toughies and smarter than the smarties"[/font]
herewasplato Posted July 6, 2006 Posted July 6, 2006 ending said: ...another method of grabbing the computer's name.MsgBox(0, "@ComputerName", @ComputerName) [size="1"][font="Arial"].[u].[/u][/font][/size]
herewasplato Posted July 6, 2006 Posted July 6, 2006 ending said: ......to get the computer's workgroup name...http://www.autoitscript.com/forum/index.php?showtopic=21123 [size="1"][font="Arial"].[u].[/u][/font][/size]
ending Posted July 6, 2006 Author Posted July 6, 2006 MsgBox(0, "@ComputerName", @ComputerName) Works wonders. Thank you both.
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