Page 1 of 1 1
Topic Options
#126008 - 2004-09-01 12:08 PM variable names
adio Offline
Fresh Scripter
*

Registered: 2004-08-25
Posts: 28
hi everyone please help. im planning to use the TITLE field as a variable at kix script. just wanna ask what would be my right variable for the title field? thanks, and please post reply the other variable for other fields for which we'll be using for future variable. thanks...
Top
#126009 - 2004-09-01 12:14 PM Re: variable names
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
eh?

The TITLE field of what ?

You mean your domain users title ?

try this :

Code:
  

break on

$user = "NameOfYourUser"

$objUsr = getobject("WinNT://" + @domain + "/" + $user + "/,user")
$Title = $objUsr.Title

"Title of " + $user + " is: " + $Title

get $

exit 1



hmmm ... might require the LDAP Provider though.
Additionally : doesn'T run on NT if you haven't got the ADSI runtime library installed


Edited by Jochen (2004-09-01 12:21 PM)
_________________________



Top
#126010 - 2004-09-01 01:28 PM Re: variable names
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
Quote:

hi everyone please help. im planning to use the TITLE field as a variable at kix script. just wanna ask what would be my right variable for the title field? thanks, and please post reply the other variable for other fields for which we'll be using for future variable. thanks...




Whoa! Slow down!

Is English not your first language, or are you just very excitable?

I've read through this half a dozen times, and I still can't make sense of it.

Think about what you are asking and post again with a little more information.

  • What "TITLE" field do you mean?
  • How are you going to use it?
  • What other "variables" do you think we might know about that you might need?
  • Why are you having trouble finding all this out for yourself?
  • Have you read the FAQs and searched the board for the answers first?
  • Do you need pointers to documentation in Microsoft Developers Network or Knowledge Base?
  • Are you having trouble with the KiXtart.org search facility?


Include as much infomation as you can with your query otherwise we will end up guessing, which make the process of answering your question frustrating for both you and us.

Top
#126011 - 2004-09-01 02:25 PM Re: variable names
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
Richard,

I think he means the Title for the Command-line window (which we use in Batch script)..

Quote:


C:\Documents and Settings\Kent>title /?
Sets the window title for the command prompt window.

TITLE [string]

string Specifies the title for the command prompt window.





Hmm.. Some code -
Code:

break on
$VAR1='opening drive'
SHELL '%COMSPEC% /C TITLE '+$VAR1
SLEEP 2
$VAR1='Scanning...'
SHELL '%COMSPEC% /C TITLE '+$VAR1
drivescan('\\'+@wksta+"\c$$")
$VAR1='process is complete'
SHELL '%COMSPEC% /C TITLE '+$VAR1
?'process is complete'
get $

function drivescan($drive,optional $reserved)
dim $shell,$item,$root
if not $reserved redim $drivescan $root=$drive endif
$shell=createobject("shell.application")
for each $item in $shell.namespace($drive).items
if $item.isfolder
drivescan($item.path,1)
endif
;if 2799>$item.size and 2901<$item.size
;5,366,624
if 5000<$item.size and 5401>$item.size
$item.size " " $item.path ?
endif
next
endfunction



Thanks,

Kent
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#126012 - 2004-09-01 02:28 PM Re: variable names
adio Offline
Fresh Scripter
*

Registered: 2004-08-25
Posts: 28
thnks for the reply, but what i mean is that i want to use the users properties for my variable for my script eg, TITLE field, what ould be my variable for this.. thanks...
Top
#126013 - 2004-09-01 02:47 PM Re: variable names
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
If we take Richard's lead and go over to http://msdn.microsoft.com, we see what you need..

Do a search from the home page of -
"active directory" title user properties

and the first result is - Optimization Using GetInfoEx

Take the vb code -
Code:

' Bind to a specific user object.
Set usr = GetObject("LDAP://CN=Jeff Smith,CN=Users,DC=fabrikam,DC=com")

' The code example assumes that the property description has a single value in the directory.
' Be aware that this will implicitly call GetInfo because, at this point, GetInfo
' has not yet been called (implicitly or explicitly) on the usr object.
Debug.Print "User's common name is " + usr.Get("cn")
Debug.Print "User's title is " + usr.Get("title")
Debug.Print "User's department is " + usr.Get("department")



And.. Convert it to KiXtart -
Code:

; Bind to a specific user object.
$usr = GetObject("LDAP://CN=Jeff Smith,CN=Users,DC=fabrikam,DC=com")
;You could replace this with -
;$usr = GetObject("LDAP://CN="+@fullname+",CN=Users,DC=<YOURCOMPANY>,DC=com")
; The code example assumes that the property description has a single value in the directory.
; Be aware that this will implicitly call GetInfo because, at this point, GetInfo
; has not yet been called (implicitly or explicitly) on the usr object.
?"User's common name is "+$usr.Get("cn")
?"User's title is "+$usr.Get("title")
?"User's department is "+$usr.Get("department")
SLEEP 3



HTH,

Kent
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

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
1 registered (Henriques) and 2516 anonymous users online.
Newest Members
fgarcia, Viginette, ManuvdWielNL, Sir_Barrington, batdk82
17889 Registered Users

Generated in 0.065 seconds in which 0.035 seconds were spent on a total of 12 queries. Zlib compression enabled.

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