Ben Sherrill Posted April 10, 2006 Share Posted April 10, 2006 Ok here is what I am doing. I am using the xcalcs.vbs for file permissions. What I am doing is trying to create a quick innerface so that when i run the exe a gui pops up and has a "browse" button so you can select the files/folder to change the permissions on. I have created this 2 different ways. The first way is with out using a GUI and just using an INPUT box, however in that one you have to type the whole sting of the directory. So I decided to take a stab at the gui innerface and use a browse button. It seems to work, however when its finished nothing happens. Meaning when you choose the browse button and select your file, the Var $sFilelocation is correct and is valid through out the entire script, but when it get time to dump the info into the Batch file before running it, it doesnt. PLEASE SOMEONE HELP ME WITH THIS! I have been working on it for 3 days and dont understand why when using the gui that the batch file will not write correctly. #include <Process.au3>opt("WinTitleMatchMode", 2);Message about the program that will be used;MsgBox features: Title=Yes, Text=Yes, Buttons=OK, Icon=WarningMsgBox(48, "Change File Permissions", "The following will change permissions for a Group of users or a Specific user using Xcacls.vbs. To learn more about Xcacls.vbs and its command line options, please see http://support.microsoft.com/?id=825751 'How to use Xcacls.vbs to modify NTFS permissions'")If FileExists("XCACLS.vbs") ThenElse ;MsgBox features: Title=Yes, Text=Yes, Buttons=OK, Icon=Warning MsgBox(48, "File Not Found", "The file Xcacls.vbs was not found! Please make sure that this file is in the same directory as the File Permissions.exe file. Program will now close.") ExitEndIf#include "GUIConstants.au3";Create WindowGUICreate("File Location", 250, 150)GUICtrlCreateLabel("What file do you want to change?", 10, 10)$okbutton = GUICtrlCreateButton("OK", 10, 80, 45, 20)$cancel = GUICtrlCreateButton("Cancel", 70, 80, 45, 20)$browse = GUICtrlCreateButton("Browse", 165, 50, 45, 20);Create input Box$input = GUICtrlCreateInput("", 10, 50, 140, 20); Show GUI, and wait for OK to be pressedGUISetState()While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit Case $msg = $okbutton ExitLoop Case $msg = $cancel ExitLoop Case $msg = $browse $sFileLocation = FileOpenDialog("Select File or Folder", @DesktopDir, "All (*.*)", 2) GUICtrlSetData($input, $sFileLocation) EndSelectWEndGUIDelete()MsgBox(4096, "Selection", "your directory is " & $sFileLocation);~ ;Ask for file/folder location.;InputBox features: Title=Yes, Prompt=Yes, Default Text=No;~ If Not IsDeclared("sFileLocation") Then Dim $sFileLocation;~ $sFileLocation = InputBox("File Location", "Please type in the location of the file/folder you would like to add rights too.", "C:\", " ", "300", "150", "-1", "-1");~ Select;~ Case @error = 0 ;OK - The string returned is valid;~ Case @error = 1 ;The Cancel button was pushed;~ Exit;~ Case @error = 3 ;The InputBox failed to open;~ EndSelect;Ask for user/group to grant/revoke/deny rights to.#Region --- CodeWizard generated code Start ---;InputBox features: Title=Yes, Prompt=Yes, Default Text=NoIf Not IsDeclared("sgroupuser") Then Dim $sgroupuser$sgroupuser = InputBox("Group or User", "Please type in the Group or User account that you would like to give access to the file named " & @CRLF & @CRLF & $sFileLocation, "alb\cat_admins", " ", "300", "200", "-1", "-1")Select Case @error = 0 ;OK - The string returned is valid Case @error = 1 ;The Cancel button was pushed Exit Case @error = 3 ;The InputBox failed to open EndSelect#EndRegion --- CodeWizard generated code End ---;Displays and asks the user what type of options they would like to use. Grant Rights Deny Rights Revoke Rights Inherit Rights#Region --- CodeWizard generated code Start ---;InputBox features: Title=Yes, Prompt=Yes, Default Text=NoIf Not IsDeclared("sFileLocation") Then Dim $options1$options1 = InputBox("Program Options", "Please type which ever options you would like using spaces between each one." & @CRLF & @CRLF & "/e Edit ACL instead of replacing it." & @CRLF & @CRLF & "/g Grant security permissions." & @CRLF & @CRLF & "/r Revoke security permissions." & @CRLF & @CRLF & "/d Deny security permissions." & @CRLF & @CRLF & "/i (Enable/Copy/Remove) Inheritance flag. Enbale will turn on. Copy will turn off the flag and copy the inherited ACL's. Remove will turn off the flag and will not copy inherited ACL's.", "/e /g", " ", "450", "300", "-1", "-1")Select Case @error = 0 ;OK - The string returned is valid Case @error = 1 ;The Cancel button was pushed Exit Case @error = 3 ;The InputBox failed to open EndSelect#EndRegion --- CodeWizard generated code End ---;Runs and check on the rights input in by the user to make sure that they have been done correctly. If not Pops up an error message stating that if the script is run;in its current condition that it may not create the correct rightsSelect Case $options1 = "/e" ;MsgBox features: Title=Yes, Text=Yes, Buttons=OK and Cancel, Icon=Info If Not IsDeclared("iMsgBoxAnswer") Then Dim $iMsgBoxAnswer $iMsgBoxAnswer = MsgBox(65, "Your Editing Options", "Your options are" & @CRLF & $options1 & @CRLF & "using these options will not Grant or Revoke rights to " & $sFileLocation & " " & "for " & $sgroupuser & @CRLF & " Please exit the program and make sure to choose /g /r or /d to change rights.") Select Case $iMsgBoxAnswer = 1 ;OK Case $iMsgBoxAnswer = 2 ;Cancel Exit EndSelect Case $options1 = "/e /g" ;MsgBox features: Title=Yes, Text=Yes, Buttons=OK and Cancel, Icon=Info If Not IsDeclared("iMsgBoxAnswer") Then Dim $iMsgBoxAnswer $iMsgBoxAnswer = MsgBox(65, "Your Editing Options", "Your options are" & @CRLF & $options1 & @CRLF & "using these options will Edit and Grant rights to " & $sFileLocation & " " & "for " & $sgroupuser & @CRLF & " If this is not correct then press Exit and rerun the program!") Select Case $iMsgBoxAnswer = 1 ;OK Case $iMsgBoxAnswer = 2 ;Cancel Exit EndSelect Case $options1 = "/e /g /i enable" ;MsgBox features: Title=Yes, Text=Yes, Buttons=OK and Cancel, Icon=Info If Not IsDeclared("iMsgBoxAnswer") Then Dim $iMsgBoxAnswer $iMsgBoxAnswer = MsgBox(65, "Your Editing Options", "Your options are" & @CRLF & $options1 & @CRLF & "using these options will Edit, Grant and Enable Inherited permissions to " & $sFileLocation & " " & @CRLF & "for " & $sgroupuser & " If this is not correct then press Exit and rerun the program!") Select Case $iMsgBoxAnswer = 1 ;OK Case $iMsgBoxAnswer = 2 ;Cancel Exit EndSelect Case $options1 = "/e /g /i copy" ;MsgBox features: Title=Yes, Text=Yes, Buttons=OK and Cancel, Icon=Info If Not IsDeclared("iMsgBoxAnswer") Then Dim $iMsgBoxAnswer $iMsgBoxAnswer = MsgBox(65, "Your Editing Options", "Your options are" & @CRLF & $options1 & @CRLF & "using these options will Edit, Grant and Copy Inherited permissions to " & $sFileLocation & " " & "for " & $sgroupuser & @CRLF & " If this is not correct then press Exit and rerun the program!") Select Case $iMsgBoxAnswer = 1 ;OK Case $iMsgBoxAnswer = 2 ;Cancel Exit EndSelect Case $options1 = "/e /g /i remove" ;MsgBox features: Title=Yes, Text=Yes, Buttons=OK and Cancel, Icon=Info If Not IsDeclared("iMsgBoxAnswer") Then Dim $iMsgBoxAnswer $iMsgBoxAnswer = MsgBox(65, "Your Editing Options", "Your options are" & @CRLF & $options1 & @CRLF & "using these options will Edit, Grant and Remove Inherited permissions to " & $sFileLocation & " " & "for " & $sgroupuser & @CRLF & " If this is not correct then press Exit and rerun the program!") Select Case $iMsgBoxAnswer = 1 ;OK Case $iMsgBoxAnswer = 2 ;Cancel Exit EndSelect Case $options1 = "/e /r" ;MsgBox features: Title=Yes, Text=Yes, Buttons=OK and Cancel, Icon=Info If Not IsDeclared("iMsgBoxAnswer") Then Dim $iMsgBoxAnswer $iMsgBoxAnswer = MsgBox(65, "Your Editing Options", "Your options are" & @CRLF & $options1 & @CRLF & "using these options will Edit and revoke rights to " & $sFileLocation & " " & "for " & $sgroupuser & @CRLF & " If this is not correct then press Exit and rerun the program!") Select Case $iMsgBoxAnswer = 1 ;OK Case $iMsgBoxAnswer = 2 ;Cancel Exit EndSelect Case $options1 = "/e /r /i enable" ;MsgBox features: Title=Yes, Text=Yes, Buttons=OK and Cancel, Icon=Info If Not IsDeclared("iMsgBoxAnswer") Then Dim $iMsgBoxAnswer $iMsgBoxAnswer = MsgBox(65, "Your Editing Options", "Your options are" & @CRLF & $options1 & @CRLF & "using these options will Edit, Revoke and Enable Inherited permissions to " & $sFileLocation & " " & "for " & $sgroupuser & @CRLF & " If this is not correct then press Exit and rerun the program!") Select Case $iMsgBoxAnswer = 1 ;OK Case $iMsgBoxAnswer = 2 ;Cancel Exit EndSelect Case $options1 = "/e /r /i copy" ;MsgBox features: Title=Yes, Text=Yes, Buttons=OK and Cancel, Icon=Info If Not IsDeclared("iMsgBoxAnswer") Then Dim $iMsgBoxAnswer $iMsgBoxAnswer = MsgBox(65, "Your Editing Options", "Your options are" & @CRLF & $options1 & @CRLF & "using these options will Edit, Revoke and Copy Inherited permissions to " & $sFileLocation & " " & "for " & $sgroupuser & @CRLF & " If this is not correct then press Exit and rerun the program!") Select Case $iMsgBoxAnswer = 1 ;OK Case $iMsgBoxAnswer = 2 ;Cancel Exit EndSelect Case $options1 = "/e /r /i remove" ;MsgBox features: Title=Yes, Text=Yes, Buttons=OK and Cancel, Icon=Info If Not IsDeclared("iMsgBoxAnswer") Then Dim $iMsgBoxAnswer $iMsgBoxAnswer = MsgBox(65, "Your Editing Options", "Your options are" & @CRLF & $options1 & @CRLF & "using these options will Edit, Revoke and Remove Inherited permissions to " & $sFileLocation & " " & "for " & $sgroupuser & @CRLF & " If this is not correct then press Exit and rerun the program!") Select Case $iMsgBoxAnswer = 1 ;OK Case $iMsgBoxAnswer = 2 ;Cancel Exit EndSelect Case $options1 = "/e /d" ;MsgBox features: Title=Yes, Text=Yes, Buttons=OK and Cancel, Icon=Info If Not IsDeclared("iMsgBoxAnswer") Then Dim $iMsgBoxAnswer $iMsgBoxAnswer = MsgBox(65, "Your Editing Options", "Your options are" & @CRLF & $options1 & @CRLF & "using these options will Edit and Deny rights to " & $sFileLocation & " " & "for " & $sgroupuser & @CRLF & " If this is not correct then press Exit and rerun the program!") Select Case $iMsgBoxAnswer = 1 ;OK Case $iMsgBoxAnswer = 2 ;Cancel Exit EndSelect Case $options1 = "/e /d /i enable" ;MsgBox features: Title=Yes, Text=Yes, Buttons=OK and Cancel, Icon=Info If Not IsDeclared("iMsgBoxAnswer") Then Dim $iMsgBoxAnswer $iMsgBoxAnswer = MsgBox(65, "Your Editing Options", "Your options are" & @CRLF & $options1 & @CRLF & "using these options will Edit, Deny and Enable Inherited permissions to " & $sFileLocation & " " & "for " & $sgroupuser & @CRLF & " If this is not correct then press Exit and rerun the program!") Select Case $iMsgBoxAnswer = 1 ;OK Case $iMsgBoxAnswer = 2 ;Cancel Exit EndSelect Case $options1 = "/e /d /i copy" ;MsgBox features: Title=Yes, Text=Yes, Buttons=OK and Cancel, Icon=Info If Not IsDeclared("iMsgBoxAnswer") Then Dim $iMsgBoxAnswer $iMsgBoxAnswer = MsgBox(65, "Your Editing Options", "Your options are" & @CRLF & $options1 & @CRLF & "using these options will Edit, Deny and Copy Inherited permissions to " & $sFileLocation & " " & "for " & $sgroupuser & @CRLF & " If this is not correct then press Exit and rerun the program!") Select Case $iMsgBoxAnswer = 1 ;OK Case $iMsgBoxAnswer = 2 ;Cancel Exit EndSelect Case $options1 = "/e /d /i remove" ;MsgBox features: Title=Yes, Text=Yes, Buttons=OK and Cancel, Icon=Info If Not IsDeclared("iMsgBoxAnswer") Then Dim $iMsgBoxAnswer $iMsgBoxAnswer = MsgBox(65, "Your Editing Options", "Your options are" & @CRLF & $options1 & @CRLF & "using these options will Edit, Deny and Remove Inherited permissions to " & $sFileLocation & " " & "for " & $sgroupuser & @CRLF & " If this is not correct then press Exit and rerun the program!") Select Case $iMsgBoxAnswer = 1 ;OK Case $iMsgBoxAnswer = 2 ;Cancel Exit EndSelect Case $options1 = "/e /i enable" ;MsgBox features: Title=Yes, Text=Yes, Buttons=OK and Cancel, Icon=Info If Not IsDeclared("iMsgBoxAnswer") Then Dim $iMsgBoxAnswer $iMsgBoxAnswer = MsgBox(65, "Your Editing Options", "Your options are" & @CRLF & $options1 & @CRLF & "using these options will Edit, Enable Inherited permissions to " & $sFileLocation & " " & "for " & $sgroupuser & @CRLF & " If this is not correct then press Exit and rerun the program!") Select Case $iMsgBoxAnswer = 1 ;OK Case $iMsgBoxAnswer = 2 ;Cancel Exit EndSelect Case $options1 = "/e /i copy" ;MsgBox features: Title=Yes, Text=Yes, Buttons=OK and Cancel, Icon=Info If Not IsDeclared("iMsgBoxAnswer") Then Dim $iMsgBoxAnswer $iMsgBoxAnswer = MsgBox(65, "Your Editing Options", "Your options are" & @CRLF & $options1 & @CRLF & "using these options will Edit, and Copy Inherited permissions to " & $sFileLocation & " " & "for " & $sgroupuser & @CRLF & " If this is not correct then press Exit and rerun the program!") Select Case $iMsgBoxAnswer = 1 ;OK Case $iMsgBoxAnswer = 2 ;Cancel Exit EndSelect Case $options1 = "/e /i remove" ;MsgBox features: Title=Yes, Text=Yes, Buttons=OK and Cancel, Icon=Info If Not IsDeclared("iMsgBoxAnswer") Then Dim $iMsgBoxAnswer $iMsgBoxAnswer = MsgBox(65, "Your Editing Options", "Your options are" & @CRLF & $options1 & @CRLF & "using these options will Edit, and Remove Inherited permissions to " & $sFileLocation & " " & "for " & $sgroupuser & @CRLF & " If this is not correct then press Exit and rerun the program!") Select Case $iMsgBoxAnswer = 1 ;OK Case $iMsgBoxAnswer = 2 ;Cancel Exit EndSelect Case Else ;MsgBox features: Title=Yes, Text=Yes, Buttons=OK and Cancel, Icon=Critical If Not IsDeclared("iMsgBoxAnswer") Then Dim $iMsgBoxAnswer $iMsgBoxAnswer = MsgBox(17, "Possible Error", "The Program was unable to determine the options you have chosen for the specified path. When the script runs, it may create errors and not set the permissions correctly. You may want to exit and start over making sure the parameters are correct. To COntinue Press Ok to exit press Cancel.") Select Case $iMsgBoxAnswer = 1 ;OK Case $iMsgBoxAnswer = 2 ;Cancel Exit EndSelectEndSelect;Options #2 for deciding how the first options will act and what they will act upon. Just a file? Just a folder? Subfolders? Traverse folders?;InputBox features: Title=Yes, Prompt=Yes, Default Text=NoIf Not IsDeclared("sFileLocation") Then Dim $options2$options2 = InputBox("Program Options", "Please type which ever options you would like using spaces between each one." & @CRLF & @CRLF & ":f This will change all file Permissions. IMPORTANT: When revoking rights, the : must be changed to a / with a space before it. If this not done, revoking rights will not work!" & @CRLF & @CRLF & "/s This will change all subfolders under the inputted directory but will NOT traverse subdirectories unless /t is also present. If filename is a directory, and /s is not used, nosubdirectories will be touched." & @CRLF & @CRLF & "/t Traverses each subdirectory" & @CRLF & @CRLF & "The default is for all subfolders and files with in the folders and subfolders.", ":f /s /t", " ", "450", "300", "-1", "-1")Select Case @error = 0 ;OK - The string returned is valid Case @error = 1 ;The Cancel button was pushed Exit Case @error = 3 ;The InputBox failed to open EndSelect;-The Following script could be used To add another check on the File Subdirectory Or Traverse files. This is Not completed yet.; Creates an error message if the user input is not known, and states that the script may not run correctly!Select Case $options2 = ":f" ;MsgBox features: Title=Yes, Text=Yes, Buttons=OK and Cancel, Icon=Info If Not IsDeclared("iMsgBoxAnswer") Then Dim $iMsgBoxAnswer $iMsgBoxAnswer = MsgBox(65, "Your File Options", "Your options are" & @CRLF & $options2 & @CRLF & "using these options will Edit only specific FILE permissions to " & $sFileLocation & " " & "for " & $sgroupuser & @CRLF & " If this is not correct then press Exit and rerun the program!") Select Case $iMsgBoxAnswer = 1 ;OK Case $iMsgBoxAnswer = 2 ;Cancel Exit EndSelect Case $options2 = " /f" ;MsgBox features: Title=Yes, Text=Yes, Buttons=OK and Cancel, Icon=Info If Not IsDeclared("iMsgBoxAnswer") Then Dim $iMsgBoxAnswer $iMsgBoxAnswer = MsgBox(65, "Your File Options", "Your options are" & @CRLF & $options2 & @CRLF & "using these options will Edit only specific FILE permissions to " & $sFileLocation & " " & "for " & $sgroupuser & @CRLF & " If this is not correct then press Exit and rerun the program!") Select Case $iMsgBoxAnswer = 1 ;OK Case $iMsgBoxAnswer = 2 ;Cancel Exit EndSelect Case $options2 = ":f /s" ;MsgBox features: Title=Yes, Text=Yes, Buttons=OK and Cancel, Icon=Info If Not IsDeclared("iMsgBoxAnswer") Then Dim $iMsgBoxAnswer $iMsgBoxAnswer = MsgBox(65, "Your File Options", "Your options are" & @CRLF & $options2 & @CRLF & "using these options will Edit FILE and Subdirectory permissions to " & $sFileLocation & " " & "for " & $sgroupuser & @CRLF & " If this is not correct then press Exit and rerun the program!") Select Case $iMsgBoxAnswer = 1 ;OK Case $iMsgBoxAnswer = 2 ;Cancel Exit EndSelect Case $options2 = " /f /s" ;MsgBox features: Title=Yes, Text=Yes, Buttons=OK and Cancel, Icon=Info If Not IsDeclared("iMsgBoxAnswer") Then Dim $iMsgBoxAnswer $iMsgBoxAnswer = MsgBox(65, "Your File Options", "Your options are" & @CRLF & $options2 & @CRLF & "using these options will Edit FILE and Subdirectory permissions to " & $sFileLocation & " " & "for " & $sgroupuser & @CRLF & " If this is not correct then press Exit and rerun the program!") Select Case $iMsgBoxAnswer = 1 ;OK Case $iMsgBoxAnswer = 2 ;Cancel Exit EndSelect Case $options2 = ":f /s /t" ;MsgBox features: Title=Yes, Text=Yes, Buttons=OK and Cancel, Icon=Info If Not IsDeclared("iMsgBoxAnswer") Then Dim $iMsgBoxAnswer $iMsgBoxAnswer = MsgBox(65, "Your File Options", "Your options are" & @CRLF & $options2 & @CRLF & "using these options will Edit FILE, Subdirectory permissions and will Traverse each subdirectory to " & $sFileLocation & " " & "for " & $sgroupuser & @CRLF & " If this is not correct then press Exit and rerun the program!") Select Case $iMsgBoxAnswer = 1 ;OK Case $iMsgBoxAnswer = 2 ;Cancel Exit EndSelect Case $options2 = " /f /s /t" ;MsgBox features: Title=Yes, Text=Yes, Buttons=OK and Cancel, Icon=Info If Not IsDeclared("iMsgBoxAnswer") Then Dim $iMsgBoxAnswer $iMsgBoxAnswer = MsgBox(65, "Your File Options", "Your options are" & @CRLF & $options2 & @CRLF & "using these options will Edit FILE, Subdirectory permissions and will Traverse each subdirectory to " & $sFileLocation & " " & "for " & $sgroupuser & @CRLF & " If this is not correct then press Exit and rerun the program!") Select Case $iMsgBoxAnswer = 1 ;OK Case $iMsgBoxAnswer = 2 ;Cancel Exit EndSelect Case $options2 = " /s" ;MsgBox features: Title=Yes, Text=Yes, Buttons=OK and Cancel, Icon=Info If Not IsDeclared("iMsgBoxAnswer") Then Dim $iMsgBoxAnswer $iMsgBoxAnswer = MsgBox(65, "Your File Options", "Your options are" & @CRLF & $options2 & @CRLF & "using these options will Edit only Subdirectory permissions to " & $sFileLocation & " " & "for " & $sgroupuser & @CRLF & " If this is not correct then press Exit and rerun the program!") Select Case $iMsgBoxAnswer = 1 ;OK Case $iMsgBoxAnswer = 2 ;Cancel Exit EndSelect Case $options2 = " /s /t" ;MsgBox features: Title=Yes, Text=Yes, Buttons=OK and Cancel, Icon=Info If Not IsDeclared("iMsgBoxAnswer") Then Dim $iMsgBoxAnswer $iMsgBoxAnswer = MsgBox(65, "Your File Options", "Your options are" & @CRLF & $options2 & @CRLF & "using these options will Edit Subdirectory and Traverse the permissions to " & $sFileLocation & " " & "for " & $sgroupuser & @CRLF & " If this is not correct then press Exit and rerun the program!") Select Case $iMsgBoxAnswer = 1 ;OK Case $iMsgBoxAnswer = 2 ;Cancel Exit EndSelect #Region --- CodeWizard generated code Start --- ;MsgBox features: Title=Yes, Text=Yes, Buttons=OK and Cancel, Icon=Critical Case Else If Not IsDeclared("iMsgBoxAnswer") Then Dim $iMsgBoxAnswer $iMsgBoxAnswer = MsgBox(17, "Possible Error", "The Program was unable to determine the options you have chosen for the specified path. When the script runs, it may create errors and not set the permissions correctly. You may want to exit and start over making sure the parameters are correct. To COntinue Press Ok to exit press Cancel.") Select Case $iMsgBoxAnswer = 1 ;OK Case $iMsgBoxAnswer = 2 ;Cancel Exit EndSelectEndSelect; Asks the user where they would like for the LOG file to be created.;The log file is automaticlly given the name user_group.log;InputBox features: Title=Yes, Prompt=Yes, Default Text=NoIf Not IsDeclared("logloc") Then Dim $logloc$logloc = InputBox("Log Location", "Where would you like to create the log file named" & @CRLF & "user_group.log", "C:\", " ", "300", "200", "-1", "-1")Select Case @error = 0 ;OK - The string returned is valid Case @error = 1 ;The Cancel button was pushed Exit Case @error = 3 ;The InputBox failed to open EndSelect;Displays a message to the user of how the script will be placed in the CMD window.; Give the option to cancel the run.;MsgBox features: Title=Yes, Text=Yes, Buttons=OK and Cancel, Icon=NoneIf Not IsDeclared("iMsgBoxAnswer") Then Dim $iMsgBoxAnswer$iMsgBoxAnswer = MsgBox(1, "Selected Options", "The following line of script will run for xcacls.vbs" & @CRLF & @CRLF & "xcacls.vbs " & $sFileLocation & " " & $options1 & " " & $sgroupuser & $options2 & @CRLF & @CRLF & "Your Log file will be created in " & $logloc & "\user_group.log" & @CRLF & " If this is incorrect please Canel and start over!")Select Case $iMsgBoxAnswer = 1 ;OK Case $iMsgBoxAnswer = 2 ;Cancel ExitEndSelect; Creates the batch file "user_group_rights.bat in the same directory of which the script will use to run the program.$batch = FileOpen("user_group_rights1.bat", 2)FileWrite($batch, "Cscript.exe /h:cscript" & @CRLF)FileWrite($batch, "xcacls.vbs ")FileWrite($batch, $sFileLocation)FileWrite($batch, " " & $options1 & " " & $sgroupuser & $options2 & " /l" & " " & $logloc & "\user_group.log" & @CRLF);FileWrite($batch, "exit")FileClose($batch);Runs the batch file.If FileExists("user_group_rights1.bat") Then Run("user_group_rights1.bat")Else MsgBox(4096, "No file", "File does not exist") ExitEndIf;Wait until the CMD window is closed to continueWinWaitClose("cmd.exe");~ run("cmd");~ WinWaitActive("C:\");~ send("Cscript.exe /h:cscript");~ Send("{ENTER}");~ sleep(1000);~ Send("\\clrn01\apps\Scripts\xcacls\xcacls.vbs ");~ send($sFileLocation);~ send(" " & $options1,1);~ Send(" " & $sgroupuser);~ Send($options2,1);~ Send(" /l",1);~ Send(" " &$logloc);~ Send("\user_group.log");~ Send("{ENTER}");~ WinWaitActive("C:\","Ending Script at");~ send("exit {ENTER}");Once the CMD window is closed pop up a message stating the script has completed and to check the log file for Unsucsessful instances.;MsgBox features: Title=Yes, Text=Yes, Buttons=OK, Icon=InfoMsgBox(64, "Script Complete", "The script has completed please check the log file named user_group.log in the " & $logloc & " directory.")Exitxcalcs_filepermissionau3.zip Link to comment Share on other sites More sharing options...
Ben Sherrill Posted April 10, 2006 Author Share Posted April 10, 2006 Ok I have found one of the problems. For some reason it is creating the batch file in the root of the C Drive instead of the folder. Can anyone help me figure out why it is creating it in the root of C and not in the folder it is run?? What am I missing??? Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted April 10, 2006 Moderators Share Posted April 10, 2006 That's a lot to go through, but the quick glimpse I took, looks like your creating/looking for files where ever the script is located. Try using a direct path rather than "file.bat", do "C:\Folder\file.dat". 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...
Ben Sherrill Posted April 10, 2006 Author Share Posted April 10, 2006 Yeah it is a lot to go through thanks for taking the time to look at it for me. Yeah I think my problem is that there are spaces when my exe file lies. I put it on a server and used UNC with out and spaces instead it had "_" and it worked. Thanks for the time. 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