#cs
RoleDeveloper 1.0 Dies Tool ist zum erstellen von Administrativen Rollen in Regional arbeitenden 
Teams. Mit diesem Tool kann ein Standard-Set an Administrativen Rollen angelegt werden die aus 
einem XLS File gelesen werden können oder direkt aus einen anderen Standort im AD zu der Ziel 
Lokation kopiert werden. Beim Kopieren aus anderen Lokationen sollen auch die Member kopiert werden

#ce
;----------------------------------------------------------------------------------------------
; Prgramm Change Log
; V 1.0  initial alpha
; V 0.5  only GUI 
;----------------------------------------------------------------------------------------------
#include <GUIConstants.au3>
#include <file.au3>

;---  Definitionen und Konstanten

Global $debug = ""

Dim $LogFile = 0
Dim $APPLogFile = @ScriptDir & "\app.log"


GUICreate("Roledeveloper V0.5 GUI Alpha",600,400)
GUISetState(@sw_show)
_FileWriteLog($APPLogFile,"Application started")



;----------------------------------------------------------------------------------------------
; Start Login
;---  Login daten
;---  Logindaten werden in einem extra Fenster eingelesen und gegen das AD verifiziert.
;---  Da in der Regel mit einem AdminUser gearbeitet wird und nicht mit dem Standard User
;---  User und Passwort wird im Cache gehalten. 
;---  Ausgabe im Logfile Console nur Login erfolgreich (Grün) oder nicht erfolgreich (Rot)

$id_button_Login=GUICtrlCreateButton("Login",5,340,75,25,-1,-1)
$id_input_LoginName=GUICtrlCreateInput(@UserName,5,25,80,20,-1,-1)
$id_input_LoginName=GUICtrlCreateInput(@LogonServer,5,45,80,20)

; End Login
;----------------------------------------------------------------------------------------------

; Start Setup
$id_button_setup=GUICtrlCreateButton("Setup",5,370,75,25)

; End Setup
;----------------------------------------------------------------------------------------------

; Start Clear Log
$id_button_clear=GUICtrlCreateButton ("Clear Log", 80,340,75,25)

; Ende Clear Log
;----------------------------------------------------------------------------------------------

; Start AD Tree
$id_treeview3=GUICtrlCreateTreeView(15,90,130,145,-1,-1) ;OU Struktur Quelle

$id_treeview4=GUICtrlCreateTreeView(150,90,130,145,-1,-1) ;ORG Rollen Quelle

$id_treeview3=GUICtrlCreateTreeView(320,90,130,145,-1,-1) ;OU Strukture Ziel

$id_treeview4=GUICtrlCreateTreeView(455,90,130,145,-1,-1) ;ORG Rollen Ziel

; Ende AD Tree
;----------------------------------------------------------------------------------------------

; Start OrgRollen Select
;$id_checkbox4=GUICtrlCreateCheckbox("OR",122,93,105,139,-1,-1)

; Ende OrgRollen Select
;----------------------------------------------------------------------------------------------

; Start Logfile anzeigen
$id_Protokoll=GUICtrlCreateList(@MDAY&"/"&@MON&"/"&@YEAR,5,240,590,115,-1,-1)


; Ende Logfile anzeigen
;----------------------------------------------------------------------------------------------

; Start Regional Gruppen Check und anlegen
$id_button_groups01=GUICtrlCreateButton("Regoinal GP",80,370,75,25)

; Ende Regional Gruppen Check und anlegen
;----------------------------------------------------------------------------------------------

; Start Restore Location
$id_button_Restore=GUICtrlCreateButton("Restore Loc.",190,340,75,25) ;Button Restore

; Ende Restore Location 
;----------------------------------------------------------------------------------------------

; Start Backup Location
$id_button_Backup=GUICtrlCreateButton("Backup Loc.",190,370,75,25) ;Button Backup

; Ende Backup Location
;----------------------------------------------------------------------------------------------

; Start Copy Location
$id_button_copy=GUICtrlCreateButton("Copy Location",265,340,75,25) ;Button Copy Loc

; Ende Copy Location
;----------------------------------------------------------------------------------------------

; Start Copy Description to Location
$id_button_description=GUICtrlCreateButton("Copy Descript.",265,370,75,25) ;Button Copy Description

; Ende Copy Description to Location
;----------------------------------------------------------------------------------------------

; Start Open Source File (XLS) Datei für Rollen Matrix
$id_button_XLS=GUICtrlCreateButton("open XLS",415,340,75,25) ;Button OpenXLS

; Ende Open Source File (XLS) Datei für Rollen Matrix
;----------------------------------------------------------------------------------------------

; Start Undo Last. Rückgäng machen der lesten protokolierten Aktion
$id_button_undo=GUICtrlCreateButton("Undo last",415,370,75,25) ;Button Undo

; Ende Undo Last. Rückgäng machen der lesten protokolierten Aktion
;----------------------------------------------------------------------------------------------

; Start Debugging (on / Off)
$id_button_Debug=GUICtrlCreateButton("Debug On/Off",520,340,75,25) ;Button Debug

; Ende Debugging
;----------------------------------------------------------------------------------------------

; Start Application Close
$id_button_Exit=GUICtrlCreateButton ("Exit",520,370,75,25) ;Button Exit
; Ende Application Close
;----------------------------------------------------------------------------------------------


;----------------------------------------------------------------------------------------------
;----------------------------------------------------------------------------------------------
;----------------------------------------------------------------------------------------------
;--- Main Programm

GUISetState ()


$msg = 0
While $msg <> $GUI_EVENT_CLOSE
	$msg = GUIGetMsg()

	Select
		; -- Debugging
		case $msg = $id_button_Debug
			If GUICtrlSetData($id_Protokoll,"Debugging") Then 
				$debug = "ON"
				GUICtrlSetData($id_Protokoll,$debug)
			ElseIf $debug = "OFF" Then
				GUICtrlSetData($id_Protokoll,$debug)
			
			EndIf
		
			If $LogFile = 1 Then _FileWriteLog($APPLogFile,"Debug ON")
			
		;--- Login
		case $msg = $id_button_Login
			GUICtrlSetData($id_Protokoll,"Login Erfolgreich : "&@LogonServer &"\" &@UserName)
			If $LogFile = 1 Then _FileWriteLog($APPLogFile,"Login Erfolgreich : "&@LogonServer &"\" &@UserName)
		
		;--- Clear ScreenLog		
		case $msg = $id_button_clear
			GUICtrlSetData($id_Protokoll,"")
			If $LogFile = 1 Then _FileWriteLog($APPLogFile,$msg&" Clear")
			
			
;Programende Button			
		Case $msg = $id_button_Exit
				MsgBox(0,"", "Application closed",2)
				_FileWriteLog($APPLogFile,"Application closed")
				Exit	
			
	EndSelect
Wend