Home > Archive > Programming with dBASE > February 2006 > GetDir default









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author GetDir default
Rick

2006-02-09, 8:23 pm

I would like to write erorr messages to a log file in the local C drive folder for My Documents. More accurately, I would like the user to pick a path to write to, but would like the GetDir() to default to My Documents.

I cannot seem to figure out what the actual path is to that folder on the C drive. Anyone know what I would use in the GetDir() to default to that folder?

Thanks for ideas on this,
Rick
Michael Nuwer [dBVIPS]

2006-02-10, 3:23 am

Rick wrote:
> I would like to write erorr messages to a log file in the local C drive folder for My Documents. More accurately, I would like the user to pick a path to write to, but would like the GetDir() to default to My Documents.
>
> I cannot seem to figure out what the actual path is to that folder on the C drive. Anyone know what I would use in the GetDir() to default to that folder?


Something like the following, maybe

private x, oldDir
oldDir = set("dire")
x = new OleAutoClient("WScript.Shell").SpecialFolders("MyDocuments")
set dire to "&x."
a = getDir()
set dire to "&oldDir."
Ronnie MacGregor

2006-02-10, 3:23 am


On Thu, 09 Feb 2006 22:42:32 -0500
Michael Nuwer [dBVIPS] said :

> private x, oldDir
> oldDir = set("dire")
> x = new OleAutoClient("WScript.Shell").SpecialFolders("MyDocuments")
> set dire to "&x."
> a = getDir()
> set dire to "&oldDir."


While the above will work, I wonder if changing directories might create a
vulnerability to other problems. For example what happens (untested) if the
user cancels or there is an error, or some other problem results in the
directory not being set back to what you need for the rest of your app.


GetaDir.cc by Gary White might offer an alternative :

http://www.geocities.com/geoff_wass...ads/getadir.zip


...... actually CmnDlgs.cc by Gary White might be better :

http://www.geocities.com/geoff_wass...ads/CmnDlgs.zip


--
Ronnie MacGregor
Scotland

Ronnie at
dBASEdeveloper
dot co dot uk

www.dBASEdeveloper.co.uk



Michael Nuwer [dBVIPS]

2006-02-10, 7:23 am

Ronnie MacGregor wrote:
>
> While the above will work, I wonder if changing directories might create a
> vulnerability to other problems. For example what happens (untested) if the
> user cancels or there is an error, or some other problem results in the
> directory not being set back to what you need for the rest of your app.


You are correct. It occurred to me this morning that the getDir()
function takes a parameter and thus changing the default folder is not
necessary. So in addition to the the two suggestions you made, here is
another:

x = new OleAutoClient("WScript.Shell").SpecialFolders("MyDocuments")
a = getDir(x)
Rick

2006-02-10, 11:23 am

Thanks Michael. And thanks for the quick response. Really needed this.

Rick

Michael Nuwer [dBVIPS] Wrote:

> Ronnie MacGregor wrote:
>
> You are correct. It occurred to me this morning that the getDir()
> function takes a parameter and thus changing the default folder is not
> necessary. So in addition to the the two suggestions you made, here is
> another:
>
> x = new OleAutoClient("WScript.Shell").SpecialFolders("MyDocuments")
> a = getDir(x)


Rick

2006-02-10, 11:23 am

Thanks for catching that Ronnie. Will take a look at these.

Rick

Ronnie MacGregor Wrote:

>
> On Thu, 09 Feb 2006 22:42:32 -0500
> Michael Nuwer [dBVIPS] said :
>
>
> While the above will work, I wonder if changing directories might create a
> vulnerability to other problems. For example what happens (untested) if the
> user cancels or there is an error, or some other problem results in the
> directory not being set back to what you need for the rest of your app.
>
>
> GetaDir.cc by Gary White might offer an alternative :
>
> http://www.geocities.com/geoff_wass...ads/getadir.zip
>
>
> ..... actually CmnDlgs.cc by Gary White might be better :
>
> http://www.geocities.com/geoff_wass...ads/CmnDlgs.zip
>
>
> --
> Ronnie MacGregor
> Scotland
>
> Ronnie at
> dBASEdeveloper
> dot co dot uk
>
> www.dBASEdeveloper.co.uk
>
>
>


Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com