Home Forums General XMetaL Discussion How to Copy File in another folder in Xmetal Reply To: How to Copy File in another folder in Xmetal

Derek Read

Reply to: How to Copy File in another folder in Xmetal

We don't have any APIs for manipulating the file system.

The simplest option would be to use Microsoft's “File System Object” (FSO) to do this:

//XMetaL Script Language JScript:
var imagepath = "c:\images\myimage.jpg";
var newimagepath = "c:\test\myimage.jpg";
var fso = new ActiveXObject("Scripting.FileSystemObject");
fso.CopyFile(imagepath,newimagepath);
fso = null;

See Microsoft's documentation for detailed information on all of the properties and methods the File System Object supports. Most examples they give will be in VB or VBScript so be aware of the differences between VB and JScript if your macro is in JScript.

Keep in mind that if you build a solution that moves files around it is possible that it will conflict with the CMS systems XMetaL Author integrates with. So you will want to specifically test that if your solution includes a CMS.

Reply

Products
Downloads
Support