read only code...
(looks like plagarism to me...)
Code:
Break On
$System = CreateObject("Kixtart.System")
;KD START
;************* Form **************
$Form = $System.Form()
$Form.BackColor = 212,208,200
$Form.Height = 571
$Form.Left = 22
$Form.Text = "User Account Information Update"
$Form.Top = 22
$Form.Width = 640
;**************************************
;************* AcctGroupBox **************
$AcctGroupBox = $Form.Controls.GroupBox("User Account", 15, 15, 600, 110)
$AcctGroupBox.BackColor = 212,208,200
;**************************************
;************* Label1 **************
$Label1 = $AcctGroupBox.Controls.Label("First:", 25, 17, 70, 17)
$Label1.BackColor = 212,208,200
$Label1.FontBold = "True"
;**************************************
;************* Label2 **************
$Label2 = $AcctGroupBox.Controls.Label("Initial:", 25, 47, 70, 17)
$Label2.BackColor = 212,208,200
$Label2.FontBold = "True"
;**************************************
;************* Label3 **************
$Label3 = $AcctGroupBox.Controls.Label("Last:", 25, 77, 70, 17)
$Label3.BackColor = 212,208,200
$Label3.FontBold = "True"
;**************************************
;************* TextBox1 **************
$TextBox1 = $AcctGroupBox.Controls.TextBox("TextBox1", 100, 18, 170, 13)
$TextBox1.BackColor = 212,208,200
$TextBox1.BorderStyle = 0
$TextBox1.ReadOnly = "True"
$TextBox1.TabStop = "False"
;**************************************
;************* TextBox2 **************
$TextBox2 = $AcctGroupBox.Controls.TextBox("TextBox2", 100, 48, 170, 13)
$TextBox2.BackColor = 212,208,200
$TextBox2.BorderStyle = 0
$TextBox2.ReadOnly = "True"
$TextBox2.TabStop = "False"
;**************************************
;************* TextBox3 **************
$TextBox3 = $AcctGroupBox.Controls.TextBox("TextBox3", 100, 78, 170, 13)
$TextBox3.BackColor = 212,208,200
$TextBox3.BorderStyle = 0
$TextBox3.ReadOnly = "True"
$TextBox3.TabStop = "False"
;**************************************
;************* Label4 **************
$Label4 = $AcctGroupBox.Controls.Label("User Name:", 325, 17, 70, 17)
$Label4.BackColor = 212,208,200
$Label4.FontBold = "True"
;**************************************
;************* Label5 **************
$Label5 = $AcctGroupBox.Controls.Label("Display:", 325, 47, 70, 17)
$Label5.BackColor = 212,208,200
$Label5.FontBold = "True"
;**************************************
;************* Label6 **************
$Label6 = $AcctGroupBox.Controls.Label("Email Addr:", 325, 77, 70, 17)
$Label6.BackColor = 212,208,200
$Label6.FontBold = "True"
;**************************************
;************* TextBox4 **************
$TextBox4 = $AcctGroupBox.Controls.TextBox("TextBox4", 400, 18, 170, 13)
$TextBox4.BackColor = 212,208,200
$TextBox4.BorderStyle = 0
$TextBox4.ReadOnly = "True"
$TextBox4.TabStop = "False"
;**************************************
;************* TextBox5 **************
$TextBox5 = $AcctGroupBox.Controls.TextBox("TextBox5", 400, 48, 170, 13)
$TextBox5.BackColor = 212,208,200
$TextBox5.BorderStyle = 0
$TextBox5.ReadOnly = "True"
$TextBox5.TabStop = "False"
;**************************************
;************* TextBox6 **************
$TextBox6 = $AcctGroupBox.Controls.TextBox("TextBox6", 400, 78, 170, 13)
$TextBox6.BackColor = 212,208,200
$TextBox6.BorderStyle = 0
$TextBox6.ReadOnly = "True"
$TextBox6.TabStop = "False"
;**************************************
;************* DeptGroupBox **************
$DeptGroupBox = $Form.Controls.GroupBox("Department Details", 15, 135, 600, 110)
$DeptGroupBox.BackColor = 212,208,200
;**************************************
;************* DeptLabel1 **************
$DeptLabel1 = $DeptGroupBox.Controls.Label("Title:", 25, 17, 70, 17)
$DeptLabel1.BackColor = 212,208,200
$DeptLabel1.FontBold = "True"
;**************************************
;************* DeptLabel2 **************
$DeptLabel2 = $DeptGroupBox.Controls.Label("Company:", 25, 47, 70, 17)
$DeptLabel2.BackColor = 212,208,200
$DeptLabel2.FontBold = "True"
;**************************************
;************* DeptLabel3 **************
$DeptLabel3 = $DeptGroupBox.Controls.Label("Office", 25, 77, 70, 17)
$DeptLabel3.BackColor = 212,208,200
$DeptLabel3.FontBold = "True"
;**************************************
;************* DeptTextBox1 **************
$DeptTextBox1 = $DeptGroupBox.Controls.TextBox("", 100, 15, 170, 20)
;**************************************
;************* DeptTextBox2 **************
$DeptTextBox2 = $DeptGroupBox.Controls.TextBox("", 100, 45, 170, 20)
;**************************************
;************* DeptTextBox3 **************
$DeptTextBox3 = $DeptGroupBox.Controls.TextBox("", 100, 75, 170, 20)
;**************************************
;************* DeptLabel4 **************
$DeptLabel4 = $DeptGroupBox.Controls.Label("Department:", 325, 17, 70, 17)
$DeptLabel4.BackColor = 212,208,200
$DeptLabel4.FontBold = "True"
;**************************************
;************* DeptLabel5 **************
$DeptLabel5 = $DeptGroupBox.Controls.Label("Supervisor:", 325, 47, 70, 17)
$DeptLabel5.BackColor = 212,208,200
$DeptLabel5.FontBold = "True"
;**************************************
;************* DeptLabel6 **************
$DeptLabel6 = $DeptGroupBox.Controls.Label("Assistant:", 325, 77, 70, 17)
$DeptLabel6.BackColor = 212,208,200
$DeptLabel6.FontBold = "True"
;**************************************
;************* DeptTextBox4 **************
$DeptTextBox4 = $DeptGroupBox.Controls.TextBox("TextBox4", 400, 15, 170, 20)
;**************************************
;************* DeptTextBox5 **************
$DeptTextBox5 = $DeptGroupBox.Controls.ComboBox("TextBox5", 400, 45, 170, 20)
;**************************************
;************* DeptTextBox6 **************
$DeptTextBox6 = $DeptGroupBox.Controls.TextBox("TextBox6", 400, 75, 170, 20)
;**************************************
;************* InfoGroupBox **************
$InfoGroupBox = $Form.Controls.GroupBox("Contact Information", 15, 255, 600, 110)
$InfoGroupBox.BackColor = 212,208,200
;**************************************
;************* InfoLabel1 **************
$InfoLabel1 = $InfoGroupBox.Controls.Label("Work #:", 25, 17, 70, 17)
$InfoLabel1.BackColor = 212,208,200
$InfoLabel1.FontBold = "True"
;**************************************
;************* InfoLabel2 **************
$InfoLabel2 = $InfoGroupBox.Controls.Label("Pager #:", 25, 47, 70, 17)
$InfoLabel2.BackColor = 212,208,200
$InfoLabel2.FontBold = "True"
;**************************************
;************* InfoLabel3 **************
$InfoLabel3 = $InfoGroupBox.Controls.Label("Cell #:", 25, 77, 70, 17)
$InfoLabel3.BackColor = 212,208,200
$InfoLabel3.FontBold = "True"
;**************************************
;************* InfoTextBox1 **************
$InfoTextBox1 = $InfoGroupBox.Controls.TextBox("TextBox1", 100, 15, 170, 20)
;**************************************
;************* InfoTextBox2 **************
$InfoTextBox2 = $InfoGroupBox.Controls.TextBox("TextBox2", 100, 45, 170, 20)
;**************************************
;************* InfoTextBox3 **************
$InfoTextBox3 = $InfoGroupBox.Controls.TextBox("TextBox3", 100, 75, 170, 20)
;**************************************
;************* InfoLabel4 **************
$InfoLabel4 = $InfoGroupBox.Controls.Label("Fax #:", 325, 17, 70, 17)
$InfoLabel4.BackColor = 212,208,200
$InfoLabel4.FontBold = "True"
;**************************************
;************* InfoLabel5 **************
$InfoLabel5 = $InfoGroupBox.Controls.Label("", 325, 47, 70, 17)
$InfoLabel5.BackColor = 212,208,200
$InfoLabel5.FontBold = "True"
;**************************************
;************* InfoLabel6 **************
$InfoLabel6 = $InfoGroupBox.Controls.Label("Home:", 325, 77, 70, 17)
$InfoLabel6.BackColor = 212,208,200
$InfoLabel6.FontBold = "True"
;**************************************
;************* InfoTextBox4 **************
$InfoTextBox4 = $InfoGroupBox.Controls.TextBox("TextBox4", 400, 15, 170, 20)
;**************************************
;************* InfoTextBox5 **************
$InfoTextBox5 = $InfoGroupBox.Controls.TextBox("TextBox5", 400, 45, 170, 20)
;**************************************
;************* InfoTextBox6 **************
$InfoTextBox6 = $InfoGroupBox.Controls.TextBox("TextBox6", 400, 75, 170, 20)
;**************************************
;************* OfficeGroupBox **************
$OfficeGroupBox = $Form.Controls.GroupBox("Office Location", 15, 375, 600, 110)
$OfficeGroupBox.BackColor = 212,208,200
;**************************************
;************* OfficeLabel1 **************
$OfficeLabel1 = $OfficeGroupBox.Controls.Label("Street:", 25, 17, 70, 17)
$OfficeLabel1.BackColor = 212,208,200
$OfficeLabel1.FontBold = "True"
;**************************************
;************* OfficeLabel3 **************
$OfficeLabel3 = $OfficeGroupBox.Controls.Label("P.O. Box:", 25, 77, 70, 17)
$OfficeLabel3.BackColor = 212,208,200
$OfficeLabel3.FontBold = "True"
;**************************************
;************* OfficeTextBox1 **************
$OfficeTextBox1 = $OfficeGroupBox.Controls.TextBox("TextBox1", 100, 15, 170, 50)
$OfficeTextBox1.Multiline = "True"
;**************************************
;************* OfficeTextBox3 **************
$OfficeTextBox3 = $OfficeGroupBox.Controls.TextBox("TextBox3", 100, 75, 170, 20)
;**************************************
;************* OfficeLabel4 **************
$OfficeLabel4 = $OfficeGroupBox.Controls.Label("City:", 325, 17, 70, 17)
$OfficeLabel4.BackColor = 212,208,200
$OfficeLabel4.FontBold = "True"
;**************************************
;************* OfficeLabel5 **************
$OfficeLabel5 = $OfficeGroupBox.Controls.Label("State:", 325, 47, 70, 17)
$OfficeLabel5.BackColor = 212,208,200
$OfficeLabel5.FontBold = "True"
;**************************************
;************* OfficeLabel6 **************
$OfficeLabel6 = $OfficeGroupBox.Controls.Label("Zip Code:", 325, 77, 70, 17)
$OfficeLabel6.BackColor = 212,208,200
$OfficeLabel6.FontBold = "True"
;**************************************
;************* OfficeTextBox4 **************
$OfficeTextBox4 = $OfficeGroupBox.Controls.TextBox("TextBox4", 400, 15, 170, 20)
;**************************************
;************* OfficeTextBox5 **************
$OfficeTextBox5 = $OfficeGroupBox.Controls.TextBox("TextBox5", 400, 45, 170, 20)
;**************************************
;************* OfficeTextBox6 **************
$OfficeTextBox6 = $OfficeGroupBox.Controls.TextBox("TextBox6", 400, 75, 170, 20)
;**************************************
;************* Accept **************
$Accept = $Form.Controls.Button("Accept Changes", 120, 510, 125, 23)
$Accept.enabled = "False"
;**************************************
;************* Button2 **************
$Cancel = $Form.Controls.Button("Cancel Changes", 405, 510, 125, 23)
$Cancel.OnClick = "ReadADInfo()"
;**************************************
ReadADInfo()
;KD END
$Form.Show
While $Form.Visible
$=Execute($Form.DoEvents())
Loop
Exit 1
Function ReadADInfo()
$ldap = TranslateName(1, @domain, 3, @ldomain+'\'+@userid, 1)
$UserProperties = GetObject("LDAP://"+$LDAP[0])
$FirstName = $userProperties.FirstName
$MiddleName = $userProperties.initials
$LastName = $userProperties.LastName
$UserName = $userProperties.sAMAccountName
$DisplayName = $userProperties.displayName
$emailName = $userProperties.mail
$TitleName = $userProperties.title
$CompanyName = $userProperties.company
$OfficeName = $userProperties.physicalDeliveryOfficeName
$DepartmentName = $userProperties.department
$ManagerName = $userProperties.manager
$AssistantName = $userProperties.assistant
$WorkNumber = $userProperties.telephoneNumber
$PagerNumber = $userProperties.pager
$MobileNumber = $userProperties.mobile
$FaxNumber = $userProperties.facsimileTelephoneNumber
; $ = $userProperties.
$HomeNumber = $userProperties.homePhone
$StreetAddr = $userProperties.streetAddress
$POBox = $userProperties.postOfficeBox
$city = $userProperties.l
$state = $userProperties.st
$zipcode = $userProperties.postalCode
$Super = TranslateName(1, @domain, 1, $ManagerName, 4)
if not @error and ubound($super)>1
$manager=$Super[0]
endif
; set default values of no data present
$company = iif($CompanyName='','Company',$CompanyName)
; populate form with data
$TextBox1.text = $FirstName
$TextBox2.text = $MiddleName
$TextBox3.text = $LastName
$TextBox4.text = $UserName
$TextBox5.text = $DisplayName
$TextBox6.text = $emailName
$DeptTextBox1.text = $TitleName
$DeptTextBox2.text = $Company
$DeptTextBox3.text = $OfficeName
$DeptTextBox4.text = $DepartmentName
$DeptTextBox5.text = $Manager
$DeptTextBox6.text = $AssistantName
$InfoTextBox1.text = $WorkNumber
$InfoTextBox2.text = $PagerNumber
$InfoTextBox3.text = $MobileNumber
$InfoTextBox4.text = $FaxNumber
$InfoTextBox5.text = ''
$InfoTextBox6.text = $HomeNumber
$OfficeTextBox1.text = $StreetAddr
$OfficeTextBox3.text = $POBox
$OfficeTextBox4.text = $city
$OfficeTextBox5.text = $state
$OfficeTextBox6.text = $zipcode
EndFunction
Function TranslateName($InitType, $BindName, $LookupNameType, $LookupName, $ReturnNameType)
Dim $InitType, $BindName, $LookupNameType, $LookupName, $ReturnNameType
Dim $NameTranslate, $ReturnName, $Error, $ErrorText
$Error = 0 $ErrorText = "" $ReturnName = ""
$NameTranslate = CREATEOBJECT ("NameTranslate") $Error = @error $ErrorText = @serror
if $Error = 0
$NameTranslate.Init ($InitType, $BindName) $Error = @error $ErrorText = @serror
if $Error = 0
$NameTranslate.Set ($LookupNameType, $LookupName) $Error = @error $ErrorText = @serror
if $Error = 0
$ReturnName = $NameTranslate.Get($ReturnNameType) $Error = @error $ErrorText = @serror
endif
endif
endif
$TranslateName = $ReturnName, $Error, $ErrorText
Endfunction