Page 1 of 1 1
Topic Options
#168629 - 2006-09-29 09:17 PM Signature variable for OU using kix
dbond01 Offline
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 Offline
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 Offline
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 Offline
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?
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#168633 - 2006-09-29 10:21 PM Re: Signature variable for OU using kix
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11624
Loc: CA
There are sites to lookup those codes (dont' know them off the top of my head) or you could use PostPrep but I don't think it really matters that much.

The code as is gives the general idea. I don't think we're giving out Silver Platter code for this, at least not at the moment.

Top
#168634 - 2006-09-29 10:23 PM Re: Signature variable for OU using kix
Howard Bullock Offline
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)
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#168635 - 2006-09-29 10:26 PM Re: Signature variable for OU using kix
kholm Offline
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 Offline
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
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 366 anonymous users online.
Newest Members
Timothy, Jojo67, MaikSimon, kvn317, kixtarts2025
17874 Registered Users

Generated in 0.058 seconds in which 0.023 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org