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

InDesign 2017 Script Documentation

$
0
0

Hi there,

 

I'm a developer working on InDesign scripts for a client using InDesign for publishing. There are InDesign script reference documents available here InDesign developer documentation | Adobe Developer Connection  but these appear to only be up to date as far as CS6.

 

Does Adobe have an updated documentation set for developers? I'm having issues with using methods in my JSX scripts, particularly the PageItem#place method which I have been successfully using up until the latest release to place an ICML file into a document. In CC2017 this simply puts the text "undefined" into the PageItem instead. Is there a new method for placing ICML in CC 2017 and/or is there any documentation surrounding this change?

 

Regards,

James


Placing snippets CC 2015 Mac

$
0
0

Hi,

 

I am placing snippets into my text by finding some text and then using place. The snippet is being placed, but the place is returning a zero length array.

var placedStuff = found[0].insertionPoints[-1].place ( idmsFile );

alert ( placedStuff.constructor.name ); // Array

alert ( placedStuff.length ); // 0

 

I have seen other threads where similar code is used.

https://forums.adobe.com/message/1999195#1999195

 

Any insight would be greatly appreciated.

 

Thanks.

 

P.

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

Error with Javascript file that was working perfectly

$
0
0

I have been using a script to export all text from a document and haven't had any issues with it.

Then today I went to use it and I'm am having this message pop up.

 

JavaScript Error!

 

Error Number: 48

Error String: Cannot find the folder "/Volumes/Private/var/folders/d1/7nsrmmm94kb872qbgvv5tl9c0000gn/T/TemporaryItems/tempText File.txt".

 

Engine: main

File: /Applications/Adobe InDesign CC 2017/Scripts/Scripts Panel/Samples/JavaScript/ExportAllText CS3.jsx

Line: 55

Source: myStory.exportfile(ExportFormat.taggedText,myTempFile);

 

Here is the script I have been using.

Any suggestions?

 

if(app.documents.length != 0){

  if(app.documents.item(0).stories.length != 0){

  myGetFileName(app.documents.item(0).name);

  }

}

//========================= FUNCTIONS ===========================

function myGetFileName(myDocumentName){

  var myFilePath = File.saveDialog("Save Exported File As:");

  if(myFilePath != null){

  myDisplayDialog(myDocumentName, myFilePath);

  }

}

//---------------------------------------------------------------------------------------- ----------------------

function myDisplayDialog(myDocumentName, myFilePath){

  //Need to get export format, story separator.

  var myExportFormats = ["Text Only", "Tagged Text", "RTF"];

  var myDialog = app.dialogs.add({name:"ExportAllStories"});

  with(myDialog.dialogColumns.add()){

  with(dialogRows.add()){

  with(dialogColumns.add()){

  var myExportFormatDropdown = dropdowns.add({stringList:myExportFormats, selectedIndex:0});

  }

  }

  with(dialogRows.add()){

  var myAddSeparatorCheckbox = checkboxControls.add({staticLabel:"Add separator line", checkedState:true});

  }

  }

  var myResult = myDialog.show();

  if(myResult == true){

  var myExportFormat = myExportFormats[myExportFormatDropdown.selectedIndex];

  var myAddSeparator = myAddSeparatorCheckbox.checkedState;

  myDialog.destroy();

  myExportAllText(myDocumentName, myFilePath, myExportFormat, myAddSeparator);

  }

  else{

  myDialog.destroy();

  }

}

//---------------------------------------------------------------------------------------- ----------------------

function myExportAllText(myDocumentName, myFilePath, myExportFormat, myAddSeparator){

  var myPage, myStory;

  var myExportedStories = [];

  var myTempFolder = Folder.temp;

  var myTempFile = File(myTempFolder + "/tempTextFile.txt");

  var myNewDocument = app.documents.add();

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

  var myTextFrame = myNewDocument.pages.item(0).textFrames.add({geometricBounds:myGetBounds(myNewDocument, myNewDocument.pages.item(0))});

  var myNewStory = myTextFrame.parentStory;

  for (var i = 0; i < myDocument.pages.length; i++) {

  myPage = myDocument.pages.item(i);

  for (var t = 0; t < myPage.textFrames.length; t++){

  myStory = myPage.textFrames[t].parentStory;

  if (!IsInArray(myStory.id, myExportedStories)) {

  //Export the story as tagged text.

  myStory.exportFile(ExportFormat.taggedText, myTempFile);

  myExportedStories.push(myStory.id);

  //Import (place) the file at the end of the temporary story.

  myNewStory.insertionPoints.item(-1).place(myTempFile);

  //If the imported text did not end with a return, enter a return

  //to keep the stories from running together.

  if(i != myDocument.stories.length -1){

  if(myNewStory.characters.item(-1).contents != "\r"){

  myNewStory.insertionPoints.item(-1).contents = "\r";

  }

  if(myAddSeparator == true){

  myNewStory.insertionPoints.item(-1).contents = "----------------------------------------\r";

  }

  }

  } // if not exported

  } // for text frames

  } // for pages

  switch(myExportFormat){

  case "Text Only":

  myFormat = ExportFormat.textType;

  myExtension = ".txt"

  break;

  case "RTF":

  myFormat = ExportFormat.RTF;

  myExtension = ".rtf"

  break;

  case "Tagged Text":

  myFormat = ExportFormat.taggedText;

  myExtension = ".txt"

  break;

  }

  myNewStory.exportFile(myFormat, File(myFilePath));

  myNewDocument.close(SaveOptions.no);

  myTempFile.remove();

}

//---------------------------------------------------------------------------------------- ----------------------

function myGetBounds(myDocument, myPage){

  var myPageWidth = myDocument.documentPreferences.pageWidth;

  var myPageHeight = myDocument.documentPreferences.pageHeight

  if(myPage.side == PageSideOptions.leftHand){

  var myX2 = myPage.marginPreferences.left;

  var myX1 = myPage.marginPreferences.right;

  }

  else{

  var myX1 = myPage.marginPreferences.left;

  var myX2 = myPage.marginPreferences.right;

  }

  var myY1 = myPage.marginPreferences.top;

  var myX2 = myPageWidth - myX2;

  var myY2 = myPageHeight - myPage.marginPreferences.bottom;

  return [myY1, myX1, myY2, myX2];

}

//---------------------------------------------------------------------------------------- ----------------------

function IsInArray(myString, myArray) {

  for (x in myArray) {

  if (myString == myArray[x]) {

  return true;

  }

  }

  return false;

}

//---------------------------------------------------------------------------------------- ----------------------

 

 

[EDIT – moved to In Design Scripting – moderator]

In Indesign erstellte Bankformulare in JAVA EE beim Kunden importieren?

$
0
0

Ich bereite gerade ein Kundenprojekt vor. Wir entwickeln ein Konzept für neue Bankformulare. Die würden wir üblicherweise in Indesign CS6 erstellen, Texte, Schreibfelder usw..

Jetzt fragt der Kunde, ob er diese Dateien in seine JAVA EE Umgebung importieren kann.

 

Beste Grüße

Peter

 

[Here is the list of all Adobe forums... https://forums.adobe.com/welcome]

[Moved from generic Cloud/Setup forum to specific Program forum... Mod]

InDesign K4(vjoon) Plug-in DOM

$
0
0

Hello js Expert,

 

Where I can find find Indesign External Plugin DOM?

 

Like K4(vjoon) Plug-in DOM or In-Math (Movemen) Plug-in DOM.

 

 

 

Kind Regards,

Sumit

is there a document "SaveAs" function using JS

$
0
0

hi there,

 

understand that Save is different from SaveAs function but i could not find the "SaveAs" function using javascripingt.

There's a Save and saveACopy function but not saveAs.

Is saveACopy equivalent to SaveAs? what's the difference between the two?

 

 

Thank you.

Cheers

How do you use JS to open a Folder dialog

$
0
0

If you use this to open a dialog box to select a file:

     File.openDialog("Select your XML File", "*.xml")

 

The how do you open a dialog to select a folder.  I would think it would be something like

     Folder.openDialog

 

but alas, it is not, and I cannot find any reference on how to do it anywhere.  Does any one know?

 

Thanks


Override elements by script problems

$
0
0

I need to override elements by script and have them end up at the same place they were in master. Now it overrides and puts them to the new page but it changes their position. Here is my function:

 

function loadPagesAndOverrideElements(document, csvData) {

    // add pages defined in CSV and correct layout

    for (var i=0; csvData.numberOfRows>i; i++) {

        var masterSpread = document.masterSpreads.itemByName(csvData["master"][i]);

 

 

        document.pages.add();

        document.pages[i+1].appliedMaster = masterSpread;

        var allItems = document.pages[i+1].appliedMaster.pageItems.everyItem().getElements();

 

 

        for(var j=0;j<allItems.length;j++){

            try {

                allItems[j].override(document.pages[i+1]);

            } catch(e) {

                // alert(e);

            }

        }

    }

 

 

    document.pages[0].remove();

 

 

    return document;

}

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!

Best examples of efficiencies achieved with ID scripts?

$
0
0

Whilst I've dabbled a bit with scripting and understand the general principles, I'm yet to find a compelling reason to really jump in to the ID scripting world. Lots of you seem to be thoroughly converted, so tell me briefly what your big wins with scripting have been. Maybe I'm not working on the right sort of ID projects, but I'd love to be inspired to investigate scripting properly.

 

Please note, I'm not asking anyone to post their actual scripts, just a quick story about the kick-@ss solutions you've worked out.

How do you select a layer by name using Javascript?

$
0
0

How do you select a layer by name using Javascript?

 

You can do this in Applescript using this code:

setactive layerofactive windowtolayer "Layout" ofmyDocument

 

I can't figure out the correct syntax in Javascript.

 

Anyone know how to do this?

 

Any information would be greatly appreciated,

adobeJavaScripter

pasteRemembersLayers not working as expected in IDS 2017

$
0
0

Hello All,

 

I am trying to copy a group of pageitems from my source file onto a newly created file using in IDS2017, in my source file the page items are placed on multiple layers however i don't want that layer info to be preserved when i copy over the group to the new document and hence use pasteRemembersLayers as false but still it does not work and the new document has a new layer created with the name of the layer on which the group was placed on the source document. The code is use is somewhat as under

 

var source = new File(PATH_TO_SOURCE)

var sourceDoc = app.open(source)

app.clipboardPreferences.pasteRemembersLayers = false

var newDoc = app.documents.add();

newDoc.documentPreferences.pagesPerDocument = 1;

 

var fileToSave = new File(PATH_TO_DESTINATION);

//Create a group of the page items on the 1st page of source and copy it over to destination file

sourceDoc.groups.add(sourceDoc.pages[0].pageItems).duplicate(newDoc.pages[0])

newDoc.save(fileToSave);

newDoc.close();

 

Is this a bug or am i doing something wrong?

 

Thanks for your inputs

-Manan

[Applescript][Indesign] Advanced input dialog windows ?

$
0
0

Hi,

 

Just a small question.

 

Is it possible to create/use advanced dialog windows using Applescript, just like when using Javascript ?

What is the best solution for asking users multiple input paramaters in an Applescript, execution from within Indesign?

 

Thank you

Create a build script for Extend Script

$
0
0

I have several scripts I want exported as binary via "File > Export as Binary" in ExtendScript Toolkit. I want to be able to call ESTK via shell script and tell it to compile that certain file.


Export SVG in Indesign CS5?

$
0
0

hi,

 

i know that adobe canceled svg support for indesign at cs3. but it's really important that i find a way to export svg by scripting. has someone a tip? plugins for this are no solution.

 

thanks in advance!

Suggestions for changing tab with underline leader

$
0
0

I frequently create forms where I'll use a tab with the underline for the leader, e.g., Name_________________  Age___________, etc.

I like the line to be thinner than the text, say the text is 10pt I'll change the line to 8pt. I can do a Find/Change to change the Tab character to a smaller size, but that changes every tab whether it has a leader or not. I can't find a way to "Find every tab with a leader that's the underline and reduce the point size".

 

Any suggestions appreciated.

 

Geoff

Rename and relink images - Indesign CS4 - OSX10.5

$
0
0
Hi all

I am looking for a script which will relink images that have changed part of their file name. OR a script which will rename AND relink if this is easier. At the moment I am using Automator to batch rename.

For instance, I have the following files:
20283 GN6E451.tif
20283 56529823.eps
20283 571589.eps

I want to change them so they are:
21483 GN6E451.tif
21483 56529823.eps
21483 571589.eps

So only the first part of the file names change (this is a job number). And then be able to tell InDesign that these are the same files. Is there a script available to do this?

Many thanks in advance!

Cannot handle the request because a modal dialog or alert is active

$
0
0

hi all

i try to use indesign product sdk CS5 using com object to open and edit document with asp.net

this error appear to me in this part of my code

 

            InDesign.Application indApp = (InDesign.Application)Activator.CreateInstance(InDType, true);

        

           indApp.ScriptPreferences.UserInteractionLevel = idUserInteractionLevels.idNeverInteract;

        

            InDesign.Document objDoc = (InDesign.Document)indApp.Open(cstrInddFile, true, idOpenOptions.idDefault);

 

 

 

Cannot handle the request because a modal dialog or alert is active.\\\   at System.RuntimeType.ForwardCallToInvokeMember(String memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData& msgData) at InDesign.ScriptPreference.set_UserInteractionLevel(idUserInteractionL evels ) at _Default.Button1_Click(Object sender, EventArgs e)

 

thanks advance

Face or shape detection?

$
0
0

I work with a magazine that prints mug shots of criminals. I get the mug shots of the people's faces, and I have tons of them to put on my layout. They are all different sizes, and right now I have to go through by hand and resize each one to fit it inside the image frame so that that face fills up the frame and is not cut off. Is there any type of script that could somehow detect the face or shape of the people and automatically size them to fit within the image box? If not, does anyone know an easier way for me to do this? It takes forever because I have hundreds to do.

 

Thanks!

Viewing all 15932 articles
Browse latest View live


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