#168629 - 2006-09-29 09:17 PM
Signature variable for OU using kix
|
dbond01
Lurker
Registered: 2006-09-29
Posts: 1
|
I am trying to create a variable in a kix script so that if a user is located in a certain OU then they can have different addresses.
I can currently create a variable based on the primary group as shown in the following script. Code:
select case ingroup('!Tech Support Group') $HTMLdata=$HTMLdata+'561.555.2450 Team '+@CRLF case ingroup('!SystemsEngineeringGroup') $HTMLdata=$HTMLdata+$UserPhone+' Direct '+@CRLF $HTMLdata=$HTMLdata+'800.813.6415 Ext. '+$UserPhoneExt+' '+@CRLF $HTMLdata=$HTMLdata+$adFax+' FAX '+@CRLF case ingroup('!SalesInternationalGroup') $HTMLdata=$HTMLdata+'+1.'+$UserPhone+' Direct '+@CRLF $HTMLdata=$HTMLdata+'+1.561.555.2420 Team '+@CRLF $HTMLdata=$HTMLdata+'+1.561.555.2499 FAX
'+@CRLF case ingroup('!SalesGroup') $HTMLdata=$HTMLdata+$UserPhone+' Direct '+@CRLF $HTMLdata=$HTMLdata+'800.813.6415 Ext. '+$UserPhoneExt+' '+@CRLF $HTMLdata=$HTMLdata+'561.555.2499 FAX
'+@CRLF case 1 ; everyone else gets DID + FaxDID only $HTMLdata=$HTMLdata+$UserPhone+' Direct '+@CRLF $HTMLdata=$HTMLdata+$adFax+' FAX
'+@CRLF endselect
Does anyone know what I can do?
Edited by Howard Bullock (2006-09-29 10:25 PM)
|
Top
|
|
|
|
#168630 - 2006-09-29 09:24 PM
Re: Signature variable for OU using kix
|
NTDOC
Administrator
Registered: 2000-07-28
Posts: 11624
Loc: CA
|
Hello and welcome to the board.
Please use the CODE TAGS when posting code so that your formatting remains. It makes it much easier to read your code.
Please check out this UDF and see if it's of any help. TranslateName() http://www.kixhelp.com/udfs/udf/82426.htm
What version of KiXtart are you using? @KIX should show you.
|
Top
|
|
|
|
#168631 - 2006-09-29 10:10 PM
Re: Signature variable for OU using kix
|
Howard Bullock
KiX Supporter
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
doc, I added code tags to the above post. the output in the preview looked ok, but the final display has been corrupted because the text includes HTML <br> tag. Do you know a way to have the tag come thourgh as text and not be interpreted by the browser?
Code:
'A<br>'B
Code:
select case ingroup('!Tech Support Group') $HTMLdata=$HTMLdata+'561.555.2450 Team<br>'+@CRLF case ingroup('!SystemsEngineeringGroup') $HTMLdata=$HTMLdata+$UserPhone+' Direct<br>'+@CRLF $HTMLdata=$HTMLdata+'800.813.6415 Ext. '+$UserPhoneExt+'<br>'+@CRLF $HTMLdata=$HTMLdata+$adFax+' FAX<br>'+@CRLF case ingroup('!SalesInternationalGroup') $HTMLdata=$HTMLdata+'+1.'+$UserPhone+' Direct<br>'+@CRLF $HTMLdata=$HTMLdata+'+1.561.555.2420 Team<br>'+@CRLF $HTMLdata=$HTMLdata+'+1.561.555.2499 FAX</font><br><br></P>'+@CRLF case ingroup('!SalesGroup') $HTMLdata=$HTMLdata+$UserPhone+' Direct<br>'+@CRLF $HTMLdata=$HTMLdata+'800.813.6415 Ext. '+$UserPhoneExt+'<br>'+@CRLF $HTMLdata=$HTMLdata+'561.555.2499 FAX</font><br><br></P>'+@CRLF case 1 ; everyone else gets DID + FaxDID only $HTMLdata=$HTMLdata+$UserPhone+' Direct<br>'+@CRLF $HTMLdata=$HTMLdata+$adFax+' FAX<br><br><br>'+@CRLF endselect
Edited by Howard Bullock (2006-09-29 10:19 PM)
|
Top
|
|
|
|
#168632 - 2006-09-29 10:20 PM
Re: Signature variable for OU using kix
|
Howard Bullock
KiX Supporter
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
Why does the code appear correctly in my post but not in the original post?
|
Top
|
|
|
|
#168634 - 2006-09-29 10:23 PM
Re: Signature variable for OU using kix
|
Howard Bullock
KiX Supporter
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
My concern is the code I posted was copied from the original. Why are the two displayed differently? At least for me the original post has execute the line breaks in the display.
Edited by Howard Bullock (2006-09-29 10:25 PM)
|
Top
|
|
|
|
#168635 - 2006-09-29 10:26 PM
Re: Signature variable for OU using kix
|
kholm
Korg Regular
Registered: 2000-06-19
Posts: 714
Loc: Randers, Denmark
|
You could try this, where $SubOU will give you the the OU for the user.
Code:
$OUName = TranslateName(2,@LServer,3,@LDomain + '\' + @UserID,1) $SubOU = Split($OUName,',OU=')[1]
? 'OU for the user: ' + $SubOU Get $x
Function TranslateName($InitType,$BindName,$LookupNameType,$LookupName,$ReturnNameType) Dim $NameTranslate
$NameTranslate = CreateObject("NameTranslate") If @Error = 0 $NameTranslate.Init($InitType,$BindName) If @Error = 0 $NameTranslate.Set($LookupNameType,$LookupName) If @Error = 0 $TranslateName = $NameTranslate.Get($ReturnNameType) EndIf EndIf EndIf Exit @Error EndFunction
ps. The code for TranslateNeme(), can be found in the UDF forum in a more complete (error checking version)
-Erik
|
Top
|
|
|
|
#168636 - 2006-10-02 09:38 AM
Re: Signature variable for OU using kix
|
Richard H.
Administrator
Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
|
A short method, which I use quite a lot: Code:
$oADInfo = CreateObject("ADSystemInfo") "User OU = '"+SubStr($oAdInfo.UserName,InStr($oADInfo.UserName,"OU="))+"'" ?
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 255 anonymous users online.
|
|
|