Skip to main content
Known Participant
March 6, 2009
Question

Moving Indesign files

  • March 6, 2009
  • 5 replies
  • 1553 views
Hi scripters,

here I am trying to move Indesign files from one path to another path

var myFolder = Folder.selectDialog("Please select a folder");
var myinddfolder = new Folder(myFolder.fullName + "/indd");
myinddfolder.create();
var myFiles=myFolder.getFiles( "*.indd" );
for ( i=0; i < myFiles.length; i++ ){
File(myFiles).Move(myinddfolder);
}

I think Indesign cant support with FSO(File System Object), the above code is my steps to move files, but I am getting error in Move command.

Please advice me how can I move files?

thanks in advance

regards
a r u l
This topic has been closed for replies.

5 replies

hm_arulAuthor
Known Participant
March 6, 2009
Thanks a lot for your information Kasyan Servetsky & Andreas Jansson. Now I am clear.

thanks

regards
a r u l
Kasyan Servetsky
Legend
March 6, 2009
ActiveX is in VB. I don't think you can do it.
Andreas Jansson
Inspiring
March 6, 2009
Hi arul,

Creating ActiveX objects within ExtendScrtipt Javascript of InDesign can't be done. You need to use the built-in File and Folder objects of InDesign, if you use the javascript language of InDesign.

Best regards,
Andreas
hm_arulAuthor
Known Participant
March 6, 2009
Hi Kasyan

Thanks for your code, it works well. I got an idea from you.

Just suggest me whether we can use

ActiveXObject("Scripting.FileSystemObject");

method in Indesign javascript?

Thanks a lot again

regards
a r u l
Kasyan Servetsky
Legend
March 6, 2009
Hi arul,

FSO is in Visual Basic, but your script is in JavaScript.

Kasyan

var myFolder = Folder.selectDialog("Please select a folder");

var myinddfolder = new Folder(myFolder.fullName + "/indd");
if (!myinddfolder.exists) myinddfolder.create();
var myFiles = myFolder.getFiles( "*.indd" );
for ( i = myFiles.length-1; i >= 0 ; i-- ){
var myResult = myFiles.copy(myinddfolder +"/" + myFiles.name);
if (myResult) myFiles.remove();
}