Page 1 of 1 1
Topic Options
#138430 - 2005-04-21 09:34 PM How to determine current user's profile?
ptlk Offline
Lurker

Registered: 2005-04-21
Posts: 3

How do I go about pulling the current user's profile so I can put it in a string? This is on 2k/XP. I realize the %userprofile% variable will do this from a cmd prompt. How do I do it with kix?

Thanks!

Top
#138431 - 2005-04-21 09:44 PM Re: How to determine current user's profile?
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
It works the same in KiX. You can also pull it from the registry.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#138432 - 2005-04-21 09:47 PM Re: How to determine current user's profile?
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11624
Loc: CA
Reading from the FAQ I find this link

Locations of Desktop, Start Menu, etc.

If you need further assistance please let us know.

Top
#138433 - 2005-04-22 12:37 AM Re: How to determine current user's profile?
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
You can pull the information from the Registry, but you can also do -
Code:

Expandenvironmentvars('%userprofile%')



HTH,

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

Top
#138434 - 2005-04-22 12:55 AM Re: How to determine current user's profile?
dadams51 Offline
Lurker

Registered: 2005-04-22
Posts: 1
Thanks very much.

Dan

Top
#138435 - 2005-04-22 01:01 AM Re: How to determine current user's profile?
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Quote:


but you can also do -
Code:

Expandenvironmentvars('%userprofile%')





ja you can, at least until the NoVarsInString Gang get their way with a NoEnvVarsInString option - at which point all bets are off (just kidding guys) ;0)

-Shawn

Top
#138436 - 2005-04-22 01:07 AM Re: How to determine current user's profile?
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Ja, well... the jury is still out on what constitutes a var. Last I checked enviro vars were not included and neither were macros.

Stll, 30 lashes with a wet noodle for you!
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#138437 - 2005-04-22 01:09 AM Re: How to determine current user's profile?
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
ja well, you called me a "loosey-goosey" coder on MSN ... i resemble that remark !
Top
#138438 - 2005-04-22 01:09 AM Re: How to determine current user's profile?
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Ahemm... as long as you don't count the beta. Bye bye to macros.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#138439 - 2005-04-22 01:56 AM Re: How to determine current user's profile?
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11624
Loc: CA
Well to get BACK ON TOPIC

Are you all set then DAN?

Plenty of ways to get the data. The NoVarInStrings the other guys speak of is a directive for the KiX engine to know how to operate with variables inside of strings.

You can look it up in the manual for further information. Generally it is an accepted practice to use it, and is required for posted UDFs.

SETOPTION ("option","value")

Example:
$SO=SetOption('NoVarsInStrings','On')

Top
#138440 - 2005-04-22 03:15 PM Re: How to determine current user's profile?
ptlk Offline
Lurker

Registered: 2005-04-21
Posts: 3
Well that generated more response than I imagined. Thanks all.

Now, what is the best way to check and see if a folder exists? Right now I am doing a CD and checking @error for a non-zero. Is there a cleaner way to do this? I see the exist function in the manual for files. What about folders?

Top
#138441 - 2005-04-22 03:32 PM Re: How to determine current user's profile?
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
Have you tried it? You might be pleasantly surprised.
Top
#138442 - 2005-04-22 03:48 PM Re: How to determine current user's profile?
ptlk Offline
Lurker

Registered: 2005-04-21
Posts: 3
heh..I am indeed pleasantly surprised. The manual entry for EXIST doesnt mention folders so I assumed it would not work.

For the other n00bs out there...EXIST works for files AND folders. Who knew.

Thanks Richard!

Top
#138443 - 2005-04-22 04:22 PM Re: How to determine current user's profile?
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
we did :P
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#138444 - 2005-04-22 06:53 PM Re: How to determine current user's profile?
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11624
Loc: CA
Just an FYI there is a UDF to check if the folder is empty. This is not as easily done with EXIST alone.

EmptyFolder() - checks if folder is empty
 

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 327 anonymous users online.
Newest Members
Jojo67, MaikSimon, kvn317, kixtarts2025, SERoyalty
17873 Registered Users

Generated in 0.091 seconds in which 0.038 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