General XMetaL Discussion

XMetaL Community Forum General XMetaL Discussion How to Copy File in another folder in Xmetal

  • pooh2583

    How to Copy File in another folder in Xmetal

    Participants 0
    Replies 1
    Last Activity 9 years, 9 months ago

    Hello,

    I am using FileDlg to select a graphic image file, when I select that file, I want to copy it into a folder, How to achieve this using Jscript in Xmetal.

    Please provide some information.

    Regards

    Reply

    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

  • You must be logged in to reply to this topic.

Lost Your Password?

Products
Downloads
Support