Jump to content
Sign in to follow this  
MPHillier

setacl.exe

Recommended Posts

MPHillier

Attempting to create a basic GUI for setacl.exe

I wrote this after reading through the Help files. I don't think I have the Run syntx correct.

CODE:

#include <GUIConstants.au3>

#include <file.au3>

Dim $aComboList,$aRecords,$aFile

Dim $bComboList,$bRecords,$bFile

Dim $cComboList,$cRecords,$cFile

GuiCreate("iHQ - Remote Permissions", 630, 197,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))

$RUN = GUICtrlCreateButton("Run",195,30,50,20) ;This is the Run button

;*************************************************************************

$aFile = "list.txt" ;**** Pc location ie.. \\School-SD-Roomnumber

If Not _FileReadToArray($aFile,$aRecords) Then

MsgBox(4096,"Error", " Error reading log to Array error:" & @error)

Exit

EndIf

For $x = 1 to $aRecords[0]

$aComboList=$acomboList & $aRecords[$x] & "|"

Next

$cComboList=StringTrimRight($cComboList,1)

; build the rest of your GUI

$Loc = GUICtrlCreateCombo ("Location", 30, 30, 90, 21)

GUICtrlSetData($Loc,$aComboList)

;*************************************************************************

$bFile = "Listb.txt" ;**** pc number ie.. 01|2|03

If Not _FileReadToArray($bFile,$bRecords) Then

MsgBox(4096,"Error", " Error reading log to Array error:" & @error)

Exit

EndIf

For $x = 1 to $bRecords[0]

$bComboList=$bcomboList & $bRecords[$x] & "|"

Next

$bComboList=StringTrimRight($bComboList,1)

; build the rest of your GUI

$pc = GUICtrlCreateCombo ("PC#", 130, 30, 60, 21)

GUICtrlSetData($pc,$bComboList)

;*************************************************************************

$cFile = "listc.txt" ;**** file/dir path ie.. docume~1\program\temp

If Not _FileReadToArray($cFile,$cRecords) Then

MsgBox(4096,"Error", " Error reading log to Array error:" & @error)

Exit

EndIf

For $x = 1 to $cRecords[0]

$cComboList=$ccomboList & $cRecords[$x] & "|"

Next

$cComboList=StringTrimRight($cComboList,1)

; build the rest of your GUI

$path = GUICtrlCreateCombo ("Path", 30, 80, 570, 21)

GUICtrlSetData($path,$cComboList)

;*************************************************************************

$Combo_4 = GuiCtrlCreateCombo("Object", 30, 130, 100, 21)

GUICtrlSetData(-1,"/file|/dir","")

$Combo_5 = GuiCtrlCreateCombo("Action", 170, 130, 90, 21)

GUICtrlSetData(-1,"/set|/deny|/grant|/revoke","")

$Combo_6 = GuiCtrlCreateCombo("Trustee", 300, 130, 150, 21)

GUICtrlSetData(-1,"nnps\everyone|nnps\username","")

$Combo_7 = GuiCtrlCreateCombo("Permission", 480, 130, 120, 21)

GUICtrlSetData(-1,"/full|/read_ex|/read|/write|/list_folder|/list_dir","")

GuiSetState()

While 1

$msg = GuiGetMsg()

Select

Case $msg = $GUI_EVENT_CLOSE

ExitLoop

Case $msg= $RUN ;\\ssh-sd-123 - 01 \c$\ docume~1\program\temp /dir (space) /set (space) domain\user (space) /full

Run('setacl.exe '& $Loc & "-" & $pc & "\c$\" & $path & " " & GUICtrlRead($Combo_4) & " " & GUICtrlRead($Combo_5) & " " & GUICtrlRead($Combo_6) & " " & GUICtrlRead($Combo_7))

EndSelect

WEnd

Exit

tHANKX 4 your assistance


I Break and Fix things... If the surf is up I'm outta here.....

Share this post


Link to post
Share on other sites
Davo

Hi,

Try replacing the Run with ShellExecute and see if that makes a difference, that code is too long to read especially when im at work :)

Also try putting some message boxes here and there to make sure that the right things are being read into the array etc. Also there is a lot of duplicate code there so maybe next time u post only post the part that you thing has the problem and ONE copy of any duplicate code :)

Dave


---------------------------------------------------------------------------------------------------------------------------------------------------------------------------"I don't need to know everything, I just need to know where to find it when I need it"....EinsteinAnd in our case... That's the AutoIT helpfile ;) Please read before posting!!!

Share this post


Link to post
Share on other sites
Danny35d

This line:

Run('setacl.exe '& $Loc & "-" & $pc & "\c$\" & $path & " " & GUICtrlRead($Combo_4) & " " & GUICtrlRead($Combo_5) & " " & GUICtrlRead($Combo_6) & " " & GUICtrlRead($Combo_7))

should be:

Run('setacl.exe '& GUICtrlRead($Loc) & "-" & GUICtrlRead($pc) & "\c$\" & GUICtrlRead($path) & " " & GUICtrlRead($Combo_4) & " " & GUICtrlRead($Combo_5) & " " & GUICtrlRead($Combo_6) & " " & GUICtrlRead($Combo_7))


AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line

Share this post


Link to post
Share on other sites
MPHillier

Thanks danny35d and Davo for pointing things out for me. Funny how things just stare you in the face and you just don't see it. I've completed the project and actually added an InputCommandResult field to show output. its working great.

Again Thank you..


I Break and Fix things... If the surf is up I'm outta here.....

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×