Back

If your email is not recognized and you believe it should be, please contact us.

Forum Replies Created

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • in reply to: Script to import partial filename #92573
    Omar Khatib
    Member

    Thanks again for all your help Oleh!

    in reply to: Script to import partial filename #92569
    Omar Khatib
    Member

    I tried the script as is and it didn’t work. Openning InDesign got:
    Error Number: 90884
    Error String: No documents are open

    The variable did not change as expected.

    In our workflow the template we are using for this project will always have the “SlugArea” variable. We want the script to simply ignore any other document.

    I was able to take parts of the new script and got something working, it looks like this:

    #target indesign;
    #targetengine “mysession”;

    var myHandler = function(ev)
    {
    try{
    if(app.eventListeners.length > 2){
    app.removeEventListener(“afterSave”, myHandler);
    app.removeEventListener(“afterSaveAs”, myHandler);
    }
    }catch(e){
    $.writeln(e);
    }

    if(app.activeDocument.textVariables.item(“SlugArea”).isValid){
    fileNameVariable = app.activeDocument.name.match(/[A-Z]{2,10}(?=)/)[0];
    // alert(fileNameVariable);
    app.activeDocument.textVariables.item(“SlugArea”).variableOptions.contents = fileNameVariable;
    }
    else{
    //…
    };
    }

    app.eventListeners.add(“afterSave”, myHandler);
    app.eventListeners.add(“afterSaveAs”, myHandler);

    I am going to keep testing but it seems to be working.

    On line 7 “if(app.eventListeners.length > 2){“:

    In your script you had it set as “> 0”. When that was the case the script only worked on the first page that was opened, so I changed to “> 2” and it works continuously.

    Thanks again Oleh! Do you have a donation page or something?

    in reply to: Script to import partial filename #92526
    Omar Khatib
    Member

    One more issue I can’t figure out. I added an if statement to account for document that don’t have the “SlugArea” text variable. the new script looks like this:

    #target indesign;
    #targetengine “mysession”;

    var myHandler = function(ev)
    {
    if(app.activeDocument.textVariables.item (“SlugArea”).isValid)
    {
    fileNameVariable = app.activeDocument.name.match(/[A-Z]{2,5}(?=)/)[0];
    // alert(fileNameVariable);
    app.activeDocument.textVariables.item (“SlugArea”).variableOptions.contents = fileNameVariable;
    }
    }

    app.eventListeners.add(“beforeSave”, myHandler);
    app.eventListeners.add(“beforeSaveAs”, myHandler);

    When this runs the first time on a fresh new template I get an error message…

    null is not an object
    Do you want to disable this event handler?
    Check Box Don’t Show Again No Yes

    When you choose “No” this script continues and works but it makes me feel like something bad is happening that I am not aware of.

    What could be causing this error? Is it hurting anything? Is there a way to make it go away without checking that box?

    in reply to: Script to import partial filename #92490
    Omar Khatib
    Member

    The new tidier script with Oleh’s input:

    #target indesign;
    #targetengine “myCustomGetFileNameHandler”;

    var myHandler = function(ev)
    {
    fileNameVariable = app.activeDocument.name.match(/[A-Z]{2,5}(?=)/)[0];
    // alert(fileNameVariable);
    app.activeDocument.textVariables.item (“SlugArea”).variableOptions.contents = fileNameVariable;
    }

    app.eventListeners.add(“beforeSave”, myHandler);

    Love the help, thanks again Oleh! I can’t say I am ready to create my own scripts but this helps a lot in learning how to manipulate them.

    in reply to: Script to import partial filename #92485
    Omar Khatib
    Member

    Oleh, your awesome! Thanks!

    in reply to: Script to import partial filename #92460
    Omar Khatib
    Member

    I found some local help! This is the script that is working for my situation:

    #target indesign;
    #targetengine “myCustomGetFileNameHandler”;

    var myHandler = function(ev)
    {
    fileNameVariable = app.activeDocument.name.split(“_”)[1];
    // alert(fileNameVariable);
    fileNameVariable1 = fileNameVariable.split(” “)[0];
    app.activeDocument.textVariables.item (“SlugArea”).variableOptions.contents = fileNameVariable1;
    }

    app.eventListeners.add(“beforeSave”, myHandler);

    I wish I could spend more time learning how to script.

    in reply to: Script to import partial filename #92449
    Omar Khatib
    Member

    Okay I guess I need to try it again.

    I am trying the same thing but the filename is structured like this: page#_CatCode NotSoRandomNameVersion#.indd (i.e. 203_DS CouldBeAnything04.indd)

    I want to capture the “CatCode” which could be 2-5 uppercase characters located after the first underscore and before the first space.

    In the script above…

    “fileNameVariable = app.activeDocument.name.split(“_”)[0]; // get XXXXX from XXXXX_Name1_Name2_Name3.indd file name
    alert(fileNameVariable); // show XXXXX”

    The split(“_”) splits the name with the underscore but how does it know to show the first instance? Can I split the name with and underscore and a space?

    Can I do a grep find in Javascript?

    Thank you in advance for the help!

    in reply to: Script to import partial filename #92446
    Omar Khatib
    Member

    Is this working? I posted earlier and my post hasn’t showed up?

    in reply to: Placing Multipage PDF Pages Into Contact Sheet #59206
    Omar Khatib
    Member

    Bridge in CS2 (I think it was CS2) had a InDesign script for Contact sheets, that was missing in the next release. I opened it is an editor and changed any reference to CS2 to CS3 and it worked fine.

    If that doesn't work for you just make a template in InDesign with Boxes were you want them to be and just “place” the pages into the box. In place options you can choose the whole document an as you click on each of your boxes the pages will just flow in in order.

    Hope this makes sense to someone, its the end of the day :)

    in reply to: Plugins for Automating Catalog Production #59198
    Omar Khatib
    Member

    If you ever want to take the next step…

    I have been using Content Management Systems for the past 14 years. The system/Company I am most familiar with is Pindar Agility. Over the years I have seen other systems and they will all work, well almost all, but the one that stands out to me is Wave B.media:

    https://www.wavecorp.com/products/bmedia/

    Non of these companies actually show you much on their websites, so you do have to make a call.

    If you call Wave, tell Charlie Omar sent you :)

Viewing 10 posts - 1 through 10 (of 10 total)