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

Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X

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

ptc-5425890
1-Visitor

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!

ACCEPTED SOLUTION

Accepted Solutions

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

View solution in original post

6 REPLIES 6
Werner_E
25-Diamond I
(To:ptc-5425890)

What version of Mathcad?

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

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!

Now I have figured it out how it works.

My VB knowledge was very rusty.

Thanks a lot for your help.

Werner_E
25-Diamond I
(To:ptc-5425890)

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

Thanks a lot!

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

Announcements

Top Tags