cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Copy a file from one folder to another by using a Mathcad routine

SOLVED
Highlighted
Newbie

Copy a file from one folder to another by using a Mathcad routine

Hello,

at the moment I'm programing a Mathcad program to evaluate different datafiles.

For this it would be very helpfull to have a routine which is able to copy a datafile (in my case an Excel file) from a folder and paste it into another folder.

I don't want to read in the data from the Excel file and create a new Excel file by using the funcions READEXCEL or WRITEEXCEL.

Is there any possibility to create such an routine in Mathcad?

Additional it would be also very helpful to rename the name of the file while the program is pasting it.

Thanks a lot in advance!

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Copy a file from one folder to another by using a Mathcad routine

If you are using Mathcad (original) then you should be able to use scripted components.

For me the File copy seems to create the original file in <User>/Local/VirtualStore/.

The copied files end up in C:\Temp.

I added the Delete function (It came from the forum & is much more complete in handling errors etc.)

If you use Mathcad Prime, however, scripted components aren't allowed (yet).

There may be ways to achievre the same result but unfortunately I can't help.

For more information on the FileSystemObject object, script examples and lots of other helpfull information MSDN is always a good source:

http://msdn.microsoft.com/en-us/library/hww8txat(v=vs.84).aspx

Regards

Andy

6 REPLIES 6

Re: Copy a file from one folder to another by using a Mathcad routine

What version of Mathcad?

Re: Copy a file from one folder to another by using a Mathcad routine

If you are using Mathcad (original) then you should be able to use scripted components.

For me the File copy seems to create the original file in <User>/Local/VirtualStore/.

The copied files end up in C:\Temp.

I added the Delete function (It came from the forum & is much more complete in handling errors etc.)

If you use Mathcad Prime, however, scripted components aren't allowed (yet).

There may be ways to achievre the same result but unfortunately I can't help.

For more information on the FileSystemObject object, script examples and lots of other helpfull information MSDN is always a good source:

http://msdn.microsoft.com/en-us/library/hww8txat(v=vs.84).aspx

Regards

Andy

Re: Copy a file from one folder to another by using a Mathcad routine

It's the Mathcad version 15 which I use.

The file copy function seems to be the right one. But I don't understand how it works.

I need to copy an excel file from a defined folder to my current working directory.

I have to do this a couple of times and with each copying step I have to rename the file.

This whole procedure has to be implemented into another routine.

Thanks!

Re: Copy a file from one folder to another by using a Mathcad routine

Now I have figured it out how it works.

My VB knowledge was very rusty.

Thanks a lot for your help.

Re: Copy a file from one folder to another by using a Mathcad routine

Maybe you find the attached useful.

Richards collection always is a source of inspiration http://communities.ptc.com/docs/DOC-1071

EDIT: Fixed a bug in one of the scripts

Re: Copy a file from one folder to another by using a Mathcad routine

Thanks a lot!

I will check it out as soon as I have some time left!