Quantcast
Channel: Adobe Community : All Content - InDesign Scripting
Viewing all 8771 articles
Browse latest View live

Mail Merge script to replace any blank fields with specific text

$
0
0

In InDesign Mail Merge I would like to replace any blank fields with specific text. For example if we have four fields (A, B, C & D) to merge, and field A is blank, it would insert field C.

 

In essence leaving no blank fields but replacing a blank field with another specific field.

 

I have read that inDesign does have Mail Merge limitations but if there is a script that we could run that would solve our problem.

 

Please let me know if you can help?


[JS][CC] Detecting if an image has Multiply effect applied

$
0
0

Hi.

 

I need to find a way to identify if a selected item has an effect (Multiply) attached.

Can anyone please help with the correct properties to dig into?

 

Many Thanks

 

Roy

Place X asset on each Page JS

$
0
0

Hi,

 

I'm working with assets from library and a xml. My goal is to read an XML file and count number of element.
Then get nb element and place 6 assets by page.

 

 

Before trying do it with xml value, I try to do it with Fixed Value.

 

var myDoc = app.activeDocument;

var myPages = myDoc.pages;

var libraryFilePath=new File("/Users/Mitchum/Desktop/catalogue2015/ressources/Library.indl");

app.open(File(libraryFilePath));

myAsset = app.libraries[0].assets.item("test"); // name of the asset

for (var pg =1; myPages.length>pg; pg++)

{

    var myDoc = app.activeDocument;

    var myPages = myDoc.pages;

    if (myPages[pg].side==PageSideOptions.RIGHT_HAND){//Page de droite

         if (pg ==0){//check right firstpage

            var myObj = myAsset.placeAsset(app.documents.item(0))[0];; //first place library in first page

            myObj.move (myPages[pg]);

            myObj.move ( [12, 15] );//change ur x.y coodinate as per ur requirement

            }

        else{

            var myObj = myAsset.placeAsset(app.documents.item(0))[0];; //first place library in first page

            myObj.move (myPages[pg]);

            myObj.move ( [210, 30] )

            }

    }

    if(myPages[pg].side==PageSideOptions.LEFT_HAND){

            var myObj = myAsset.placeAsset(app.documents.item(0))[0]; //first place library in first page

             }

    }

}

 

 

With some search on this forum I got this to place One asset by page.
But I'm pretty lost to know how to "repeat" the process.
I try to do a loop like

 

for (var i = 0;i<7;i++){

                   alert(i);   

                    //premier element

                    if(i==0){

                         var myObj = myAsset.placeAsset(app.documents.item(i))[0]; //first place library in first page

                        myObj.move (myPages[pg]);

                        myObj.move ( [10, 30] );//change ur x.y coodinate as per ur requirement

                    }

 

                     else if(i==1){

                         var myObj = myAsset.placeAsset(app.documents.item(i))[0]; //first place library in first page

                        myObj.move (myPages[pg]);

                        myObj.move ( [103, 30] );//change ur x.y coodinate as per ur requirement

                    }

                    else if(i==2){

                        var myObj = myAsset.placeAsset(app.documents.item(i))[0]; //first place library in first page

                        myObj.move (myPages[pg]);

                        myObj.move ( [10, 110] );//change ur x.y coodinate as per ur requirement

                    }

                     else if(i==3){

                         var myObj = myAsset.placeAsset(app.documents.item(i))[0]; //first place library in first page

                        myObj.move (myPages[pg]);

                        myObj.move ( [103, 110] );//change ur x.y coodinate as per ur requirement

                    }

                      else if(i==4){

                         var myObj = myAsset.placeAsset(app.documents.item(i))[0]; //first place library in first page

                        myObj.move (myPages[pg]);

                        myObj.move ( [10, 190] );//change ur x.y coodinate as per ur requirement

                    }

                      else if(i==5){

                         var myObj = myAsset.placeAsset(app.documents.item(i))[0]; //first place library in first page

                        myObj.move (myPages[pg]);

                        myObj.move ( [103, 190] );//change ur x.y coodinate as per ur requirement

                    }

 

 

             }

 

 

 

But it's working for 3 element but fail on the 4th with an error like "30477 error, incorrect value for parameter "on" of methode "placeasset" Document or Text waiting but nothing get (I translate error message cause I'm on FR indesign)

 

By the way, I think there is a better way to do this like all my elseif no ?

 

Thanks for your Help !

Getting page items in correct Z-order

$
0
0

We have a rather complex Indesign plugin that I want to port to Javascript for increased maintainability. Unfortunately the SDK is pretty different from the Scripting API in many ways. One thing that has me stumped is this:

 

spread->GetItemsOnPage(pageIndex, &itemsOnPage);
Arranger::SortItemsBackToFront(&itemsOnPage);

 

... and then I can loop through the page items in the correct order. How do I do the equivalent with the Scripting API?

Self-propagating ampersands in GREP in a paragragh style

$
0
0

Hello. I'm using GREPs in (InDesign CS6) paragraph styles to color specific words and have hit an odd thing when the words I'm trying to color include an ampersand (&).

 

The style works fine the first time, but if I call up the paragraph style, additional ampersands start appearing in the GREP expression, not just for the expression I'm changing, but other expressions that include an ampersand as well.

 

Example: I enter  ^(?i)track \& field

 

The next time I edit a grep in this style, the grep changes to ^(?i)track \&& field. Then ^(?i)track \&&& field.

 

So I take out the extra &'s, only to see them come back again. And having a space or not having spaces on either side of the ampersand doesn't

affect the problem. I've tried using \s instead of the space, but it makes not difference. I've also tried dumping my InDesign preferences and exporting the document as an .idml file in an effort to clear out any funkiness.

ampersand1.jpgampersand2.jpg

Has anyone seen this? Thanks!

 

Kelly

String match

$
0
0

Hi,

 

 

  I need to match 2 contents. Contents having special characters. I have replaced the special characters with "\" but the match result returning "null". 

 

  Im using the below code.  Wats wrong in my code.

 

 

var str1 = "communication privacy management (CPM) theory";

var str2 = "(CPM)"

str2 = replaceStr(str2);

alert(str1.match(/str2/gi))

 

 

function replaceStr(fndCont)

{

    var newWord = "";

    for(var cCnt = 0; cCnt < fndCont.length; cCnt++)

    {

        var cChar = fndCont[cCnt];

       

          if(cChar.match(/[^0-9a-zA-Z]/))             

        {

            cChar = "\\"+cChar;

        }

        newWord +=cChar;

    }

           

    return newWord;

}

 

Thanks in advance,

Sudha K

Hundreds of images... need a script for pan & zoom

$
0
0

Has anyone come up with a way to do a mass pan & zoom for all of the images in the document? I have over 300 and it's slightly tedeious to sit here and do a manual pan & zoom on all of them.

How to remove set of item values of array from another array in Javascript

$
0
0

var myFind_collections =[3,6,10,234,235,236,237,238,239,240,241,244,245,246,247,248,248,249,250];
var pgRangeCollection =[234,235,236,237,238,239,240,241,244,245,246,247,248,248,249,250];

for(v=0;v<=pgRangeCollection.length;v++){
   
var pgMatch = pgRangeCollection[v];
    clear_pg_range
(pgMatch);
   
}

function clear_pg_range(pgMatch){
       
//for(d=0;d<=myFind_collections.length-1;d++){
       
for(d=0;d<=myFind_collections.length-1;d++){
           
var docFound = parseInt(myFind_collections[d]);
           
if(pgMatch===docFound){
                    myFind_collections
.splice(myFind_collections[d],1);
                    alert
(docFound +" was removed");
               
}
           
}
   
}

alert
(myFind_collections.length);

 

in above code i want to remove every item in myFind_collections which equals to pgRangeCollection

i want the output as (3,6,10) but i am getting the output as (248,249,250)

i dont know where i mistaking can anybody suggest solution for this,

Thanks in advance


box element object style can place top or bottom

$
0
0

Hi All,

 

I have a problem while i am placing the different objects, i have script for calling images, tables etc.., But it was placed on floting method, I need to place either top or Bottom.

 

Any one can suggest

 

Hurix

Textvariable page size?

$
0
0

Hello,

I was wondering if there is a way to define a variable in ID CS 6, that displays the actual pagesize?

(I have one document with a lot of different pages and sizes.)

 

Any help is highly appreciated. Maybe a script will work?

 

Thx a lot

Ronald

InDesign CC: ScriptUI TreeView broken

$
0
0

Some troublesome news regarding the treeview in InDesign CC, ver. 9.0 (updated today through ).

 

Using the treeview in "InDesign Creative Cloud" trees can no longer be built dynamically, since there are no plus signs for expanding, until children are added (and then it's too late).

 

The onDoubleClick event also seems to be removed from the TreeView.

 

Regarding building the tree dynamically, by loadning new nodes when clicking "+":

In CS6 and before, the Node object always had a plus sign. If you clicked it, you could have an onExpand event hooked up, that added child nodes "on the run".

If the node was not to be expanded ever (no plus sign) you added an "item" instead of a "node".

 

In InDesign CC however, nodes without children are always shown without plus signs, making it impossible to load the children dynamically, since there is no way for the user to trigger an onExpand event. The nodes appear just as the items did in CS6. Here is a screen shot of a treeview, the same code running in CS6 (left) and InDesign Creative Cloud (right):

 

CS6-vs-CC-same-code-window.png

 

 

As you can see, the plus (or rather "turnable triangular things" in the dark and cool new super UI of CC) are missing in CC.

 

Here is the code (which also demonstrates that the onDoubleClick event no longer works, double click a node text in CS6, and the message "Doubleclick will appear", in CC no message appears when double clicking a node):

 

#targetengine 'testengine1'
var Window1 = new Window('palette','My window');
buildWindow();
Window1.show(); 
var nodeDoubleClickHandler = function(){    alert('Doubleclick')}
var nodeExpandHandler = function(item){        alert(item.text);} 
function buildWindow(){        Window1.Treeview1 = Window1.add('treeview',undefined,undefined);    Window1.Treeview1.onExpand = nodeExpandHandler;    Window1.Treeview1.onExpand = nodeDoubleClickHandler;     Window1.Treeview1.Node1 = Window1.Treeview1.add('node',"Node 1 (node)");    Window1.Treeview1.Node2 = Window1.Treeview1.add('node',"Node 2 (node)");    Window1.Treeview1.Node3 = Window1.Treeview1.add('item',"Node 3 (item)"); }

How to delete empty tags after xml-import

$
0
0

Hello collegues,

I'm totally new in this forum so excuse me if I make a mistake, but I've a little question.

I've imported text and images with a xml-import but sometimes empty tags (the colored invisible blocks) are in my text, with the result that I can't Find/Change on double-returns.

Does anybody know an awnser to this matter? I would love to write an apple-script that will find/change this so i don't have to look after all my pages.

Thank you very much in advance.

 

Schermafbeelding.jpg

How to run a script op Indesign startup?

$
0
0

Hi,

 

I have a script that runs fine when manually running it in inDesign CC.

 

Now i need that script to run automatically when a file is opend in InDesign.

 

I put the script in "stratup scripts" folder. But get the error that there is no active document. The script runs before the document is opened.

 

on: http://forums.adobe.com/message/4005956 sommthing is mentioned but i just can't get it to run!

Do i need to install the APID toolkit (only has a plugin for CS4 and lower) or APID toolassistent? And when i do? what then?

 

 

I'm not an IT guy.

 

Can anyone help?

 

Tnx

[AS][CS6]Paste into from one document to another

$
0
0

Hello,

 

I have a group in a first InDesign document and I want to paste it into a frame in another document. Exactlylike a Copy/ Paste Into.

I tried this, but that doesn't work:

 

tell application "Adobe InDesign CS6"

set MyDocument1 to document 1

set MyDocument2 to document 2

 

tell MyDocument1

  set MyGroup to (item 1 of all page items whose label is "group_1")

end tell

 

tell MyDocument2

  set MyFrame to (item 1 of all page items whose label is "frame_1")

end tell

 

set MyFrame to MyGroup -- doesn't work!

 

end tell

Detecting Overset from inside another textframe:Javascript

$
0
0

I had written an applescript that will find overset text boxes, and tried and fix them (if the text box expanded to far into another it wouldn't fix it). now I'm trying to do it in Javascript. I was able to write some code that works on a normal text box. however there are some text boxes, that are in another box (bordered 1pt). The script doesn't seem to see those.

 

I'm guessing because its a text frame in another (bordered frame). If this is the case Im not sure how to tell the script to look into a text frame, for another tet frame that overset.

 

Applescript nevermade that distinction if it was over set it fixed it.

 

Can anybody help


File Open dialog with filter

$
0
0

Hi,

 

   When I am invoking the following command in Adobe Indesign JavaScript in Windows OS, the filter option does not work.

 

var myFile=File.openDialog("Choose the file","*.jsx",false);

 

I need to limit the types of files displayed in the dialog. "*.jsx" filter expression does not work in the dialog. It displays all types of files in the dialog.

 

Please suggest the solution to the above problem.

Automate Multiple Resizing of Boxes

$
0
0

We create planogram documents for shelf displays.

 

The documents include shelf illustrations and then multiple 2D product images that are different sizes.

 

We already use the Indesign Data merge feature to merge the necessary data for this process.

 

However, we would really like to be able to automate the sizing of the product image containers to the size data in our spreadsheet/csv.

 

So when we merge a list of product data it not only inserts the picture but scales the box to the height and width we need.

 

Is this possible?

 

If so is there anyone out there that can script this for us?

 

Many thanks.

Kris Harris.

Getting Selections from each Tab of a Script UI Tabbed Panel

$
0
0

I am in the process of creating a script to import fields from any tab delimited file. Mainly for directories but at times we have other items. The number and names of fields are always changing so it has to be flexible. The user first selects the file, then selects the field names, and orders the field names. That all works. The next step is for the user to then select the formatting to go between each field. Which is where I run into a problem.

 

The below is created from the array of the ordered field names, as you can see the creation of the box works fine. The tab names are the names of the field and they show up in the right order. However, no matter what I select on the other tabs my value is always defaulting to whatever the last selection (in this case the selection on the Streetname tab). What is really weird is I am getting the correct name of the tab but not the correct formatting for that tab- no matter what I've tried I get only the formatting for the last tab. I have gone through multiple rounds and numerous searches and can't seem to figure out what is wrong. Any help would be appreciated.

Screen Shot 2014-02-27 at 11.39.25 AM.png

 

//|||||||||||||||||||||||||||||||||||||||||||| function formatFields(finalList) ||||||||||||||||||||||||||||||||||||||||||||

//From the selected headers arrange in the order they should be imported

function formatFields(finalList){

    //set formatting variables for preview window

    var Pvw_space = "\u00A0"; //unicode space character for preview window

    var Pvw_tab = "\u00A0\u00A0\u00A0\u00A0\u00A0\u00A0\u00A0\u00A0\u00A0\u00A0\u00A0"; //unicode space characters simulating tab for preview window

    var Pvw_flb = "\n"; //forced line break for preview

    var Pvw_comma = "," + Pvw_space;

    var Pvw_string = "";

    var selForm=[];

  

    //create and populate tabbed window

    var FF_win = new Window ("dialog", "Select formatting for each field", undefined, {closeButton: false});

    FF_win.alignChildren = "right";

    var tpanel = FF_win.add ("tabbedpanel");

    tpanel.alignChildren = ["fill", "fill"];

    tpanel.preferredSize = [350,300];

   

    //create one tab for each field

    for (i = 0; i < finalList.length; i++) {

        var tabName = finalList[i].toString();

        var general = tpanel.add ("tab", undefined, tabName,{name:tabName});

        general.alignChildren = "fill";

 

 

        var g_options = general.add ("panel", undefined, "Please select the formatting to follow this field");

        g_options.alignChildren = "left";

        g_options.tab = g_options.add ("radiobutton", undefined, "Tab");

            g_options.tab.value = true;

        g_options.flb = g_options.add ("radiobutton", undefined, "Forced Line Break");  

        g_options.space = g_options.add ("radiobutton", undefined, "Space");           

        g_options.comma = g_options.add ("radiobutton", undefined, "Comma");

        }

   

   

 

 

    //Preview and Cancel buttons

    var Confrimgrp = FF_win.add("group");

    Confrimgrp.orientation="row";

    var Prev_button = Confrimgrp.add("button",undefined,"Preview",{name:"ok"});

    var Back_button = Confrimgrp.add("button",undefined,"Back",{name:"cancel"});    

    //determine sorting of list

    Prev_button.onClick = function() {

        for (i = 0; i < finalList.length; i++) {

            with (FF_win.findElement(finalList[i].toString())){

                if (g_options.tab.value == true){

                    alert (finalList[i].toString() + ": tab");

                    }

                if (g_options.flb.value == true){

                    alert (finalList[i].toString() + ": FLB");                

                    }

                if (g_options.space.value == true){

                    alert (finalList[i].toString() + ": space");                

                    }            

                if (g_options.comma.value == true){

                    alert (finalList[i].toString() + ": comma");                

                    }

                }

            }

        }

    Back_button.onClick = function(){$.destroy();}

  

    //show dialog

    FF_win.show();   

    }

 

        }

    Back_button.onClick = function(){$.destroy();}

  

    //show dialog

    FF_win.show();   

    }

can you use Socket to get data from HTTPS URLs?

why? indesign CS6 does not support " Adobe SING Glyphlet Manager"?

$
0
0

I creat the  Symbol with Ai CS3. I want to make the symbol  change to "font".

I only can find  Adobe SING Glyphlet Manager CS3,  I do it Step by step,I can find the font "ExtraGlyphlets",can get the Symbol that I need,

 

But,I need use the Sybol in the ID Cs6,I Can't find the "ExtraGlyphlets" font in CS6

 

banyuan.png

And,How  could I delete the green Area,for I donot need it?

Viewing all 8771 articles
Browse latest View live


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