Hi,
Thanks for all of your replies, I have got a little further with this problem, using kix & forms we want our Teachers that dont know a pupils username to be able to type the display name int my form and this returns 'username' so with the UDF above the following script, Code:
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
$UserDistinguishedName = TranslateName (1, "kingsnortongirl", 4, "VICTORIA BENNETT", 3)[0]
? $UserDistinguishedName
exit 1
Then returns Code:
KINGSNORTONGIRL\02BenneV
(Thanks Howard)
This is my form/script uptill now, Code:
$Form = CreateObject("kixtart.Form")
$Form.Size = 255,400
$Form.Text = "Accessing Home Directories -By S. Wintle"
$Form.BackColor = 186,218,230
$TextBox = $Form.TextBox("", 110,70,90,20)
$TextBox1 = $Form.TextBox("", 110,105,90,20)
$label = $form.label("Please Type In Students Username.",20,60,80,40)
$label1 = $form.label("Else type fullname.",20,105,80,40)
$Button = $Form.Button("Get user",70,170,120,40)
$Button1 = $Form.Button("Connect",70,220,120,40)
$Button2 = $Form.Button("Back To Main Menu",70,270,120,40)
$ExitButton = $Form.Button("Exit", 70,320,120,40)
$fraBanner = $FORM.PictureBox
$fraBanner.BACKCOLOR = $FORM.RGB(255,255,255)
$fraBanner.HEIGHT = 30
$fraBanner.LEFT = 7
$fraBanner.TOP = 10
$fraBanner.WIDTH = 230
$fraBanner.FONTSIZE = 14
$fraBanner.FONTNAME = "verdana"
$fraBanner.ForeColor = 0
$fraBanner.PrintXY(0,0,"Home Directories")
$Button.onclick = "Button_Click()"
$Button1.onclick = "Button1_CLick()"
$Button2.onclick = "Button2_CLick()"
$ExitButton.OnClick = "quit()"
$Form.Center
$Form.Show
while $Form.Visible
$=Execute($Form.DoEvents)
Loop
Quit()
Function Button_Click
$dspname = $TextBox1.Text
$UserDistinguishedName = TranslateName (1, "kingsnortongirl", 4, $dspname, 3)[0]
;? $UserDistinguishedName
$UserDistinguishedName = $TextBox.Text
EndFunction
Function Button1_Click
$user = $TextBox.value + "$"
use I: /del
use I: "\\curricsvr1\" + $user
if not @error
run "explorer i:\"
endif
EndFunction
As you can see I want the output of '$UserDistinguishedName' to appear in my text box. Cleary i'm doing sonmething wrong! Heellppp!
Cheers
Ranj.