A loop of several data files and save in respect of each

Here's what I'm trying to do, I have a file, Indesign CS5.5 basis, which we'll call the master file.  I have several data files of text delimited by tabs that contain a column engines and ReplaceWith.  I have the script so that I can take 1 text file and it goes through the InDesign file and made all the changes based on the text file.  What I need for the script to be able to do, is instead of asking the 1 text file:

1. it prompts for a folder that contains all my text files

2 begins by the first text file and not the FindReplace I already work based out of the main file in Indesign.

3. Once finished the first text file, make a backup - from the Indesign file updated with any changes.

4 file Indesign Master returns to the original state, less the changes is ready for the next text file.

5. move the following text file and bounce the find/replace on the original master Indesign file.

And then basically the steps 3-5 in loop until all text files have been processed.

As I said, I did the process for one file at a time, I just need to make sure it can browse a lot of them without someone needing to keep this.

Thank you!

Something to help you get started:

var inputFolderPath = "/path/to/folder",
    outputFolderPath = "/path/to/other/folder",
    templatePath = "/path/to/template.indd",
    inputFolder = new Folder(folderPath),
    outputFolder = new Folder(outputFolderPath),
    template = new File(tempatePath),
    files = inputFolder.getFiles(),
    file, fileString, doc, idName, i, l;

outputFolder.create();
for (i = 0, l = files.length; i < l; i++) {
    file = file.open('r');
    idName = file.displayName.replace(/\.[^\/.]+$/, '') + ".indd";
    fileString = file.read();
    file.close();
    doc = app.open(template);
    doYourStuff(doc, fileString);
    doc.save(outputFolder + "/" + idName);
    doc.close();
}

It would be files InDesign versioned the same name as the input text file but with the extension ".indd". You may need to consider to filter files in the getFiles() call, if you have files in your input file types, you do not want to deal with. It is clearer to all re - open the file of model on the disk, rather than come back and which is the same.

Jeff

Tags: InDesign

Similar Questions

  • a loop in the data files in a folder

    Hello

    I need to watch several data files. How can I browse all files in a directory in order to get the data from these files?

    Thank you very much

    An autoindexed FOR the loop would be the way to go.  As we said already, use the folder list feature to get a list of files in the folder.

  • How to capture a .gif of a spectrum analyzer file and save the file in PC

    I want to capture a .gif from a spectrum analyzer file and save the file to the PC, but I have a problem when reading data from the instrument. I don't know how to format the string has obtained from the instrument, when I use '%s' or '%t' as string format to read the data from the instrument is truncated.

    my code are, could someone tell me where I'm wrong?

    char resultsArray [5000];

    viPrintf (hSpectrumInstr, ": MMEMTORCR ' CIMAGE.") GIF "\n"); "
    viQueryf (hSpectrumInstr, ": MMEMATA? '") CIMAGE. (' GIF'\n ', '%t', resultsArray);
    printf ("%s", resultsArray);
    GetChar ();

    as you can see your code is not readable, can you post a screenshot or, as before, a Word document?

    When you use "%b" table must be of type ViInt8

  • Download the pdf or jpg file and save it on the device for consultation offline

    Hello

    Publication of an AIR for iOS app via Flash CS5.5, anyone know if it is possible to download a pdf or jpg file and save it on the device for consultation offline?

    If so, could you give me some advice on the relevant categories?

    Thank you

    Mark

    Save the content of the loader in byte array, and then send this byte array to FileStream

    Something like:

    mcLoader = new URLLoader();

    mcLoader.dataFormat = URLLoaderDataFormat.BINARY;

    var req:URLRequest = new URLRequest (file);

    mcLoader.addEventListener (Event.COMPLETE, contentLoaded);

    mcLoader.load (req);

    private void contentLoaded(e:Event):void {}

    var dataContent:ByteArray = new ByteArray();

    dataContent = e.target.data;

    var fileName:String = "mylocal.pdf".

    var f: File = File.applicationStorageDirectory.resolvePath (fileName);

    Save the file in the local space

    If (f.exists == false) {}

    trace ("file does not exist. Record file');

    var fs:FileStream = new FileStream();

    FS. Open (f, FileMode.WRITE)

    fs.writeBytes (dataContent);

    FS. Close();

    trace ('saved');

    }

    }

  • Windows7 won't let me edit the hosts file and save it

    Windows7 won't let me edit the hosts file and save it. What should I do to save the edited host file?

    This is a built-in security feature.  There is an easy solution.  Click onStart-> all programs-> Accessories.  Right click onNotepadand then click run as administrator.  If you are prompted for an administrator password or a confirmation, type the password, or clickallow or Yes.

    Open the Hosts file (from the notebook, that you opened), make your changes, and then click file ->Save.

    Barbara

  • I have deleted the content of several image files and now want to remove the file names. I don't find a way to remove the names.

    * Original title: file names of photos of Deletig Windows after emptying the file

    I have deleted the content of several image files and now want to remove the file names. I don't find a way to remove the names. How can I delete the file names?

    Right-click on the name of the image file, then choose 'delete '.

  • How to open an .art file and save it in another format (jpeg)?

    How to open an .art file and save it in another format (jpeg)?

    Hi michaela.

    Please refer to the below discussion,

    What is an .art file? and how can I open them offline? Yahoo Answers

    How to change an art. AOL file in a jpeg file. I tried... - Q & A

    Let us know the results.

    Kind regards

    Mohit

  • How to say the script colse all files and save them, but not untitle docs

    Hello world

    I want colse open files and save them, but not the files that have never been saved.

    Try this script, but I ran after, all files are not saved.

    docs var = app.documents.
    for (var i = docs.length - 1; i > = 0; i--) {}
    if(App.activeDocument.Saved == false) {}
    docs [i]. Close (SaveOptions.no);
    }
    Another yew (docs [i] m:System.NET.Sockets.Socket.close (SaveOptions.YES));
    }

    can someone tell me what is the problem with the script?

    Thank you

    Respect of

    Teetan


    var docs = app.documents;
    for (var i = docs.length-1; i >= 0; i--) {
        if (docs[i].saved == false) {
            docs[i].close(SaveOptions.NO);
        }
        else {
            docs[i].close(SaveOptions.YES);
        }
    }
    
  • What Version of Adobe do I need power "extract" a page to an existing file and save/download another file?

    What Version of Adobe do I need power "extract" a page to an existing file and save/download another file?

    Hi fcrawford,

    You can use Acrobat Pro 11 or Std to accomplish this.

    Please visit: http://acrobatusers.com/tutorials/extracting-pages

    Kind regards

    Rave

  • Get the former locations of the data files and Redo logs

    Version: 11.2
    Platform: Solaris 10

    When we manage hundreds of DBs, we do not know the locations of all DB files these allows DBs. say a DB goes down and you have all the required RMAN backups.

    When you restore the DB in a new location in the path of the new server, you must run the commands for the data files and ORLs below. But how do we know

    The former location of the data files.

    B. the old location of redo online stores that I can run

    run
    alter database rename file 'oldPath_of_OnlineRedoLogs' to 'newPath_of_OnlineRedoLogs' ;  --- Without this command , the restored control file will still reflect the old control file location
    run {
    set newname for datafile 1 to '/u04/oradata/lmnprod/lmnprod_system01.dbf' ;
    set newname for datafile 2 to '/u04/oradata/lmnprod/lmnprod_sysaux01.dbf' ;
    set newname for datafile 3 to '/u04/oradata/lmnprod/lmnprod_undotbs101.dbf' ;
    set newname for datafile 4 to '/u04/oradata/lmnprod/lmnprod_audit_ts01.dbf' ;
    set newname for datafile 5 to '/u04/oradata/lmnprod/lmnprod_quest_ts01.dbf' ;
    set newname for datafile 6 to '/u04/oradata/lmnprod/lmnprod_yelxr_ts01.dbf' ;
    .
    .
    .
    .
    .
    }

    Hello

    With the help of Oracle 11.2, you can use feature 'set newname for database' using OMF.

    SET NEWNAME FOR DATABASE TO '/oradata/%U';
    RESTORE DATABASE;
    SWITCH DATAFILE ALL;
    SWITCH TEMPFILE ALL;
    RECOVER DATABASE;
    

    After the restore and recover databases (i.e. before resetlog open) you can do to rename redolog. Just a query column member from v$ logfile and deliver ' alter database rename file 'oldPath_of_OnlineRedoLogs' to 'newPath_of_OnlineRedoLogs ';

    When we use the DSO is much easier to use OMF because Oracle automatically creates the directory structure.
    But when we use the file system that the OMF does not serve due DBA dislikes system generated on file system names.

    If you don't like OMF file system, you can use the script on thread below to help restore you using readable for datafile names, tempfile, and redo.

    {message: id = 9866752}

    Kind regards
    Levi Pereira

  • Prepare disks for ASM (data files and FRA)

    I intend to place data files on a disc 1 (sd1) and disk2 (PSD) when the backup of files (FRA) on disk3 (SDC). Here's how I'd do:

    For data files
    Disk1 is divided into a single primary partition (with native Linux what ID 83 not formatted system)
    Disk2 is also divided into a single primary partition (with native Linux ID 83 system not formatted)

    oracleasm createdisk vol1/dev/sda1
    oracleasm createdisk vol2/dev/sdb1

    CREATE DISKGROUP DATA EXTERNAL vol1, vol2 REDUNDANCY;


    For backup FRA

    Disk3 is partitioned into four primary partitions: / Boot (ext3), / (ext3), swap (swap) and /u01 (ext3)

    The FRA will be put under the/U01 and then attend the ASM:

    oracleasm vol3/dev/sdc4 createdisk
    CREATE DISKGROUP DATA EXTERNAL vol3 REDUNDANCY;

    Now, the problem. (1) the/U01 has already be formatted in ext3; (2) Oracle (DBMS) software will also be place under/U01

    It will be a problem?


    Otherwise, I can put FRA on the same drive as the data files, i.e. on disk1 and disk2. In this case, I need to partition the disk 1 in two primary parititions sda1 and sda2 (native Linux system ID 83 not formatted), one for data files and another for FRA (do the same for disk2). The downside is that the data file and the file recovery will be on the same hard drive.


    Please offer some suggestions.


    Thank you

    Scott

    PS: in the environment of production, all the disc 1, 2 and 3 will be on hardware RAID 1.

    RAID 1 will protect you only a device failure. It won't protect you partition, the file damage system or user errors; It will be in the image of the errors and problems like any other data.

    So what happens if you delete by mistake / U01 or some other accident happens and you loose that partition? With your current setup, you will lose everything and will not be able to restore or recover the database. Put tablespaces FRA and DB on the same physical device is certainly a very bad idea, whether or not it is a RAID.

    ASM is not a software RAID 1 mirror. It ensures redundancy of data based on file extensions and knows about files of Oracle database, which is a very good thing. You probably do not want to specify 'external redundancy.

    In a production system, you'll certainly want to mux the critical data and to store the DB controlfiles, redo logs and finally archivelogs on media separate physically in order to avoid the single point of failures wherever possible. You can use partitions and volumes in ASM, but they should be separate physical drives, otherwise you will bypass the ASM data redundancy. You must also have a solid strategy for RMAN backup. The FRA is supposed to store backupsets RMAN, copies of the image, the important archivelogs and multiplexes of the copies of the database files and should therefore always on a separate physical disk.

    Unless you simply play, I strongly suggest that review you your current configuration.

    Published by: Dude on June 29, 2012 04:55

  • CAN I RECOVER DELETED DATA FILE AND ITS TABLESPACE BY USING FLASHBACK DATABASE

    Hello!

    I CREATED THE TABLESPACE WITH ITS DATA FILE.

    SQL > create tablespace usmantbs datafile 'E:\oracle\product\10.2.0\oradata\orcl\usman.dbf' recording petit_fichier the size of 10 M extent management local segment space management auto;

    THEN, I CREATED A USER AND HIM ENTRUST THIS TABLESPACE.

    SQL > create default profil_utilisateur identified by Neil Leal Microsoft account unlock default tablespace usmantbs;
    SQL > grant connect, resources for Neil;

    I CONNECTED WITH Neil as USER AND CREATED a TABLE.

    SQL > conn Leal/Leal
    SQL > create table baseball (id number (9));

    SQL > select current_scn from v$ database;

    CURRENT_SCN
    ---------------------
    545863

    Then I deleted the tablespace including contents and data files...

    SQL > drop tablespace usmantbs including content and data files;

    I have no backup of this data file, but my database is in archive log...

    So I can... .flashback database to the SNA 545863 as it was before the fall... to get back my along its tablespace data file
    Wil I get my datafile back or not? Help, please...

    You can test it by yourself easily :) You will not be able to open your database
    After getting the error, just rename this data file and flashback again. Then open your database

    C:\Documents and Settings\Administrator>sqlplus "/as sysdba"
    
    SQL*Plus: Release 10.2.0.1.0 - Production on Sat Aug 1 14:20:34 2009
    
    Copyright (c) 1982, 2005, Oracle.  All rights reserved.
    
    Connected to:
    Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
    With the Partitioning, OLAP and Data Mining options
    
    SQL> shutdown immediate
    Database closed.
    Database dismounted.
    ORACLE instance shut down.
    SQL> startup mount
    ORACLE instance started.
    
    Total System Global Area  293601280 bytes
    Fixed Size                  1248624 bytes
    Variable Size              96469648 bytes
    Database Buffers          192937984 bytes
    Redo Buffers                2945024 bytes
    Database mounted.
    
    SQL> alter database archivelog;
    
    Database altered.
    
    SQL> alter database flashback on;
    
    Database altered.
    
    SQL> alter database open;
    
    Database altered.
    
    SQL> create tablespace tb datafile 'c:\tb.df' size 1m;
    
    Tablespace created.
    
    SQL> create user tb identified by tb;
    
    User created.
    
    SQL> grant dba to tb;
    
    Grant succeeded.
    
    SQL> alter user tb default tablespace tb;
    
    User altered.
    
    SQL> create table tb (id number);
    
    Table created.
    
    SQL> select current_scn from v$database;
    
    CURRENT_SCN
    -----------
         547292
    
    SQL> drop tablespace tb including contents and datafiles;
    
    Tablespace dropped.
    
    SQL> shutdown immediate
    Database closed.
    Database dismounted.
    ORACLE instance shut down.
    SQL> startup mount
    ORACLE instance started.
    
    Total System Global Area  293601280 bytes
    Fixed Size                  1248624 bytes
    Variable Size              96469648 bytes
    Database Buffers          192937984 bytes
    Redo Buffers                2945024 bytes
    Database mounted.
    
    SQL> flashback database to scn 547292;
    flashback database to scn 547292
    *
    ERROR at line 1:
    ORA-38795: warning: FLASHBACK succeeded but OPEN RESETLOGS would get error
    below
    ORA-01245: offline file 5 will be lost if RESETLOGS is done
    ORA-01111: name for data file 5 is unknown - rename to correct file
    ORA-01110: data file 5: 'C:\ORACLE\PRODUCT\10.2.0\DB_1\DATABASE\UNNAMED00005'
    
    SQL> alter database open resetlogs;
    alter database open resetlogs
    *
    ERROR at line 1:
    ORA-01245: offline file 5 will be lost if RESETLOGS is done
    ORA-01111: name for data file 5 is unknown - rename to correct file
    ORA-01110: data file 5: 'C:\ORACLE\PRODUCT\10.2.0\DB_1\DATABASE\UNNAMED00005'
    
    SQL> select name from v$datafile;
    
    NAME
    --------------------------------------------------------------------------------
    
    C:\ORACLE\PRODUCT\10.2.0\ORADATA\TEST1\SYSTEM01.DBF
    C:\ORACLE\PRODUCT\10.2.0\ORADATA\TEST1\UNDOTBS01.DBF
    C:\ORACLE\PRODUCT\10.2.0\ORADATA\TEST1\SYSAUX01.DBF
    C:\ORACLE\PRODUCT\10.2.0\ORADATA\TEST1\USERS01.DBF
    C:\ORACLE\PRODUCT\10.2.0\DB_1\DATABASE\UNNAMED00005
    
    SQL> alter database create datafile 'C:\ORACLE\PRODUCT\10.2.0\DB_1\DATABASE\UNNAMED00005' as 'c:\tb.dbf';
    
    Database altered.
    
    SQL> flashback database to scn 547292;
    
    Flashback complete.
    
    SQL> alter database open resetlogs;
    
    Database altered.
    
    SQL>
    
    SQL> select * from tb;
    
    no rows selected
    
    SQL> select name from v$datafile;
    
    NAME
    --------------------------------------------------------------------------------
    
    C:\ORACLE\PRODUCT\10.2.0\ORADATA\TEST1\SYSTEM01.DBF
    C:\ORACLE\PRODUCT\10.2.0\ORADATA\TEST1\UNDOTBS01.DBF
    C:\ORACLE\PRODUCT\10.2.0\ORADATA\TEST1\SYSAUX01.DBF
    C:\ORACLE\PRODUCT\10.2.0\ORADATA\TEST1\USERS01.DBF
    C:\TB.DBF
    
    SQL> select name from v$tablespace;
    
    NAME
    ------------------------------
    SYSTEM
    UNDOTBS1
    SYSAUX
    USERS
    TEMP
    TB
    
    6 rows selected.
    
    SQL>
    

    - - - - - - - - - - - - - - - - - - - - -
    Kamran Agayev a. (10g OCP)
    http://kamranagayev.WordPress.com
    [Step by step installation Oracle Linux and automate the installation by using Shell Script | http://kamranagayev.wordpress.com/2009/05/01/step-by-step-installing-oracle-database-10g-release-2-on-linux-centos-and-automate-the-installation-using-linux-shell-script/]

    Published by: Kamran Agayev, a., July 27, 2009 14:38

  • 2 data files and objects

    Hi all. Suppose I have a tablespace 'users' wich consists of 2 data files on different disks. How do I manage objects to improve performance, how to define this table must be in the first data file and table B in the second file? How to do such a thing? (B-)

    Published by: Junior sysdba on October 6, 2008 22:27

    Hello
    When we create an object in any tablespace, Oracle server itself selects the data file in the tablespace randomly and we cannot specify the data file for a particular object as a table. But it is when the object was created. Actually the server looks in the first available memory contiguous tfor storage.
    But we can actually manage the insertion of data in the object as table as data for a specific table should go to any particular data file. To do this follow these steps.
    1. before inserting data to estimate the size of data to insert.
    2. depending on the size use statement "Alter table allocate extended (datafile...)" to manually allocate scopes in advance.
    3 insert the data.

    This will ensure that the data are inserted in the extents allocated to a particular data file.

    Kind regards
    Navneet

  • Petition for grant to display all objects in the DB in the data base and discovers the DOF for each.

    Dear administrators,

    I created the user but now I have a requirement for the granting of privileges to view all objects in the DB in the data base and discovers the DOF for each.

    Any help please

    Ritz

    Thanks to advise all the

  • merge several *.dat files in a single *.dat file

    Hallo,

    I have several measure *.dat files. How to merge files it is to have one file? I want a *.dat file can be traced graphic.

    Should I create a separate vi?

    Or

    Must use addons toolkit in labview?

    Please help me...

    Thank you

    respect,

    Chaoui

    Hi macan,.

    Only, I've attached a screenshot of my diagram of blocks on the merging of files. Here already a few three dat files IE 1.dat, 2.dat, and 3. dat, I created and I'm

    trying to merge all the dat files 1. itself.

    Thank you and best regards,

    srikrishnaNF

Maybe you are looking for