General XMetaL Discussion
pooh2583 December 7, 2012 at 9:08 am
How to Copy File in another folder in XmetalDecember 7, 2012 at 9:08 amParticipants 0Replies 1Last Activity 10 years, 1 month ago
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.
RegardsDerek Read December 7, 2012 at 8:16 pm
Reply to: How to Copy File in another folder in XmetalDecember 7, 2012 at 8:16 pm
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 = 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.
- You must be logged in to reply to this topic.