Copy all indd files in a specific location

Hello guys I do not know why my script does not work as I want.

I want my script to work in this way, when I choose a folder in the my script dialog box to choose all the .indd files

and put them in a specific location

See code below

var myFolder = Folder.selectDialog ('Choose a Folder');
$.writeln('-------------------------------\r' + myFolder.displayName + '\r-------------------------------\r');
if(myFolder != null){
  var myFiles = myFolder.getFiles('*.indd');
  for (i = 0; i < myFiles.length; i++)
  {
  var myFile = myFiles[i];
  // myTargetFolder = "/Kommuni/LaRe/LareAUTO/341542" // put files here



myFiles[i].copy ("/Kommuni/LaRe/LareAUTO/341542/");


// $.writeln(myFile.displayName);  // just for write the data in console
  }
}



Can someone help me put a correct code here

Thanks in advance

Congratulations to all members

Hello

You must use a valid path to a file or a folder, so:

//....
destFile = new File("/Kommuni/LaRe/LareAUTO/341542/" + mFile.name);      // to create an object
$.writeln( destFile.name + " - " + destFile.exists);    //  to check if your path exists
myFiles[i].copy (destFile);    //    to copy file
//.....

Jarek

Tags: InDesign

Similar Questions

  • "I can't copy all the files to my kingston sd card, when I try to copy his shows that" remove right protection "so plsss help me get rid of this.

    "I can't copy all the files to my kingston sd card, when I try to copy his shows that" remove right protection "so plsss help me get rid of this.

    Hi ebugsasi,
     
    To remove protect him writing on a kingston Micro SD cards, locate a switch or button on the side of the micro SD adapter card. It will normally be a symbol of locking/unlocking on it. Put it to the unlocked position.
     
    This should remove the write-protection feature.
     
    Keep me updated on the status of the issue.
  • Open a pdf file to a specific location

    Dear friends,

    I would like to support a dialog with a help button that needs to open a pdf file to a specific location, is defined by number of page or (better) by named Destination.

    var helpFile = File($.fileName.replace (/\.jsx(?:bin)?$/i , ".pdf"));
    OpenPDF (helpFile, "FMcalccalculations"); // named dest = M8.newlink.FMcalccalculations
    
    function OpenPDF (fileName, destination) {
      if (fileName.exists) {
        fileName.execute("nameddest=M8.newlink." + destination);
      }
    }
    

    This is to open the pdf file on the first page.

    How can I pass parameters - not knowing what pgm will open the pdf file (depending on the installation of the user)?

    I've seen (IMHO) using an intermediary VBscriptthat crunch, but I have not yet tested this approach. As far as I understand that this would imply a VSscript for each destination in the pdf file.

    All ideas are wolcome.

    Klaus

    Well, friends, I found a solution on StackOverflow.com: in German, we say such a solution 'von fun druch die brust projectiles' fur.

    ExtendScript:

    // Open PDF at named destination
    
    var theFile = "PDFwithDestination.pdf";           // for my case: in same path as this script
    var destination = "M8.newlink.FMcalcseries"       // needs to be found in pdf, because the 8 is not a constant
    OpenPdfAtDestination (theFile, destination);
    
    function OpenPdfAtDestination (pdfFile, namedDestination) { // ====================================
    var path = GetScriptPath () + "\\";
    var location = "nameddest=" + namedDestination;   // see "Parameters for Opening PDF Files"
    
    // Call OpenPdfWithParameters, according to
    // http://stackoverflow.com/questions/20862868/file-execute-is-not-executing-my-script-how-to-debug-this-issue/20863131#20863131
    // A workaround to pass arguments is to create another file, that calls this script with arguments.
    // Yawar 2015-03-15
    
    // Create the calling batch file
    var tempFile = File (path + "tempScript.bat");
      tempFile.open("w");
      tempFile.encoding = "UTF-8";
      tempFile.writeln (path + "OpenPdfWithparameters.exe " + '/A ' + location + ' "' + path + pdfFile + '"');
      tempFile.close();
      tempFile.execute ();
      tempFile.delete;
    }
    
    function GetScriptPath () { //=====================================================================
    // Get the script path
    // Returns path in the function
      var scrPath, newPath, winPath, lastBSlash;
    
    // $.fileName: script path (including the file-name of the script)
    // platform independent format e.g. /e/_DDDprojects/FM+EN-escript/escript
      scrPath = $.fileName;
      winPath = new File (scrPath);
      scrPath = winPath.fsName;                       // get Windows format
      lastBSlash = scrPath.lastIndexOf("\\");         // \ needs escaping
      scrPath = scrPath.substring(0, lastBSlash);
      return scrPath;                                 // no final \ !
    } // --- end GetScriptPath
    

    AutoHotKey script - must be converted into an exe file:

    ; OpenPdfWithParameters.ahk
    ; 2016-04-15 Klaus Daube
    
    ; Get the arguments from the caller (works only in compiled version!)
    parmList =
    Loop, %0%  ; For each parameter:
    {
      param := %A_Index%
      parmList = %parmList% `n%param%
    }
    ; MsgBox, Number of parameters: %0%`n%parmList%
    
    ; let's find the relevant application
    RegRead, sDefaultApp, HKCR, .pdf
    RegRead, sDefaultAct, HKCR, %sDefaultApp%\shell
    RegRead, sDefaultCommand, HKCR, %sDefaultApp%\shell\%sDefaultAct%\command
    StringTrimRight, command, sDefaultCommand, 5 ; remove the "%1"
    ; MsgBox %command%                      ; "H:\Adobe\Acrobat11\Acrobat\Acrobat.exe"
    
    ; open the pdf with the parameters according to "Parameters for Opening PDF Files"
    Run, %command% %parmList%
    

    This works, however a flicker is created due to the execution of the batch file.

  • My computer crashed and after the purchase of another, I used the Migration Wizard to copy all the files to the new computer.  Everything was going well until I tried to launch LR6.  It was two weeks ago and a search for many pages of the Adobe Web site. 

    My computer crashed and after the purchase of another, I used the Migration Wizard to copy all the files to the new computer.  Everything was going well until I tried to launch LR6.  It was two weeks ago and a search for many pages of the Adobe Web site.  I think I've exhausted all the remedies listed without success codes error A12E5 to questions cloud creative, Manager of Application and error 1: Configuration problems.  I'm ready to reformat my computer and try again with Time Machine.  Help would be greatly appreciated before I waste more time on this task. Any further suggestions?

    Migration of Mac with Time Machine WILL NOT WORK with the Adobe program activations due to hidden registration files

    Sign out of your account... Uninstall... to run vacuuming...

    -non-Cloud programs, to disable the service before uninstalling

    -http://helpx.adobe.com/creative-cloud/help/install-apps.html (and uninstall)

    -using the vacuuming after uninstalling and before reinstalling is often necessary

    -https://helpx.adobe.com/creative-suite/kb/cs5-cleaner-tool-installation-problems.html

    -Restart your computer... Sign in to your account... Reinstall

  • I'm transferring my entire website from my old Web host at GoDaddy. How to copy all my files (in Dreamweaver) to my Web site from the server, it's on now, on my desk? So I can then connect you to my new server with GoDaddy and transfer all s

    I'm transferring my entire website from my old Web host at GoDaddy. How to copy all my files (in Dreamweaver) to my Web site from the server, it's on now, on my desk? So I can then connect you to my new server with GoDaddy and transfer all of the site?

    If you don't have local copies of your site on your computer...

    1 create a new Site definition using your old FTP GS-01 information: definition of a new site. Learn Dreamweaver CS5 & CS5.5 | Adobe TV

    2. Once you have the defined site and can connect, click on the Get (down arrow) command in the files Panel

    3 when you are prompted to hit "get the entire Site? Yes

    4. After downloading the entire site, navigate to the Site > Manage Sites > click the site > Edit > servers > click on the remote server > Edit to enter your new GoDaddy FTP Info

    5. after the test connection to check, you can connect, click the command Put (up arrow) in the files Panel

    If you have a site already defined for your old Web host, go to #4 above.

  • Unable to save the file in a specific location

    I created a C:\Users\Projects\Writing projects folder to save my writing projects in. I tried to put a Word file in this folder and I was told that I don't have administrator rights to save a file in this location. I must have administrator rights, because it is my PC, and I have only set up an account with which I set install programs, remove any software, create folders, etc etc, so what happens? He told me that I could save the file under 'my documents '. I don't want to post here, because a load of other detritus accumulates in this folder, and these are files of project specific I want to keep separate (I'm a writer).

    Hmmm, I just did exactly that on my computer with Word 2007 and Home Premium from Windows 7 64 and had no problem at all.  If you have the professional version or complete edition, you can run in a part of the increased security, maybe.  You can still create these folders as subfolders of the My Documents folder and isolate what you put there like that.  Another thing you could try would be to create a LIBRARY that points to the C:\Users\Projects\Writing project that you created.  This might be more likely to succeed.

    One thing I just noticed that is not in your post is your user ID.  You create these records in C:\Users\yourID\Projects\Writing projects.  That's what I was doing.

    Good luck.

  • PRINT EROR & ANABLE TO COPY ALL SYSTEM FILES ON USB KEY OR EXTERNAL DIVIDED REGARDING

    DEAR SIR.

    I AM ANABLE TO COPY PASTE ANY FILE FROM MY SYSTEM TO ANY EXTERNAL DIVIDED OR USB PEN DRIVE, & PROBLEN ANOTHER IS ANABLE TO PRINT FROM SYSTEM

    Hello Serge,

    Please keep us informed about the issue.

    I suggest you to refer the suggestion provided in the following Microsoft article and check if it helps.

    Access denied"or other errors in the access to or work with files and folders in Windows

    http://support.Microsoft.com/kb/2623670/en-us

    I suggest you run the command in elevated command prompt and see if it helps below.

    • Go to Start, click all programs and open the Accessories.
    • Right-click on command prompt in the list programs, and then select run as administrator. If you are prompted for an administrator password or for confirmation, type your password, or click OK.
    • In the command prompt, type the following command and press ENTER:

    TAKEOWN /F C: /A

    • Then try to run the following command.

    TAKEOWN /F C:

    This will give you the admin and your permissions of full account to all files on the C: drive

    Hope it would help. If problem persists always post back with the current state of your computer and the result of the proposed suggestion, we will be happy to help you.

    Thank you.

  • How to place a file at a specific location

    I need to know how to place an eps graphic in a specific location.  I can put a file but I can't seem to be able to move it.  Is it possible to position it correctly over the action of the place?

    Thank you

    Hi Mario,.

    Take a look at the ImageCatalog.jsx that comes with ID and look for the line:

    myRectangle = myPage.rectangles.add (myDocument.layers.item(-1), defined, undefined, {geometricBounds: [myY1, myX1, myY2, myX2], strokeWeight:0, strokeColor:myDocument.swatches.item("None")});})

    This should help you to get what you need (note geometricBounds: [15,15,59.5,66.5]).

    myDocument var = app.documents.add ();
    {with (myDocument)}
    myPage var = pages [0];
    {with (MyPage)}
    myFrame = pages.item var (0).rectangles.add ({geometricBounds: [15,15,59.5,66.5], strokeWeight:0, strokeColor:myDocument.swatches.item("None")});})
    {with (myFrame)}
    myFile = myFrame.place (File (myFile), false);
    }
    }

    You can also check:

    http://www.jongware.com/idjshelp.html

  • Place the ini file in a specific location when the application generating

    Hello

    I have a little problem.  I have an ini file that I use to store some settings.  Lets call this app.ini file.  When I build the Application.exe, it puts this file in the data directory.  I was hoping that it would be at a higher level and be located in the same directory as Application.exe is (otherwise it will not read the file correctly.)  Looked at the settings of the Source file in the list of categories in the Properties window for the construction and all the 'Identical to the appellant' Destination, but he did not where I wanted.  I would really like this file to a directory higher when I do my build so that my application to read correctly.  Any suggestions?

    I use this executable then when I do my Installer and the problem just spreads here also, not good.

    One way to solve the problem:

    (1) in the build Properties window, select Destinations and create a new destination. Select the same directory where the exe file will be stored as 'Path of Destination'

    (2) assign this destination in the .ini file.

    Let me know if it works

    Marco

  • How to copy all the files from one folder to another?

    Hi all

    I use this code but the files are not copied.

    sourceFolder var = new Folder("/Users/admin5/Desktop/Fonts");

    targetFolder var = new Folder("/Users/admin5/Desktop/123/");

    myFiles = sourceFolder.getFiles ();

    for (var i = 0; i < myFiles.length; i ++)

    {
    Alert (myfiles [i]);

    var myFile2 = new queue (myFiles [i]);    Alert (myFile2.fsName);
    If (myFile2.copy (targetFolder))

    {

    Alert ("Yes");

    }

    on the other
    {

    Alert ("no");

    }

    }

    var MYF = Folder("/Users/admin5/Desktop/Fonts");

    If (myf! = null)

    {

    var myfile = myf.getFiles ("*. *");

    var filename = myf.name;

    for (var i = 0; i)<>

    {

    var sourcePath = File("/Users/admin5/Desktop/Fonts/"+myFiles[i].name);

    var targetPath = File("/Users/admin5/Desktop/123/"+myfile[i].name);

    sourcePath.copy (targetPath);

    }

    }

  • What is the best way to copy all the files from one hard drive to another?

    Old disk 60Go new 320 GB drive.  I want to do the new replacement for the old disk drive.

    Old disk 60Go new 320 GB drive.  I want to do the new replacement for the old disk drive.

    Use disk cloning software.

    The safest way is to use an external hard drive enclosure to maintain the new disc during the cloning operation.  These come with interfaces USB or e-SATA to IDE or SATA interfaces for the drive and the computer.  Be sure to get the correct type.  If you have an available internal drive Bay, you can put the new drive it for the cloning operation, but do NOT restart with two connected drives.  After everything was settled down, you can mount the old disk of 60 GB inside, format and use it for storage of backup.

    Cloning (copy to disc) software may have been bundled with your new drive or may be accessed free of charge from the manufacturer of the new command.

    Otherwise, here are a few apps cloning that I have used myself or have been recommended by members of the community:

    Acronis True Image Home
    Casper
    Paragon Drive Copy
    EASEUS Partition Master

  • Copy foldername and specific indd files.

    Hello guys


    I need a function,

    first of all, there is a dialog window that appears, from the window of dialogue I select indd files and pressed ok. () what should not not all indd file)

    appear a new dialogue window, so I can choose a target to copy the selected files in also, copy the foldername of the location of the files selected indd and create this folder and put the files when I chose a target.


    Finally, create a text file to save all the names of the indd files in / or if its possible to label another way, so I got them.

    I know, in the finder on your mac, you can put a color on the files.

    Could someone help me?

    Thanks in advance

    All members of Adobe


    See you soon!

    Hello

    Try this.

    var _files = File.openDialog("Select indesign files","*.indd",true),
        tarFolder = Folder.selectDialog("Select the target folder"),
        _parent = _files[0].parent.toString().replace(_files[0].parent.parent,"");
    new Folder(tarFolder + _parent).create();
    var filenames = "";
    var txtfile = new File(tarFolder + _parent + "/FileName.txt");
    for(var i=0;i<_files.length;i++)
    {
            _files[i].copy(new File(tarFolder + _parent + "/" + _files[i].name));
            filenames +=_files[i].name + "\r";
        }
    txtfile.open('w');
    txtfile.write(filenames);
    txtfile.close();
    txtfile.execute();
    

    Kind regards

    Cognet

  • How to create a duplicate of a book and all its indd files completely separte associated.

    What is the best way to create a copy of a book about InDesign (.indb), including all associated indd files? I need to keep a copy of the book for printing and another copy to the EPUB export, which will require formatting changes that are not suitable for printing.

    I already copied all applicable indd files in a new folder and then copied the file indb, then "Replace Document selected" to change the applicable path for all indd files in the copied book. However, I fear that all references can still point to the old files of the book. Unfortunately, there is no easy way to say because when I discovered "Divert Options" a reference, it does not show the path of the file to the Document, just the name of the document. I also fear that there could be a few other connections between the old and the files indd or indb duplicate in another way that I'm not aware.

    To clarify, I like two completely different file folders with the same indb and several indd files in to start them with, such as all cross-references in the newly duplicated ebook and indd files are compared to the new ebook and new indd files. Is there an easy way to check the path, not only the file name for the reference document a crossroads?

    I suspect that the problem is the use of. in folder names.

  • How to copy all the names of files in a folder for Notepad?

    I often have to copy all the file names with extensions and the full path to a folder to a ".txt" document, but cannot. Is there an easy way to do this? How? Is there a simple batch file that will do it? Freeware might work, but I'd rather have a simple batch.bat or .exe file that works.

    You can do it, but I don't think that it will include the entire path:
     
    Dir *. * > dir.txt
     
    Steve
     

    I often have to copy all the file names with extensions and the full path to a folder to a ".txt" document, but cannot. Is there an easy way to do this? How? Is there a simple batch file that will do it? Freeware might work, but I'd rather have a simple batch.bat or .exe file that works.

  • Sub - VI copy to another file

    I wrote a program that you call several of the Subvi. For the record, I copy all the files to a new folder before that I make changes, but calling the Sub - VI path from the main program is still in the old folder. Is it possible to make the main program calling the Subvi contained in the new folder (where is the new main program)?

    Thank you.

    Angelia

    Try to rename the old folder to something else temporarily so your VI will not be able to find the Subvi when first loading. Now load your VI.  He will spend time searching the Subvi, but cannot find them (because the folder no longer exists under this name of origin.)  Navigate to the new folder and choose the Subvi has from there.  You can or can not do this a few times more for the other Subvi, which it does not.

    Once you are finished, close and save your VI, now all the Subvi should be linked to the new locations.

    Why you copied everything into a new folder?  You can make a backup to the new location on your project file.  Consider "save the source distribution".

    If I have something to copy in order to perform a backup.  I have to do when everything is closed and copy the whole project folder to a new location.  The new location with the new name is now my back and I make no change in the original folder, so that I don't have to worry about restoring links of any Subvi.

Maybe you are looking for

  • The extensions missing after upgrade to 42.0

    When I go to about: addons he says there is no everything.

  • Use thunderbird on several computers with data on server

    I want to use Thunderbird on my network home/office computers with data on a central computer. For the moment, I need to use mozbackup to transfer data from my desktop computer to laptop, which is a pain. Graeme

  • Satellite A100-784 has an internal microphone?

    I don't know if my A100-784 has an internal microphone, I tried to talk on Skype, yahoo Messenger, but doesn't help, no one can hear me, but I can clearly hear them talking to me. Can someone tell me, is it my laptop or not has an internal microphone

  • Update selected by program element combo box?

    is there a node property or any other method that will allow me to update the currently selected item in a drop-down list programmatically? I am trying to build a routine whereby the user goes to an element (in reality a different graphic) by selecti

  • replace the hard drive and Windows 7 restore

    The HD on my HP Pavilion dv6 - 6047c had been giving me problems for a few months and two days ago, I received a warning about an iminent HD crash.  Quickly, I created a disk of restore CD and I am looking to buy a replacement HD.  Here are a few opt