Quantcast
Channel: Adobe Community : Popular Discussions - InDesign Scripting
Viewing all 15932 articles
Browse latest View live

Action Recorder for InDesign

$
0
0

Rorohiko just released beta version of Action Recorder— an extension panel which allows recording and replaying repetitive actions and saving recordings as scripts.

However it doesn't work for me in InDesign CS6 for Windows for some reason: nothing happens when I click controls and, unlike it's shown in the demo movie, the default set and action are missing in the panel.

I'd like to know if it works for other people and in other versions of InDesign (both Mac and Windows).


Extracting single pages out of InDesign documents

$
0
0

Is it possible to extract or export single pages from an InDesign document?

So far I've done it this way: I remove all the other pages, save to a new document and reopen the original document.

Here's my script https://gist.github.com/2964807

 

But obviously this is more of an hack. And the problem is that it's very obvious to the user, as the document is closed and re-opened. Is there a cleaner way of doing it?

 

Thanks in advance for your help.

A script to make pies (and more)

$
0
0

As a sort of dare from our friendly neighbours in the Illustrator forum, I wrote this script that might be useful for InDesign users as well.

 

It creates a pie chart by asking for the series of values, and then slicing up a circle that you must have selected. Fun thing is, it doesn't "just" work with circles; you can select about anything, enter your values at the prompt (comma separated), and get the correct result! (Which depends on the shape; of course it's only mathematically correct when using a circle.)

 

make-me-a-pie.PNG

 

 

//DESCRIPTION:Make me a pie// A Jongware script, 25-mar-2012 if (app.selection.length == 1){  val = prompt ("Values: ", "1,2,3");  if (val != null{    values = val.split(",");    total = 0;    for (i=0; i<values.length; i++)    {      values[i] = Number(values[i]);      total += values[i];    }    for (i=0; i<values.length; i++)    {      values[i] = values[i]*2*Math.PI/total;    }      circleCenter = [ (app.selection[0].geometricBounds[3]+app.selection[0].geometricBounds[1])/2,      (app.selection[0].geometricBounds[2]+app.selection[0].geometricBounds[0])/2 ];    circleRadius = Math.max ( (app.selection[0].geometricBounds[3]-app.selection[0].geometricBounds[1])/2,      (app.selection[0].geometricBounds[2]-app.selection[0].geometricBounds[0])/2);      startangle = 0;    for (i=0; i<values.length; i++)    {      endangle = startangle + values[i];      // warning: math! (though this is SIMPLE compared to what I've bin doing today)      segstart = [ circleCenter[0]+ 2*circleRadius*Math.sin(startangle), circleCenter[1]- 2*circleRadius*Math.cos(startangle) ];      segend = [ circleCenter[0]+ 2*circleRadius*Math.sin(endangle), circleCenter[1]- 2*circleRadius*Math.cos(endangle) ];      cutoff = app.activeDocument.graphicLines.add();      // create surrounding border      path = [ circleCenter, segstart ];      for (j=startangle; j<endangle; j += (values[i]/16))        path = path.concat ([[ circleCenter[0]+2*circleRadius*Math.sin(j),circleCenter[1]-2*circleRadius*Math.cos(j)]] );      path = path.concat ([segend]);      cutoff.paths[0].entirePath = path;      cutoff.paths[0].pathType = PathType.CLOSED_PATH;      cutoff.intersectPath(app.selection[0].duplicate()).fillTint = (i+1)*100/values.length;      startangle = endangle;    }  }}

ID CC SUI - Insane Daft Crazy Cuckoo Stupid Useless Idiotic

$
0
0

Ok. I must admit the title might be a bit on the negative side but there's a reason for that.

 

In the 20 minutes or so that I have tried out some of SUI stuff on ID CC these are some of the problems I have come across.

There a a bunch more that I can't be bothered to type out just now.

 

1) The stacking order on Windows has changed to be the same as the Mac's -

myImage = ...... (geometricBound[x,x,x,x])

myStatic = ........(geo.. same as above)

The static overlays the image - great, except for the masses of script that are going to get messed up by that.

Like the day they will change from Left to Right Lane driving in England, nice idea but there's going to be a heck of a lot of funerals.

Have to check is Mac then ...  is Window then is version ..... I guess in another 25 years time thing will sort themselves out.

 

2) Horizontal Scrollbar gone, kaput, zap, pow disappeared of the face of the screen.

 

3) Vertical scrollbar, looks like the words in this threads titles.

 

4) See my beautiful scrollable panel function (don't forget to fix up the windows bug first) and see how rubbish it scrolls on CC - on CS6 and 5 looked great.

 

5) The unenabled icon button show's as the enabled one and some combination of both of them show when unenabled, it is really both fascinating and scary to think just how much time adobe must of spent testing things out

 

6) Image positions jump (a pixel) sometimes on clicking a radio button and sizes of panels have shrunk by just enough to make thinks look a mess.

 

7) Treeview, cut down like grass, see http://forums.adobe.com/thread/1235394?tstart=0 for other problems that Marc wrote there.

 

8) I set an editText graphic background color to null, on cs6 worked fine on "the new  more stable 64bit" indesign CC crashed within .001 of a second.

 

Well a least it did something quick.

 

I thought that I would wait some time before downloading indesign CC but when I saw the post on the treeview I decided to take a look.

 

Please add to the list.

 

P.s. Hi Peter, congrats on your new release of your excellent Grep book, good luck on your new release of the SUI guide (It's going to be a lot of work!!!)

ESTK string bug [CS5, CS5.5]

$
0
0

Hi all,

 

Consider this JavaScript:

 

var s = String.fromCharCode(65, 66, 67, 68, 69); 
$.writeln("string len=" + s.length);for (var i=0; i < s.length; i++) {  $.writeln("#" + i + " = " + s.charCodeAt(i));}

 

When run, this produces this output in the JavaScript console:

string len=5
#0 = 65
#1 = 66
#2 = 67
#3 = 68
#4 = 69

 

However, if I change one of the character codes to zero, so for example:

 

var s = String.fromCharCode(65, 66, 0, 68, 69)

 

Then the script runs once. After running, ESTK is locked up. I can mouse around and select menus, etc., but the menus don't do anything. Everything is frozen and I have to either quit or sometimes force-quit ESTK.

 

This happens to me on Windows 7 with ESTK 3.5.1.59 (CS5) and on Mac 10.6.6 with ESTK 3.6.0.2 (CS5.5).

 

I get the fact that odd things might happen to a string containing a null byte, but I would expect in the worst case to have the string output terminate prematurely, not have the whole IDE hang.

 

Is this something that's been noticed before (sorry if it has, forum searching is a big wonky these days)? Is there anything I can do about it?

 

Thanks in advance for suggestions.

 

-Chuck

Release all anchored objects at once

$
0
0

Dear All, I want to release an all anchored objects from my file. All anchors are created inside the table. I am using InDesign CS4.

 

I have a file for 4 pages which is containing more than 150 images to be released from anchored. That images should be placed in the same place. Only need to release. I want to do this for more than 100 files (400 pgs. it may increase in future). I tried this in Search/replace option using Object, but only i can able to find using custom option in the anchor options panel, not able to relase using search and replace.

 

Please help me ASAP.

 

Thanks in Advance, Thiru

Character/Paragraph Style Hilight colors

$
0
0

In May 2010 Marc Autret posted this interesting blog: Show Local Formatting in InDesign CS4/CS5, where he shows how an undocumented feature of InDesign can be put to good use. If you set TextPreference.enableStylePreviewMode to true, ID suddenly shows red lines marking local character and paragraph style overrides.  A very neat find, one that I use all the time to check my documents for (uh) "neatness".

 

I just ran across this obscure scripting preference whilst looking for something entirely unrelated -- but something in the description caught my eye.

 

enableStylePreviewModeboolr/wIf true, highlights character and paragraph styles with colored backgrounds.

 

Regular lurkers might remember the puzzling "previewColor" properties in Paragraph and Character Style. Now that's what this is for!

 

This script will add background colors to a paragraph style and a character style, and then show them in your document. No need to worry about your document, despite the name they only appear in Normal view. In Preview mode they disappear, and they will not print or export to PDF.

 

app.activeDocument.textPreferences.enableStylePreviewMode = true;
app.activeDocument.paragraphStyles.item("Body Text").previewColor = UIColors.YELLOW;
app.activeDocument.characterStyles.item("Italics").previewColor = UIColors.CYAN;

 

Upside or downside is this comes with those override red line markings for free. Oh well. Perhaps it's a preference in CS6 -- and I wouldn't mind if the preview color could be set in the style options either, for now it needs a script.

 

Screen Shot 2012-02-05 at 5.35.21 AM.png

Font Converter .ps to .otf

$
0
0

Hi ALL,

 

Any font converter or any solution from postscript fonts(.ps)  to open type fonts(.otf).

 

 

Font i want to convert is "SassoCPMPri"

 

 

Can anyone give solution for this.

 

 

Regards

BEGINNER


JS/ScriptUI: placeholder madness

$
0
0

I created this yummy text box entry placeholder for CS4 on my Mac:

 

Screen Shot 2012-02-17 at 9.28.09 PM.png

 

but for some reason this fails to draw correctly on Windows! If the edit box is active and the cursor is in it, the text is not drawn but the cursor blinks at correct position at the end of that invisible text. Moving the cursor or typing in something makes the text pop back into view. (Sorry, should have thought of making a 'shot of that as well.) A real shame, because on my Mac it works as I meant it to: placeholder text shows when the field is inactive and empty, placeholder disappears when you enter the field and type anything in it. Delete text and leave box makes it appear again.

 

Is this an error in my code (silently corrected on the Mac but showing up on 'the other platform'), or is it an error on the Windows' Side of the world? Or is this just something one should not be messing with using ScriptUI? (A fairly reasonable explanation.) Or might it work correctly on CS5 for both platforms? (In which case I could put in a platform/version check -- "no fancy dialog for you, you Older Version on a Microsoft Platform!").

 

I also have a variant of same code that would underline static text, which also shows up correctly on Mac and not-at-all on Windows -- but then it may be failing for the very same reason.

 

My code:

 

var w = new Window ("dialog", "Display Placeholder");
w.bg = w.graphics.newBrush(w.graphics.BrushType.SOLID_COLOR,[1,1,1]);
w.textPen = w.graphics.newPen(w.graphics.PenType.SOLID_COLOR,[0.67,0.67,0.67], 1);
with(w.add ("group")){  add ("statictext", undefined, "Text");  editbox = add ("edittext", undefined, '');  editbox.characters = 32;  editbox.onDraw = function(d)  {    if( this.text || this.active)      this.parent.onDraw(d)    else    {      this.graphics.rectPath (0,0,this.size.width,this.size.height);      this.graphics.fillPath(w.bg);      this.graphics.drawString("<required>",w.textPen,0,0,this.graphics.font);    }  };}

ANN: automatic dialog after background export (exportPop.jsx)

$
0
0

A week or two ago, I wrote a script to pop up a dialog box after any background export, in response to the InDesign CS5 PDF export status thread. It doesn't seem like there's been feedback. I suspect it's sort of gotten lost in the noise in the general forum. So here we go again!

 

Don't make me post it to InDesign Secrets!

 

This script will automatically pop up a dialog box after every export finishes (PDF, IDML, whatever). It also makes sure that the Background Tasks window is turned on.

 

You can download the script from here, or just paste in what follows and save as exportPop.jsx. See How to Install InDesign Scripts for installation instructions. If you save it in the Startup Scripts folder, it will run automatically when InDesign is started. Running it a second time disables it, if for some reason it causes problems.

 

// exportPop.jsx -- pops up Background Tasks when you start an export//   and a modal dialog when an export finishes.// Beta version. Please post feedback at//   http://forums.adobe.com/thread/830572// John Hawkinson, 17 March 2011// Save in STARTUP SCRIPTS folder to start automatically. 
#targetengine session 
(function() {    var        old1 = app.eventListeners.itemByName("exportPop1"),        old2 = app.eventListeners.itemByName("exportPop2");            if (old1.isValid || old2.isValid) {        if (old1.isValid) { old1.remove(); }        if (old2.isValid) { old2.remove(); }        alert("Export pop up window removed.\n"+            "Indesign will behave as normal.");        return;    }        app.addEventListener("beforeExport", function() {        var            tasksPanel = app.panels.itemByName("Background Tasks");        if (tasksPanel) { tasksPanel.visible=true; }    }).name = "exportPop1";        app.addEventListener("afterExport", function(ev1) {        var task, listener;                    task = app.idleTasks.add({ name: "exportPop", sleep: 1000});        listener = task.addEventListener(IdleEvent.ON_IDLE,            function(ev2) {                listener.remove();                task.remove();                alert(ev1.format+" export complete of "                    +ev1.fullName+" at "+ev1.timeStamp);            });    }).name = "exportPop2";     alert("Export pop up window installed\n"+        "Background Tasks will appear the start of an export\n"+        "and a dialog will appear after each export complete.");}()); 

How do I set additional Preflight options...

$
0
0

Hi Folks,

 

I'm attempting to write an AppleScript to create a Preflight profile in InDesign CS5.

 

I've worked out how to create the profile, give it a name, and set some of the properties using code similar to this shown below:

 

tellapplication "Adobe InDesign CS5"

          setprofileNameto "TEST PROFILE"

          setprofileDescriptionto "This text describes what the profile does..."

          setnewProfiletomakenewpreflight profilewith properties {name:profileName}

          setdescriptionofnewProfiletoprofileDescription

          tellnewProfile 

                    setTrnspBlendOptionstomakepreflight rule instancewith properties {id:"ADBE_TransparencyBlending"}

                    setflagofTrnspBlendOptionstoreturn as error

          endtell

endtell

 

This code above will configure the settings as shown in the screenshot below:

Preflight_ScreenShot.png

 

My question is...

 

How do I access and set additional properties?

In this instance how do I set the colorspace to be RGB ?

 

Cheers, Rob.

Read Excel File and Report

$
0
0

Hi All,

 

I need to match the paragraphs styles with Indesign files and Excel File.

 

Excel file consists of   standard paragraph styles file naming (around 500 Paragraph Styles)

 

Indesign files having 100 Paragraphs Styles.

 

My Request:

 

I need to generate report if any Indesign paragraph styles that are not in Excel file.

 

i.e.,

 

Excel file               Indesign file

h1                             H1

h2                              h2

h3                              BL

tx                              tx1

tx1

tx2

 

Create Report like:

Error Paragraph style is  H1 and BL in Indesign file

 

Created script:

 

 

var myDoc = app.activeDocument; 
var myPstyles = app.activeDocument.allParagraphStyles; 
alert("myPstyles: " + myPstyles.length) for(i=0; i<myPstyles.length; i++){     var IndesignPStyles = myPstyles[i].name;    alert(myPstyles[i].name)    }//_____________________________________________________________ //Help Here 
var myFile = File.openDialog("Choose a tab delimitted txt file:");if (!myFile){
exit();}     
myFile.open('r');while (myFile.eof==false){     line=myFile.readln();     line = line.split("\t");     myFind = line[0];}  

 

Could anyone help for this request.

 

Thanks in advance

Beginner_X

Auto-flow of images?

$
0
0

Is there a script that will autoamtically place the images that I select on my pages without me having to place one image on each page?

How can I get a total page count of a PDF before placing every page in the PDF?

$
0
0
Before the [long] spiel, I'm using javascript in InDesign CS3.

I'd like to create a script that places a multiPage PDF in any number of different impositions. (saddle stitch, 4up signatures, 16up signatures etc.)

I've easily created a script that iterates through a PDF and places it into a new document as (4,1|2,3), (8,5|6,7) etc, which works for printing in duplex, folding each page in half, and gluing the resulting spines to make a simple thick book (for PDFs with more than, say, 64 pages).

However, the next step is to re-write the script to create a saddle stitch document (16,1|2,15), (14,3|4,13) ... (10,7|8,9). For this I need to know how many pages there are in the PDF before I start placing the PDF pages, and then making the new document [int((PDFpages+3)/4)] pages long.

Is there a simple way to get the count of PDFpages without going through a loop and placing the next page from the PDF until the placed page number equals the first page number?

This way seems wasteful:

var totPDFPages = 1;
app.pdfPlacePreferences.pageNumber = totPDFPages;
myPDFPage = sheetFront.place(File(srcPDF), [0,0])[0];
var pdfFirstPage = myPDFPage.pdfAttributes.pageNumber;
while (doneCounting == false) {
totPDFPages += 1;app.pdfPlacePreferences.pageNumber = totPDFPages;
myPDFPage = sheetFront.place(File(srcPDF), [0,0])[0];
if (myPDFPage.pdfAttributes.pageNumber == pdfFirstPage) {
totPDFPages -=1;
doneCounting = true;
alert("PDF has " + totPDFPages + " pages!");exit();
};
myPDFPage.remove();
};

NB. Javascript above *hasn't* been run, but should look similar once debugged.

The only thing I've though of to relieve the sheer duplication of placing the PDF twice (once for the count, and once for the imposition), is to create an array of impoPages[counter]=myPDFPage, and then shuffle the pages referenced by the array to the correct sheet and position.

It'd be much easier to be able to assign pageCount = File(srcPDF).pageCount !!!

Thanks for any help/tips or even a simple "What are you smoking, man!?"

Cheers,
Jezz

Exporting Multiple PDFs From A Single INDD Document

$
0
0

Hello All-

 

I am trying to write a script that will create 3 pdf documents (high res, high res with crops and bleeds, and lo res web).

 

I have a script that works for exporting pdfs with presets:

 

     var myDoc = app.activeDocument;

     var myPDFExportPreset = app.pdfExportPresets.item("[Press Quality]");

     myDoc.exportFile(ExportFormat.pdfType, File(Folder.desktop + "/ExportPDFWithPreset.pdf"),false, myPDFExportPreset);

 

The issue I am having at the moment is with the filename. I would like the exported pdfs to have the same name as the indd document, but with different suffixes (HR, HRwCrops, LR).

 

 

I would greatly appreciate any help.

 

 

 

thanks.

 

Hank


What is the best way create an interactive and portable study guide?

$
0
0

I am creating an interactive study guide and I'm wondering which Adobe product would be the best product to use for this project. The main functionality that I'd like to incorporate is clickable buttons. I'd like the reader to be able to click on a button that will then display a label for a picture and/or make the label disapper.

Open With

$
0
0

I am saving a txt file and I want it to open (execute) in excel after the script creates it.

 

I probably can't do it in JS and need to do a little doScript in VB and AS

 

Can anyone show me how to do this.

 

Something like

 

function openWith (myFile, myProgram)      {             if ($.os.match(/Mac/i)) app.doScript ("appleOpenWith (" + myFile + ", " +  myProgram + ")", ScriptLanguage.APPLESCRIPT_LANGUAGE);             else app.doScript ("windowsOpenWith (" + myFile + ", " +  myProgram + ")", ScriptLanguage.VISUALBASIC);    }  
function appleOpenWith (myFile, myProgram)     {          \\ SOME APPLE SCRIPT HERE. WHAT????     } 
function windowsOpenWith(myFile, myProgram)     {          \\ SOME VB HERE. WHAT????     }

 

 

Thanks

 

Trevor

[JS] Write XML file

$
0
0
Hello

 


IreadanXMLfileI ycontributionofthechangeandIwant to writeitinanewXMLfile.


Iwouldgetthispresentation

Capture d’écran 2013-10-28 à 18.56.32.png

butI optcesi

Capture d’écran 2013-10-28 à 18.56.47.png


Here ismycode :

 

 

 

    leDossierOEBPS = "~/Desktop/content/";

 

    monEcritureContent(File (leDossierOEBPS + '/content.opf'),File (leDossierOEBPS + '/content5.opf'));

 

function monEcritureContent(refFile,refFile2) {

   default xml namespace = 'http://www.idpf.org/2007/opf';

 

    var XMLHeader = '<\?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>';

    var XMLWorkbookHeader = "<\?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>";

    var XMLWorkbookHeader2 = " xmlns=\"http\://www.idpf.org/2007/opf\" unique-identifier=\"bookid\" version=\"2.0\"";

  

           if(refFile != null) {

                        refFile.open("r");

                        var XMLToParse = refFile.read();

                        refFile.close();

                    

                        XMLToParse = XMLToParse.replace(XMLWorkbookHeader,"");

                        XMLToParse = XMLToParse.replace(XMLWorkbookHeader2,"");

                       

                   

                        var XMLData2 = new XML(XMLToParse);

                        XMLToParse = null;

            } else {

                    alert("Error opening XML file.");

            }

 

refFile2.open("w");

refFile2.encoding = "UTF8";

refFile2.writeln (XMLHeader+XMLData2.toXMLString());

refFile2.close();

 

}//


Whatisthecorrectcontroltowritethe XMLtree?

 

Thank you

Can I use Adobe in my own website

$
0
0

Hi all,

 

Since a few months I'm working on a project to create a javascript framework based on extended tool kit.

My goal is to provide a lot of usables class to work with InDesign, Photoshop, Bridge ...

 

I know that a framework called "Extendable" already exist. But I contacted the author and He doesn't keep this framework up to date.

But my idea is quite diffrente becouse I will create new class to use indesign and photoshop togheter...

 

My question:

Can I use this name in my website: JLFA (Javascript Library For Adobe)

Or it's not allowed?

 

In advance, thanks for your reply.

 

Have a nice day.

cleaning up text frames

$
0
0

hello all you smart guys.

 

I get a big complex files from another designers every month for further processing. Among other not-so-good habits, they usually do not use layers.

To make layout a bit more organized, I move text to its own layer - simple task, have script for it. But it does the job straightforward - exactly 'as advertised' (Jongware's expression - I like it so )

 

Unfortunately, those designers didn't bother much with 'frame content' option. They can draw a frame with a text tool, fill it with color and use it as a background for some artwork or whatever...

my script 'text frames to separate layer' creates a mess on such pages, and locate it - not always is an easy task. Document usually has over 200 pages...

 

So, I'm dreaming about some magic script, which is able to "prepare" text for moving, I mean, to find and process:

 

case1: empty text frame with no fill/outline - remove (delete)

case2: empty text frame with any fill/outline - convert to 'unassigned'

case3: text frame with the same color applied to text and the frame itself (yes, it happens!) - well, maybe just 'select and stop'? I'm afraid it's too complicated to remove text from such a frame and then treat the frame as 'case2'?

 

any suggestions would be greatly appreciated...

Viewing all 15932 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>