×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

i need to save a file to particular drive or folder

i need to save a file to particular drive or folder

i need to save a file to particular drive or folder

(OP)
Hi Guys,
i have this code, i need some help on the below question please

CODE -->

lcUnit = GETENV("COMPUTERNAME")
SET DEFAULT TO (m.lcFolder)
For lnFile = 1 To Adir(aLnk,"*.lnk")
	lcLink = aLnk[m.lnFile,1]
	loFile = loFolder.ParseName(m.lcLink)
	objLink = loFile.GetLink
	Insert Into DeskLinks Values (m.lcUnit, m.lcLink, objLink.Path)
ENDFOR

Go Top
Browse Normal 

i need after the "Browse normal" to add "COPY TO drive\filename type csv" where drive can be any drive i select and pass the "lcunit" value to the "filename", so that way the filename will be saved as whatever is in "lcunit"
so i need to get prompted where to save the csv file, can you please guide me how can i do that ?
Thanks

RE: i need to save a file to particular drive or folder

The easiest way to get prompted for a directory is to call GEDIR(). It's very easy:

CODE -->

lcDir = GETDIR()
IF EMPTY(lcDir)
  * User cancelled
ELSE
  * Everything OK. lcDir now contains the selected directory
ENDIF 

Try it and see.

The test for EMPTY() in needed in case the user presses ESC from the directory dialogue, indicating they want to cancel the whole operation.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads

RE: i need to save a file to particular drive or folder

I don't understand what you are asking in relation to lcUnit. If you want to copy the file (Desklinks?) into the directory that you specified with GETDIR(), and you want the filename to be in whatever is in lcUnit, then you want something like this:

CODE -->

lcDir = GETDIR()
IF EMPTY(lcDir)
  * User cancelled
ELSE
  * Everything OK. lcDir now contains the selected directory
  SELECT Desklinks
  lcDestination = FORECEPATH(lcUnit, lcDir)
  COPY TO (lcDestination)
ENDIF 

If that's not what you want, perhaps you can clarify the question.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads

RE: i need to save a file to particular drive or folder

(OP)
Hi Mike,
Yes, that is what i want to be able to select first where to save the file and then use the value in lcunit as the the filename plus use the copy to as COPY TO (lcDestination) type csv so the file gets saved in the location i select with a filename= lcUnit and with the extension .csv, is that what i meant, i have not tested yet but thanks , if what i wrote here is not what i meant your code does, please correct me

RE: i need to save a file to particular drive or folder

Ernesto, I think my code will do what you want, but try it for yourself. (I didn't test it myself.)

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads

RE: i need to save a file to particular drive or folder

(OP)
Mike you got it perfect thanks so much, really appreciated

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close