Chris_1013 Posted June 4, 2004 Share Posted June 4, 2004 I don't like posting queries like this as I feel its too specific to my own needs, but I'm kinda stuck and would appreciate the help. I have this script: expandcollapse popup; ---------------------------------------------------------------------------- ; ; AutoIt Version: 3.0.101 ; Language: English ; Platform: Win9x / NT ; Author: Chris Stoneham ; ; Script Function: ; Produce list of groups in batch file with syntax for NET GROUP command ; Produce list of groups and members (comma and | delimited) ; ; ---------------------------------------------------------------------------- Global $inputFile="TEMP_ndsgroups.txt" Global $outputFile="groups_memberslist.bat" Global $output2File="populate_groups.bat" Global $members="" If MsgBox(4100,"Groups List","This script scans Novell for groups, then produces two output files;" & @LF & @LF &_ $output2File & @TAB & @TAB & "a batch file for creation of groups on Windows" & @LF &_ $outputFile & @TAB & "a list of groups and members (comma and | delimited)" & @LF & @LF & "Do you want to proceed?") = 6 Then If FileExists($inputFile) Then If MsgBox(4100,"File Conflict!",$inputFile & " already exists. Do you wish to use this?" & @LF & @LF &_ "Press Yes to use this file, or No to over-write it") = 7 Then;NO FileDelete($inputFile) ;run nlist command to output file (nlist group show member) SplashTextOn("Processing...",@LF & "Exporting Novell groups, please wait",400,100) RunWait(@ComSpec & " /c nlist group show member > " & $inputFile,@ScriptDir,@SW_HIDE) EndIf Else SplashTextOn("Processing...",@LF & "Exporting Novell groups, please wait",400,100) RunWait(@ComSpec & " /c nlist group show member > " & $inputFile,@ScriptDir,@SW_HIDE) EndIf SplashTextOn("Processing...",@LF & "Creating output files, please wait",400,100) OpenFiles() FileWriteLine($o2File,"echo This batch file will create groups on Windows") FileWriteLine($o2File,"pause") FileWriteLine($oFile,"echo This batch file will populate groups on Windows") FileWriteLine($oFile,"pause") While 1 $line=FileReadLine($iFile) If @error = -1 Then ExitLoop If StringInStr($line,"Name: ") > 0 Then If $members <> "" Then ;$members=StringTrimRight($members,1) FileWriteLine($oFile,$members & "/ADD /DOMAIN") $members="" EndIf $groupname=StringTrimLeft($line,6) FileWrite($oFile,"NET GROUP " & $groupname & " ") FileWriteLine($o2File,"NET GROUP " & $groupname & " /ADD /DOMAIN");this line generates NET syntax for creating groups ElseIf StringInStr($line,"Member: ") > 0 Then $member=StringReplace($line,"Member: ","~") $member=StringTrimLeft($member,2) $members=$member & " " & $members EndIf Wend SplashOff() MsgBox(4160,"Finished",$outputfile & " and " & $output2File & " have been created. Please check for accuracy.") EndIf Func OpenFiles() Global $iFile Global $oFile Global $o2File $iFile=FileOpen($inputFile,0) ;Check if file opened for writing OK If $iFile = -1 Then MsgBox(0, "Error", "Unable to open Input file.") Exit EndIf $oFile=FileOpen($outputFile,2) ;Check if file opened for writing OK If $oFile = -1 Then MsgBox(0, "Error", "Unable to open First Output file.") Exit EndIf $o2File=FileOpen($output2File,2) ;Check if file opened for writing OK If $o2File = -1 Then MsgBox(0, "Error", "Unable to open Second Output file.") Exit EndIf EndFunc which parses a file in this format: Name: GROUP1 Member: USER1 Member: USER2 Member: USER3 Name: GROUP2 Member: USER4 Member: USER5 Member: USER6 What I need is a way of setting up a kind of 'ignore list' of group names and if the name is in the list it doesn't get written to the output file. Can anyone give me any pointers in the right direction? 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