OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

Home Directory

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API
View previous topic :: View next topic  
Author Message
veru
Power User
Power User


Joined: 09 Jul 2004
Posts: 80

PostPosted: Thu Oct 21, 2004 7:05 am    Post subject: Home Directory Reply with quote

Hi,

how do I retrieve the Home directory of the current user?

thanks,
verena
Back to top
View user's profile Send private message
SergeM
Super User
Super User


Joined: 09 Sep 2003
Posts: 3211
Location: Troyes France

PostPosted: Thu Oct 21, 2004 7:56 am    Post subject: Reply with quote

I have no link but you can find an answer in this forum because this question has been asked
_________________
Linux & Windows OOo3.0
UNO & C++ : WIKI
http://wiki.services.openoffice.org/wiki/Using_Cpp_with_the_OOo_SDK
In French
http://wiki.services.openoffice.org/wiki/Documentation/FR/Cpp_Guide
Back to top
View user's profile Send private message Visit poster's website
SergeM
Super User
Super User


Joined: 09 Sep 2003
Posts: 3211
Location: Troyes France

PostPosted: Thu Oct 21, 2004 8:21 am    Post subject: Reply with quote

I find no answer to your question in the forum, but have a look to :
Please, help my to know the path
http://www.oooforum.org/forum/viewtopic.php?p=50567&highlight=path#50567
and then parse the URL.
_________________
Linux & Windows OOo3.0
UNO & C++ : WIKI
http://wiki.services.openoffice.org/wiki/Using_Cpp_with_the_OOo_SDK
In French
http://wiki.services.openoffice.org/wiki/Documentation/FR/Cpp_Guide
Back to top
View user's profile Send private message Visit poster's website
DannyB
Moderator
Moderator


Joined: 02 Apr 2003
Posts: 3991
Location: Lawrence, Kansas, USA

PostPosted: Thu Oct 21, 2004 12:30 pm    Post subject: Reply with quote

Display your PathSettings
http://www.oooforum.org/forum/viewtopic.php?t=7459

Other useful stuff about PathSettings.....
http://www.oooforum.org/forum/viewtopic.php?p=34148#34148

Code:
Sub Main
   oPathSettings = CreateUnoService( "com.sun.star.util.PathSettings" )

   ' Example of how to get a single property you are after.
   MsgBox( oPathSettings.Work )
   ' Convert URL into a path.
   MsgBox( ConvertFromURL( oPathSettings.Work ) )
End Sub


http://www.oooforum.org/forum/viewtopic.php?t=4913
http://www.oooforum.org/forum/viewtopic.php?t=4613
http://www.oooforum.org/forum/viewtopic.php?t=3707

Use the Tools library (soffice) to get path settings...
http://www.oooforum.org/forum/viewtopic.php?t=5720

PathSettings has many properties. Some of the above deal with getting the Temp property. But there are other path properties in PathSettings as well. Try looking at the Work property of PathSettings.

Bear in mind that the user can change some pathsettings by using the Tools --> Options --> OpenOffice.org --> Paths.


Another possibility that only works in OOo Basic is to check environment variables. This does not involve using the API. It involves using the Environ() function of the Baisc language.
Code:
Sub Main
   Print Environ( "HOME" )
End Sub

This works on Linux. It will always return the pathname "/home/danny". A similar technique would probably work on Windows, assuming that Windows has an environment variable sthat points to your home directory.
_________________
Want to make OOo Drawings like the colored flower design to the left?
Back to top
View user's profile Send private message
Cybb20
Super User
Super User


Joined: 02 Mar 2004
Posts: 1569
Location: Frankfurt, Germany

PostPosted: Thu Oct 21, 2004 1:20 pm    Post subject: Reply with quote

DannyB wrote:

This works on Linux. It will always return the pathname "/home/danny". A similar technique would probably work on Windows, assuming that Windows has an environment variable sthat points to your home directory.


Yes it has:
Code:

msgbox Environ("USERPROFILE")


Christian
_________________
- Knowledge is Power -
Back to top
View user's profile Send private message Send e-mail
veru
Power User
Power User


Joined: 09 Jul 2004
Posts: 80

PostPosted: Thu Oct 21, 2004 10:50 pm    Post subject: Reply with quote

Great! Thank you all for your answers.
Code:
Environ("USERPROFILE")

was exactly what I was looking for.
thanks,
Verena
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group