Back

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

Forum Replies Created

Viewing 15 posts - 16 through 30 (of 41 total)
  • Author
    Posts
  • in reply to: Script to import partial filename #92453
    Oleh Melnyk
    Member

    – how does it know to show the first instance?
    fileNameVariable = app.activeDocument.name.split(“_”)[0] // < [0] means “first instance”

    – Can I split the name with and underscore and a space?
    sure, you can write any pattern to split: .split(” _”) or .split(“_ “) or whatever fits your needs

    – Can I do a grep find in Javascript?
    almost! you can do a regexp, which is simplified version of grep

    – I want to capture the “CatCode” which could be 2-5 uppercase characters located after the first underscore and before the first space.
    try this:
    “page#_ABCDE NotSoRandomNameVersion#.indd”.match(/[A-Z]{2,5}(?=)/)[0] // should return “ABCDE”

    in reply to: JavaScript for InDesign #76286
    Oleh Melnyk
    Member

    You don’t need to learn Java, as it’s related to Javascript same as Car to Carpet

    1) What you really need to learn is ECMA-262 version 3 – this is what Adobe ExtendScript currently use + custom Adobe BOM/DOM for InDesign, Illustrator, Photoshop, etc.
    2) Also check Node.js as since CC2014 Node.js is built-in, and you can do a lot of cool things with that
    3) Then google for Adobe CEP

    PS: Bucky rules, watched his tuts on node.js few days ago, but that’s not enough, they’re just brief intro…
    Old (2013) tutorial @ lynda for node.js also sucks.. There is also new, 2015 tutorial- haven’t yet check this one

    in reply to: Sorting within paragraph Delimited with Comma #76040
    Oleh Melnyk
    Member
    in reply to: Sorting within paragraph Delimited with Comma #76043
    Oleh Melnyk
    Member

    David, as far as I know, BlatnerTools is not opensource, as well as Ajar scripts and many others… my scripts doesn’t do anything bad, but sometimes I’m just too lazy to make code readable and understandable

    this script is nothing special o hide, but let it be as it, at least for now

    ————
    updated script https://goo.gl/Hk3MEA

    in reply to: Sorting within paragraph Delimited with Comma #76022
    Oleh Melnyk
    Member
    in reply to: Foot numbers ranges script #75011
    Oleh Melnyk
    Member
    in reply to: Script to import partial filename #71793
    Oleh Melnyk
    Member

    @Jongware why not? firstly it’s always a chance not to get the answer to question you asked.. the only thing is that it’s a good idea to cross-reference those questions and update them all if someone in one of those forums has found the full or partial solution

    in reply to: Script to import partial filename #71696
    Oleh Melnyk
    Member

    I don’t understand what you want to do exactly, but try this:

    1) go to Type > Text Variables > Define
    2) create new varialbe, and give it name “myVariable”, and type – “Custom Text”
    3) paste this variable to your document
    4) create .jsx file, and copy/past there this code:

    #target indesign;
    #targetengine "myCustomGetFileNameHandler";
    
    myHandler = function(ev)
    {
        fileNameVariable = app.activeDocument.name.split("_")[0]; // get XXXXX from XXXXX_Name1_Name2_Name3.indd file name
        alert(fileNameVariable); // show XXXXX
        app.activeDocument.textVariables.item ("myVariable").variableOptions.contents = fileNameVariable;
        // ...do what you need here...
    }
    
    app.activeDocument.addEventListener("beforeSave", myHandler);
    

    5) save this .jsx script file, and run it before saving your document – it should get XXXXX part from document name and set it as your text variable value
    6) if you want this script to load automatically – you can put it to “startup scripts” folder

    in reply to: a little help with GREP? #71619
    Oleh Melnyk
    Member

    no, I don’t need medals, lol
    I just have found this script useful, and I want to include it to my other script, that will be more complex and do multiple [clever] find/change fixes, that’s why I’m searching for bugs and keep fixing them

    in reply to: a little help with GREP? #71558
    Oleh Melnyk
    Member

    actually I have discovered a serious bug in previous version: if there is more than one string with ranges – script replace second and all other digit-strings with first formatted result, which is not good.. so I made another update:

    https://www.dropbox.com/s/f6ctvw1kl5povi9/Detect%20digit%20range.jsx?dl=0

    in this version:
    – script work correctly with more than one digit-string per document
    – it can now work with selection only, if nothing selected – it will process whole document
    – it use progress bar instead of alerts
    … and other small fixes

    Oleh Melnyk
    Member

    @David seems like your website is not working, while I’m opening https://blatnertools.com/?nr=0 it says that “This domain registration expired on 10/23/2014”, and on https://www.dtptools.com/product.asp?id=blid there is no version for CC – can you check it one more time and let us know where we can find latest blatnertools for CC?

    Oleh Melnyk
    Member

    @Chris – Is there any different way to define the “rules” in which some words must be red?

    you can create character style with red text color.. then in paragraph style, in GREP section apply those character style you just created, and for grep rule write:
    YOUR_DESIRED_WORD|or phrase that need to be in red

    in reply to: Script to override master page items #71473
    Oleh Melnyk
    Member

    @swan pado – I don’t know why, but your script overrides only 2 of 4 master page items on the page.. and what even worse – overriden elements get shifting – before override elements had position of X: 65.225mm Y: 269.4mm and after override elements was shifted to X: 59.325mm Y: 278.2mm

    in reply to: Object Style to New Layer #71461
    Oleh Melnyk
    Member

    if you still need it – try this script https://www.dropbox.com/s/lrank3o5r5lykph/Move%20TextFrame%20to%20Layer.jsx?dl=0 – it should work

    I probably need to start posting my scripts in github))

    in reply to: a little help with GREP? #71455
    Oleh Melnyk
    Member

    haha)) I just added another “if” to check if ranges are already set, so script will not screw up now after multiple execution.. you may remove alert if they bother you)))

    upd: https://www.dropbox.com/s/llzn9d6iq8ikiyo/Detect%20digit%20range%202.jsx?dl=0

Viewing 15 posts - 16 through 30 (of 41 total)