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

Delete Unused Paragraph Styles

$
0
0
Hi All,

I realize this one is probably pretty easy, but it has given me some grief these last few minutes. I'm trying to delete all unused paragraph styles in a document in InDesign CS. Here's the latest on what I have:

tell application "InDesign CS" to delete every unused paragraph style of document 1

I can't even get it to compile that. I've tried several variations, but all had the same result...it does not seem to like where I placed the word "unused", but I can't seem to figure out any other correct syntax.

Any help is greatly appreciated!

Execute a VBScript inside a JavaScript

$
0
0

Hi there

How are you doing?

 

I´ve found an excellent script from IndiSnip [InDesign® Snippets] | Adobe® InDesign® Scripting Snippets

It´s a VBScript that I would like to use inside a JavaScript.

When I use it as a VBS file, everything works good, but I am not successful when I write it in JavaScript using the
app.doScript('My VBSCript line', ScriptLanguage.visualBasic);

I did it in many ways, I could not complete the script in debug mode.

Anyone could help me?

 

Link of script:

Get network adapter Name/MAC/Speed | IndiSnip [InDesign® Snippets]

 

Thanks

 

strComputer = "."

 

 

SetobjWMIService = GetObject("winmgmts:\\"& strComputer & "\root\cimv2")

SetIPConfigSet = objWMIService.ExecQuery ("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = True")

 

SetobjWMI = GetObject("winmgmts:\\"& strComputer & "\root\WMI")

SetAdaptInfo = objWMI.InstancesOf("MSNdis_LinkSpeed WHERE Active = True",48)

 

ForEachadaptInfo in AdaptInfo

    AdaptNameLink = AdaptNameLink & adaptInfo.InstanceName & vbNewLine

    AdaptSpeed = AdaptSpeed & adaptInfo.NdisLinkSpeed & vbNewLine

Next

 

ForEachIPConfig in IPConfigSet

    IfNotIsNull(IPConfig.Description) Then

        AdaptName = AdaptName + IPConfig.Description & vbNewLine

    EndIf

    IfNotIsNull(IPConfig.MACAddress) Then

        MACadd = MACadd + IPConfig.MACAddress & vbNewLine

    EndIf

Next

 

app.scriptArgs.SetValue "myAdaptNameLink", AdaptNameLink

app.scriptArgs.SetValue "myAdaptSpeed", AdaptSpeed

app.scriptArgs.SetValue "myAdapt", AdaptName

app.scriptArgs.SetValue "myMAC", MACadd

Script to find Character Styles and delete content

$
0
0

I have no idea if this is possible, to make a script to find specific Character Styles and then delete found content.

 

For instance, I have pages and pages on separate documents that have pricing information (all in a specific character style) and I need to delete all pricing. Just looking for the most efficient way to achieve this.

 

Thanks for any advice.

Interactive form, selection of check boxes, only want option to click one

$
0
0

I have an interactive form set up in Indesign CS6 and have muliple check boxes, I have them set to only appear when clicked, however our client would like it so that when one is clicked it won't let you click the others, so bascially is there are 10 check boxes, only allow you to click 1.

 

Kind regards

Mark

Unmerge table cells scritp. Help

$
0
0

I need a script that would unmerge all cells whitin all of the tables found in active text frame. Aditionally it would resize collum widths and row heights to accomodate hidden text.

 

I have lots of badly put togehter tables from Word. Automation would help a lot.

 

Thx!

convert to shape

$
0
0

Hi scripters;

exam.jpg

 

I have a lot of objects. I need to change it as follows. (Provided that the contents remain the same;)

I would be glad if you can help

Replace .eps into .JPEG

$
0
0

Hi,

 

I need to replace all .eps files into .JPEG using script. i have tried the below script, it is not getting any output. Can anyone help this

 

Purpose:

 

While exporting InDesign into RTF, .eps are missed out, so i need to replace .eps into JPEG files.

File name for both JPEG and .eps are the same and available in the same path.

 

 

var myFilteredFiles = new Array;

var myFolder;

startDate = new Date();

 

 

 

 

var myGFolder = Folder.selectDialog("New path for the JPG Images")+"";

app.scriptPreferences.userInteractionLevel = UserInteractionLevels.NEVER_INTERACT;

    for (var myFileCounter = 0; myFileCounter < myFilteredFiles.length; myFileCounter++)

    {

        var myFile = myFilteredFiles[myFileCounter];

        var myDoc = app.open(myFile);

        myDoc.viewPreferences.horizontalMeasurementUnits = MeasurementUnits.points;

        myDoc.viewPreferences.verticalMeasurementUnits = MeasurementUnits.points;

        myDoc.viewPreferences.rulerOrigin = RulerOrigin.pageOrigin;

        myDoc.zeroPoint = [0, 0];

 

 

//function replaceJpgImages(myGFolder)

//{

var myDoc = app.documents[0];

var newSuffix="jpg";

//~ var myFolder = Folder.selectDialog("New path for the JPG Images")+"";

myLinks = myDoc.links;

for (oneLink=myLinks.length-1;oneLink>-1;oneLink--) {

myLink = myLinks[oneLink];

myString = myLink.name.split(".");

myName = myString[0] + ".jpg";

 

 

myNewLink = File(myGFolder + "/" + myName);

try{

myLink.relink(myNewLink);

myLink.update();

}

catch(e){}

}

 

 

   

    }

 

Regards,

Velu

document.search() is not a function

$
0
0

We recently upgraded from InDesign CS2 to InDesign CS6.

We have scripts that we ran on Windows InDesign CS2 that we are trying to get to run on a Mac InDesign CS6.

 

We are getting the following error when executing one of the scripts.

 

Screen Shot 2015-04-09 at 4.14.23 PM.png

 

 

I looked in the Object Model Viewer and did not find a method search() for Document.

 

Screen Shot 2015-04-09 at 4.06.16 PM.png

 

Since it looks like this worked before in CS2, I am wondering if anyone knows if this method was deprecated in CS6 and if there is another method that does the same work?

This is the code that gets executed.

Screen Shot 2015-04-09 at 4.06.27 PM.png

Any help in the right direction is appreciated.


find table bottom border with empty cells

$
0
0

Any one help me for the below condition.

 

Find table bottom border with empty cell

 

if(cell[j].contents == "" && cell[j].bottomEdgeStrokeType == "Thick - Thick" && cell[j].bottomEdgeStrokeType=="Solid")

 

 

Regards

 

Velu

Replace a letter using GREP without interfering in the GREP syntax

$
0
0

Hello!

 

Before the letter D, I try to insert a Column Break (in GREP is the character ^M) in my Index. But I can't because in GREP ^D means other thing and is not working the script.

Is important be sure don't damage other letters D

How can I add a column break before my single letter D ?

 

replaceText ("^D\r","^MD\r") 

function replaceText (input, output)  
{       app.findTextPreferences = app.changeTextPreferences = NothingEnum.nothing;       app.findTextPreferences.findWhat = input;       app.changeTextPreferences.changeTo = output;       app.activeDocument.changeText();       app.findTextPreferences = app.changeTextPreferences = NothingEnum.nothing;   
} 

 

My actual Index:

Screen Shot 2018-05-11 at 16.22.59.png

 

The result I expect:

Screen Shot 2018-05-11 at 16.23.27.png

 

 

Thanks so much in advance!

Script to extract column from a table and paste it as a text frame

$
0
0

Hi, everybody!
I wonder if there's a way —or maybe there's a script that already exist— to convert all columns from all tables in a document to individuals text frames with the same high and widh lenght that had as table columns and preserving the same paragraph style from each cell.

convert text to footnote

$
0
0

8.      de chercher plus de véritables [1] partenariats avec la société civile afin que les défenseurs des droits de l'homme se sentent pleinement [2] soutenus par l'UE;

 

[1]HRW:Central Asia : Five Years of EU engagement

[2]http://www.senat.fr/rap/r96-2013,1054/r96-374.html.

 

This is a little sample of xml-text we get from external sources. There's no link between the false "footnote-ref [1]" in de text and the false "endnote text".

Is there a possibility to convert those "notes" to real notes in de text, but not to end-notes? Sometimes these kind of notes extend to more than 100.

 

thnkx

While Loop with Array.pop() Gotcha

$
0
0

Just a bit of a heads up:

 

A number of us have been using a while(obj=array.pop()){} construct for a while. (I believe Marc was the one to introduce this construct to this forum.)

 

While this is considerably more efficient than a standard for loop when you don't need the array when the loop ois done, there's a not-so-obvious gotcha:

 

0 in javascript is evaluated to false, so : while(0) is equivalent to while(false).

 

If you have an loop like this:

 

ar = [1,0,8,6];
while(a=ar.pop()){    // do your stuff    }

6 and 8 will resolve true, but 0 will not. The loop will exit when it hits 0, and neither 0 nor 1 will be processed.

 

This loop is no good either:

 

ar = [1,0,8,6];
while(a=ar.pop() != null){    //do your stuff    }

because "a" will evaluate to either true or false instead of the value of the array because statements are processed backwards (i.e. a = (ar.pop != null)).

 

Instead you need (note the extra parenthesis):

 

ar = [1,0,8,6];
while((a=ar.pop()) != null){    //do your stuff    }

 

HTH,

Harbs

script for running multiple find/change queries

$
0
0

Working on a large ID book document (*.indb), I have saved several dozens of Find/Change Queries (named "col01", "col02" etc.) that I run on "All documents". For a particular reason I have to run these queries several times a day.

 

So I was wondering whether there is, or whether anybody out there would write, a script that runs these queries one after the other. Given the size of the book, it might be necessary to provide for the script to pause after each query is run (before it goes on with the next), but I am just guessing.

 

Any help is much appreciated!

Defining page range for PDF export

$
0
0

Hello,

I am trying to automate a PDF export process, where a single indesign file has to be exported as multiple PDFs into a specifically named folder structure. I have placed the information that the script needs on a non-printing layer on the first page of each PDF (The filename for the PDF and the foldername to put it in). My script successfully stores this information, along with the page number on which it was found.

 

The problem is that the indesign documents are divided into several sections and alternate layouts; when my script loops through the pages to harvest the information it stores the pages by their position in a zero-based array, not by their actual page numbers. It seems that it is the actual page numbers that are needed to define the page range for export. As the page numbers are repeated across the alternate layouts, I'm guessing would need to specify I section and a page number.

 

I can get the number of the page with pages[i].name, but how do I get the section number and put these two together in my page range definition?

 

BTW, all the PDFs are continuous page ranges, although sometimes they bridge section breaks.

 

Many thanks for any help.


Sort algorithm: how can I sort two arrays according to one

$
0
0

I have two parallel arrays, similar to this:

 

var array1 = [4, 3, 1, 5, 2];

var array2 = ["four", "three", "one", "five", "two"];

 

I want to sort the first array, and have the second array follow the same sort as the first. Any advice for a good algorithm would be appreciated.

 

Rick Quatro

Folder.getFiles Multiple Filters Mask

$
0
0

Hi all,

 

Folder.getFiles (".*") ... in this case it will get all types of files

 

Folder.getFiles (".jpg") ... in this case it will get all files with .jpg extension

 

... but how can I filter to get (for example) all files with ".jpg", " .tif" or ".eps" extension ?

 

ESTK help says: A mask string can also be the name of a function that takes a File or Folder object as its argument. It is called for each file or folder found in the search; if it returns true, the object is added to the return array.

 

Any idea of how to make such a function?

 

I will appreciate any help.

Auto data merge all csv files in folder

$
0
0

Hello,

 

I have a folder with 10 csv files and an Indesign template file.

 

I need to:

 

1. open Indesign template file

2. get all csv files in folder to indesign

3. merge and record all csv

4. save indesign files with the cvs names

 

Is that possible to do?

 

Thank you Guys!

With CS3, some things have changed

$
0
0
Let's use this topic to record changes that are likely to affect a working script. As I did in the CS2 comparable topic, I'll add an index here in the topic title when the list is long enough (and I have the time).

Excel data merge to Indesign

$
0
0

Hi, I have an excel spreadsheet with a column of dimensions, height and width.   What I would like to do is import this list into Indesign and run a script creating frames/ boxes.   In addition to merging this list and creating boxes, I would hope to have these boxes align in a linear pattern each meeting up with the other flush.

 

Thanks in advance,

 

excel to Indesign.jpg

Viewing all 15932 articles
Browse latest View live


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