Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to get "My Documents" location in Tcl

120 views
Skip to first unread message

RA

unread,
Oct 9, 2004, 8:47:51 AM10/9/04
to
Hi All,

Either I must be looking in the wrong location or I'm the first to ask
this question (probably the first), but I do not know how to get the
user's "My Documents" location of Windows from Tcl/Tk. This question
would also apply to "My Pictures", etc.

I want to use it because I want my Tcl program to store the data files
in the "My Documents" directory, and not in the directory where I
store my program (that is: c:\Program Files\<my program name>)

Roalt

USCode

unread,
Oct 9, 2004, 9:29:11 AM10/9/04
to
Did you look for them at:
C:\Documents and Settings\(user name)\My Documents
?

"RA" <googl...@roalt.com> wrote in message
news:271727eb.04100...@posting.google.com...

Georgios Petasis

unread,
Oct 9, 2004, 10:01:04 AM10/9/04
to
You can also try the environmental variables.
Typing "set" in a dos prompt will show all of them.
You can use for example the value of USERPROFILE\My Documents...

George

"USCode" <usc...@dontspam.me> wrote in message
news:yOednYqfruc...@comcast.com...

Kaitzschu

unread,
Oct 9, 2004, 10:32:55 AM10/9/04
to
On Sat, 9 Oct 2004, USCode wrote:

> Did you look for them at:
> C:\Documents and Settings\(user name)\My Documents
> ?

USCode, descriptive alias, indeed. Try that with localized Windows. Or
with XP and moved My Documents folder. No offense :)

I still haven't graduated from expert school, but this is what I would
try (sorry for excess line length).
registry get {HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders} {Personal}
That gives us (me, English W2k) "%USERPROFILE%\My Documents". Magic env()
gives %USERPROFILE% from
set env(USERPROFILE)
and rest is fiddling around with appending and replacing and messing up
backslashes, and wondering whether this is portable at all. Next step
after that is to play with [registry values] and find rest of all that
interesting information there is.

That was my best shot, now make it right, folks :)

> "RA" <googl...@roalt.com> wrote


> >
> > Either I must be looking in the wrong location or I'm the first to ask
> > this question (probably the first), but I do not know how to get the
> > user's "My Documents" location of Windows from Tcl/Tk. This question
> > would also apply to "My Pictures", etc.

--
-Kaitzschu
echo "\|/ ____ \|/>\"@'/ ,. \\\`@\">/_| \__/ |_\> \__U_/" | sed -e "s/>/\n/g"

Darren New

unread,
Oct 9, 2004, 1:13:24 PM10/9/04
to
USCode wrote:
> Did you look for them at:
> C:\Documents and Settings\(user name)\My Documents
> ?

Bzzzt. Not if you installed to drive D:, renamed the user, and then
moved the My Documents folder to someplace else. :)

There are a variety of environment variables and registry entries that
will tell you where this is, and probably a system call as well.

USCode

unread,
Oct 9, 2004, 11:30:58 PM10/9/04
to
"Kaitzschu" <kait...@kaitzschu.cjb.net.nospam.plz.invalid> wrote in
message news:Pine.LNX.4.58.04...@tuomi.oulu.fi...

> On Sat, 9 Oct 2004, USCode wrote:
>
>> Did you look for them at:
>> C:\Documents and Settings\(user name)\My Documents
>> ?
>
> USCode, descriptive alias, indeed. Try that with localized Windows. Or
> with XP and moved My Documents folder. No offense :)
>

It was just a suggestion...maybe I misunderstood his post.


USCode

unread,
Oct 9, 2004, 11:32:00 PM10/9/04
to
"Darren New" <dn...@san.rr.com> wrote in message
news:U_U9d.2593$Z5....@twister.socal.rr.com...
His post gave an example of c:\... I just thought he was asked where it was
located on the physical drive, not in explorer... sheesh!


RA

unread,
Oct 10, 2004, 2:08:50 AM10/10/04
to
Hi Kaitzschu

Thanks for the tip! I think this is indeed the best way to get the 'My
Documents' folder, as I know it can be moved to another location than
c:\Documents and Settings\<user name>\...

Now see if this tip makes it into Tcl-URL... :-)

Roalt

0 new messages