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

Problem with save preflight report using javascript in macintosh

$
0
0

Hi Experts,

 

I need to generate preflight report from InDesign CS5. But I got a error in "ExportPreflightReport.jsx"

 

Here is my code:

 

    var myDocument = app.activeDocument;

    var myProfile = app.preflightProfiles.item("IMAGE_CHECK");

    var myProcess = app.preflightProcesses.add(myDocument, myProfile);

    myProcess.waitForProcess();

    var myResults = myProcess.processResults; 

    if (myResults != "None"){

          myProcess.saveReport(File(File($.fileName).path+"/myreport.pdf"));

   }

 

Please provide suggestion anything wrong in my code.

 

Thanks

Velladurai.G


scripted windows update to plug-in version possible?

$
0
0

adobe( flash player distribution ) on adobe website says i have scripted version of windows---they are two versions of windows--scripted and plug--in? it done the automated update but put 12.0.0.38 back on--says it not updated to recent version---12.0.0.43 after many replies and helpful answers i need to know can i get the plug-in so it can update to 12.0.0.43 to make it the updated version?  if you  go to  (flash player distribution)  will explain some things --type it the search box on adobe website@

Is it possible to srcipt something that reads text and make an appropriate image visible?

$
0
0

I have never written a script for indesign before so I am not really familiar with how it works

 

Eessentailly, I have a text box that a user would be writting a state in. I then want the script to take that as input, and then make a hidden image of that state visible.

 

Also, is it possible to have th script always running, or would the end user have to run it?

 

Thank you!

Script for randomly replacing characters with alternates for natural handdrawn look

$
0
0

I have been looking for a script for a comic book project. What I would like the script to do is to randomly find and change for example some of the "E"s to alternates in the font. Is that possible? Does anybody know if it exists? I’ve been looking quite hard - and no luck. Back in 2009 somebody was discussing something similar - but not quite what I am looking for.

 

Best regards from Denmark....

Loading masters from external file

$
0
0

Hi everyone! I have a question about loading master pages. To do this I use this simple function

 

function copyMasterPages(doc, path) {

    doc.loadMasters(File(path), GlobalClashResolutionStrategy.loadAllWithOverwrite);

}

 

Everything works fine and result document contains all master pages from a file defined by a path variable. But i have a small bug. Text frames in master pages of a result document have the same applied styles as in masters of a prototype document, but they also have additional params: language is set to Hebrew and paragraph direction is set to Right To Left. And (as far as i know) this params never appeared in prototype doc, so it seems to me they are ... default?

 

By the way I also load paragraph settings from the same prototype document before loading master pages:

 

function copyFontStyles(doc, path) {

    doc.importStyles(ImportFormat.textStylesFormat, File(path), GlobalClashResolutionStrategy.loadAllWithOverwrite);

}

 

 

If enyone know what can cause this bug, please help me:) Many thanks.

How to set stroke to overprint and apply swatch? (InDesign CC)

$
0
0

I have very limited knowledge of scripting but am trying to create a basic script that will aid our workflow in a fast-paced production environment. What I need the overall script to do in InDesign is:

 

1. Create a new layer at the top of the stack called "dieline"
2. On this layer, put a rectangle the same size as the document page size and center
3. Apply a spot colour swatch called "dieline" (C0 M100 Y0 K0) to the rectangle stroke and set stroke to overprint
4. Set stroke to 1pt, apply fill to none, align stroke to center

5. Apply this rectangle to all pages of the document

 

By piecing together other scripts I have found online, I was able to successfully run the script below BUT encounter 2 issues:
- If a document already has a swatch called "dieline" in the swatch palette, the script errors out. I just need the script to either apply the spot colour swatch "dieline" and if the document doesnt have one, then create it.
- I cannot figure out how to set the stroke to overprint!

 

I am hoping someone can help me out! Here is the code:

 

 

var myDoc = app.activeDocument;

 

// set page origin to 0,0

myDoc.viewPreferences.rulerOrigin = RulerOrigin.pageOrigin;

 

// get page dimensions

var myY2 = myDoc.documentPreferences.pageHeight;

var myX2 = myDoc.documentPreferences.pageWidth;

 

// define page count

var myPagesTotal = myDoc.pages.length;

 

// new layer to top of stack

var myNewLayer = myDoc.layers.add();

myNewLayer.move(LocationOptions.atBeginning, undefined);

myNewLayer.name = "dieline";

 

// add dieline swatch and set parameters

var spotDie = new Array(0, 100, 0, 0);

myDoc.colors.add({model:ColorModel.SPOT, space:ColorSpace.CMYK, colorValue:spotDie, name:"dieline"});

 

var i=0;

 

while ( i<myPagesTotal) { var mySpread = myDoc.pages.item(i);

var myBorder = mySpread.rectangles.add();

myBorder.geometricBounds = ["0p0", "0p0", myY2, myX2];

myBorder.strokeColor = "dieline";

myBorder.fillColor = "None";

myBorder.strokeWeight = "1pt";

myBorder.strokeAlignment = StrokeAlignment.centerAlignment;

 

i++;

}

 

 

 

MANY MANY THANKS!

(using Indesign CC)

Move URLs in Text to End of Story Or Link Text. Also: Tables

$
0
0

Hello everyone

 

I'm currently working on a script that translates Textile Markup into formatted InDesign-Text. This worked fine for the most part, seeing as it's not really hard to do by FindChangeByList. Some things are a bit trickier than other things, though. Namely URLs in the text. In Textile, all URLs are like so. Let's say I'd like to link to Google. So I'd type this: "Google":http://www.google.com This would produce Google. I can isolate the word and delete the URL by [\\\"](.+?)[\\\"]:\\?\\S+ and then replacing by $1. So far so good.

 

However!

 

It would be awesome, if the URLs were still in the text. So I'd either like to have it like so: Google or that the word Google (or any $1, really) stands in the text and then the link is added to the end of the text as a kind of "Sources"-paragraph-thing. How can this be done? Can I do it by FindChangeByList? Because that would be cool, seeing as then I'd only need to run one script.

 

And here's a general question: How can I translate Textile-Tables into Formatted InDesign-Tables?

 

For reference, this would be a table with one header row.

 

|_. name |_. age |_. sex |

| joan | 24 | f |

| archie | 29 | m |

| bella | 45 | f |

 

Can this be done?

 

Thank you very much for your help!

Can i manipulate objects, layed on particular layer [CS6-jsx]

$
0
0

I have 6 layers. Then i need to left objects from 2 particular layers where they are and move all others to one new layer. Can i say in script "move all objects on layer 1 to layer 3"?

string like this

L = mDoc.layers.add ({name: "General"});
mDoc.layers[0].everyItem().itemLayer = L;

doesn't work.


Master Pages & Pages have different size and/or origin

$
0
0

I am using an existing document to start a new one. The existing doc did not have master pages set up, but I would like to set them up (for page numbering, etc.) However, when I do, and then drag the Master down to the page, I get a warning that the Master Page and the Page have different sizes.

 

I can see, using the Page tool and Document Setup, that the pages are the same size.

 

The items seem to have shifted to the right, on the left-hand page, and to the right on the right-hand page.

 

See attached screen shots:

 

This is the master (items on page to show shifting)

Screen Shot 2014-01-22 at 2.10.54 PM.png

When I drag the master pages down to the pages, this is what happens:

Screen Shot 2014-01-22 at 2.11.06 PM.png

This is the error message I get when I try to place master page items on the page. I select, “Keep current page size.”

Screen Shot 2014-01-22 at 2.14.41 PM.png

 

When I say “Use master page size, it appears correctly:

 

Screen Shot 2014-01-22 at 2.19.40 PM.png

 

 

Both the master pages and the pages are this size:

 

Screen Shot 2014-01-22 at 2.15.38 PM.png

 

I’m not sure what is going on here.

upper to lower in selected text

$
0
0

//Change THIRD character to lower case

//Peter Kahrel wrote the original of this.

 

app.findGrepPreferences = app.changeGrepPreferences = null;

app.findGrepPreferences.appliedParagraphStyle = "List";

 

// Third letter in paragraph to lower case:

app.findGrepPreferences.findWhat = "^.{3}";

found = app.activeDocument.findGrep();

for (i = 0; i < found.length; i++)

  found[i].characters[2].changecase (ChangecaseMode.lowercase);

 

The script above (modified by Peter) works very well (ID CC), but could it be possible to make it work on a selected text instead of on paragraph level? because we cannot always change the paragraph style name (again due to exporting txt to other applications).

To be clear: Select text and run script for the selection.

Indesign CS5 - Separating pages faster (script)

$
0
0

Original Question:

 

"Is there a way I can separate a multi page indesign cs5 document into multiple indesign cs5 document files? (ie. a 12 page indesign file > 12 separate indesign files)

 

I'm having trouble finding a plug-in or function for this online. Anyone have any ideas?"

 

 

Someone responded with:

 

"I think there's probably already a script for this if you ask over in the scripting forum"

 

 

Can anyone help me with this?

Export pages using Image name?

$
0
0

I have a document.

 

It has 2 layers.

 

Top layer (Layer 2) is a repeating on each page and the image is on the master page.

 

Layer 1 has a different image on each page.

 

 

I want to export all the pages in the document to either JPEG (both Layer 1 and 2)

 

But I want it to automagically name each page export as the filename that is placed on Layer 1.

 

 

That possible?

Is there a way to find and replace prices in an Indesign document from a CSV file?

$
0
0

Is there a way to find and replace prices in an Indesign document from a CSV file. Currenty I have a catalog with codes and prices in tables. I need to find a way to look up the code (and new price) in the CSV file and overwrite the price in the current table with the new price. Does anyone know of a script to run this quickly?

Exporting data in tables to an Excel spreadsheet?

$
0
0

Is there a script or another way to export or save a documents tables (multiple tables over several pages) to an excel spreadsheet? I have found a solution which involves exporting each spread as a html file which i can then open straight in excel but this is still quite long winded and i can only seem to do this a spread at a time. As the job I am working on involves many pages this is taking too long. Surely there must be a script which can automate this in some way. I am fairly new to scripting so any help will be grateful. I have searched in scripting but nothing has really come close to what i am trying to achieve. Indesign CS5.5 user.

xslt sample for entities to keyboard character

$
0
0

We need the xslt sample for entities replacement text. For instance I have to convert the entities ‘&lpar;’  to keyboard character ‘(’.


How to do different times at different days in the week

$
0
0

Hi!

 

I need help with at small script-problem.

To avoid a lot of messy explainations within a snippet, I would like a script to solve the problem.

 

Monday to Thursdays there is an event at 16:30.

Fridays the event is at 13:30.

Saturday and sunday there's no event.

 

The text printed is "Today at [time]".

How do I solve this problem?

 

Logic should probably be:

If friday then friday

If saturday or sunday then weekend

Else then mondaytothursday

 

Can anyone help?

 

have a nice day

Maggern

 

PS: As a sidenote - does anyone have a good beginners guide for scripting?

Script for converting hyperlinks to buttons?

$
0
0

Hi!

 

Does anyone know if there´s a script for converting hyperlinks to buttons with Go To URL action with same URL that was used with hyperlink?

Footnote Reference No

$
0
0

Hello,

 

I'm actually working a script (js), which needs to list the position of all footnote reference number found in the document.  To be noted that a paragraph style has been applied on the whole text and the reference number is no more by default in superscript. In fact that's the goal of the script: to convert back the detected reference number to superscript. Does someone have an idea?

 

Thanking you in advance

Help needed - remove xmlimportmap

$
0
0

Hello all,

 

First time in the forum...

 

I have written a v. simple script as follows:

 

main()

function main(){

          var myDocument = app.documents.item(0);

          //Create a tag to style mapping.

          myDocument.xmlImportMaps.add(myDocument.xmlTags.item("unit"), myDocument.paragraphStyles.item("table_header_unit"));

          //Map the XML tags to the defined styles.

          myDocument.mapXMLTagsToStyles();

}

 

Now I'd like a script to remove the mapping preferences.

 

can anyone help or point me to relevant literature/documentation.

Thanks.

//Ot_Gu

Print Error?

$
0
0

I open a file, and I print, why the document will show have been modified?

And I try the other method, i open a file and export a file to pdf, the document will not show have been modified

question.jpg

Viewing all 8771 articles
Browse latest View live