Forum Replies Created
-
AuthorPosts
-
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”Oleh Melnyk
MemberYou 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 CEPPS: 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 oneOleh Melnyk
Memberhere is prompt version https://www.dropbox.com/s/087s2c87ade95lz/Sort%20selected%20text%20%28prompt%29.jsxbin?dl=0
Oleh Melnyk
MemberDavid, 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/Hk3MEAOleh Melnyk
MemberOleh Melnyk
MemberOleh 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
Oleh Melnyk
MemberI 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” folderOleh Melnyk
Memberno, 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 themOleh Melnyk
Memberactually 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 fixesNovember 6, 2014 at 10:37 am in reply to: Applying Overprint Attributes to both fill and stroke (when applicable) #71483Oleh 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?
November 6, 2014 at 7:25 am in reply to: I need to make a GREP, it must find a word which has two different colours #71474Oleh 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 redOleh 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
Oleh Melnyk
Memberif 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))
Oleh Melnyk
Memberhaha)) 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
-
AuthorPosts
