Jump to content


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.

Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Photo

specify pathname relative to 'My Documents'?


  • Please log in to reply
6 replies to this topic

#1 kvon

kvon

  • Members
  • 53 posts
  • OFFLINE
  •  
  • Location:Ohio, USA
  • Local time:08:29 PM

Posted 11 June 2010 - 08:16 AM

I'm wondering if anyone knows a trick to specify a pathname relative to My Documents which would be usable by scripts etc.

Here's what I'm trying to do (same scenario, couple of different instances): I have 2 computers that I keep sync'd (with MS SyncToy), and the 'My Documents' folder on each machine has a different path name. (Unavoidable, the desktop has 2 hard drives, Mydocs is on the D: drive, the laptop has 1 HD). I have instances where an application or script points to a file, which it specifies with an absolute path name. When that file is under My Documents, the pathname is different on the 2 machines.

I know the system objects like My Documents, My Computer etc have a CLSID (eg My Documents is {450d8fba-ad25-11d0-98a8-0800361b1103}). So what I'd like to do is something like:
{450d8fba-ad25-11d0-98a8-0800361b1103}\folderA\folderB\filename.ext

But the syntax doesn't seem to work.

Any ideas?

Thanks!

BC AdBot (Login to Remove)

 


#2 Taomech

Taomech

  • Members
  • 36 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Australia
  • Local time:10:29 AM

Posted 11 June 2010 - 09:23 AM

As far as I know, there isn't a relative path directly to My Documents.
However, %UserProfile%, will give the username and if we add /My Document/, we get the My Documents folder, relative to the user.
Example: "%UserProfile%\My Documents\folderA\folderB\filename.ext"

Sorry for my wording of this post as I am making it at 1am and I don't think to well. :thumbsup:

Thanks,
Taomech

Edited by Taomech, 11 June 2010 - 09:24 AM.


#3 kvon

kvon
  • Topic Starter

  • Members
  • 53 posts
  • OFFLINE
  •  
  • Location:Ohio, USA
  • Local time:08:29 PM

Posted 11 June 2010 - 09:59 AM

That's a great idea -- tried it though, and can't get it to work. The application doesn't recognize the syntax, don't know if I'm doing it wrong or if the app just doesn't know how to translate windows environment variables?

Thanks!

#4 Andrew

Andrew

    Bleepin' Night Watchman


  • Moderator
  • 8,079 posts
  • ONLINE
  •  
  • Gender:Not Telling
  • Location:Right behind you
  • Local time:04:29 PM

Posted 11 June 2010 - 12:29 PM

What application are you referring to? It would be odd if it can't access the above-mentioned environment variables. (PS: here are some more: http://vlaurie.com/computers2/Articles/environment.htm )

x.png
Boredom Software Stop Highlighting Things


#5 kvon

kvon
  • Topic Starter

  • Members
  • 53 posts
  • OFFLINE
  •  
  • Location:Ohio, USA
  • Local time:08:29 PM

Posted 11 June 2010 - 03:10 PM

Might be because the application is doing its own parsing of the pathname, and might not be doing it in a standard way...

It's a Mozilla Thunderbird extension called 'Signature Switch', and the pathnames in question point to html files that the plugin appends to outgoing emails. The pathnames are stored in a prefs.js file, looks like this:
user_pref("extensions.signatureswitch.signatures", "Generic Default*D:\\Docs and Data\\Documents & Data\\Mozilla Profiles\\Thunderbird\\kvrs2q6n.default\\signature.html...

I tried using the environment variable both ways - through the plugin user interface, and also manually editing the prefs.js file, didn't take it either way. Note the double backslashes, so no tellin if it's interpreting the environment variable syntax properly.

Another application, different problem completely: MS Access database with a linked table pointing to a text file in the same directory. I can give it the env variable to point to the text file, but it translates it to the absolute path name, and stores that - not the variable name. So that doesn't work either.

#6 Andrew

Andrew

    Bleepin' Night Watchman


  • Moderator
  • 8,079 posts
  • ONLINE
  •  
  • Gender:Not Telling
  • Location:Right behind you
  • Local time:04:29 PM

Posted 11 June 2010 - 05:09 PM

Aha! I think this is what you need: http://mozext.achimonline.de/signatureswit...y_variables.php

x.png
Boredom Software Stop Highlighting Things


#7 kvon

kvon
  • Topic Starter

  • Members
  • 53 posts
  • OFFLINE
  •  
  • Location:Ohio, USA
  • Local time:08:29 PM

Posted 11 June 2010 - 05:22 PM

Fantastic!
That did it! Interesting that it only recognizes that format for its 'internal' environment variable, and not the system ones... Oh well.

Thanks very much!




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users