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

InDesign 7.0 breaks Visual Basic reference

$
0
0

I've previously posted this to the Indesign SDK & Scripting forums, but haven't gotten a reply.
I thought I'd try again, rephrasing it a bit.
When I installed Creative Suite 4, InDesign 6.0 installed a COM typelib for Visual Basic.
C:\ProgramData\Adobe\InDesign\Version 6.0\en_US\Scripting Support\6.0\Resources for Visual Basic.tlb

I am able to reference this from VB.NET Visual Studio 2010 and program against the InDesign scritping API like a charm - with full IntelliSense.

With Creative Suite 5 InDesign 7.0 I am unable to establish this reference from Visual Studio.
Visual Studio can't find the reference.

Any ideas?


javascript: select all text, break link to style

$
0
0

Hi

 

I'd like to select all text in a Document (in different independent textboxes) and then break the link to it's style (in the program in the Flyout-menu of the paragraph styles)

 

Is this function scriptable (javascript)?

How do I select all the text?

 

InDesign CS6, OS10.7.4

 

Thanks

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

ExtendScript Oddity with File/Folder on Mac OS X

$
0
0

Here's a really odd one, happens on Mac OS X Lion 10.7.3 with InDesign CS5.5.

 

Enter the following little InDesign Script in ExtendScript Toolkit, and run it targeting InDesign CS5.5:

 

// Create a path of the form /Users/kris/Desktop or something similar, then resolve the path back to a File object

var fn = File(File("~").fsName + "/Desktop");

alert(fn.fsName + " exists: " + fn.exists);

 

If all is well, you get a dialog saying something like "/Users/kris/Desktop exists: true".

 

Nothing weird yet. Leave ExtendScript Toolkit running for a sec.

 

Now start up a Terminal window, and go to the /Volumes folder. Create a subfolder called Users (so  that the folder /Volumes/Users exists on your computer).

 

Re-run the script.

 

Weirdness: I get "/Volumes/Users/kris/Desktop exists: false". Euh?

 

Anyone seen that before? Don't forget to remove "/Volumes/Users" again!

 

It is probably related to another weirdness. Run this one-liner:

 

alert(File("///").fsName);

 

You'll get "/Volumes" - but you'd expect to get "/", no?

Can my mac run a script every 15 minute?

$
0
0

I have osx 10.7 and indesign CS5, and I use a script I run several times a day.  Would it be possible to have my mac start this script automatically - maybe every 15 minute?

Automated link creation?

$
0
0

We produce a monthly catalogue that contains approximately 500 part numbers that appear in the form of 'XXXX XXXX'.

 

Once the catalogue has been sent to print we use a third party online eBook creator that auto detects all instances of 'XXXX XXXX' and then inserts static text (http://abc.com.au/search?q=) before the part number to create a hyperlinked URL, eg.

 

http://abc.com.au/search?q=05512365

 

My question is, is InDesign capable of doing the same thing?

 

Apologies if I haven't explained myself very well - am more than happy to provide more info if it helps.

 

Thanks in advance.

[AS/CC]Resizing a box and its contained image

$
0
0

Is there a method ro resize by percentage a box and the image inside?

 

My code for this is the following:

(first line for the box, second for the image)

 

  resize selection in inner coordinates from top left anchor by multiplying current dimensions by values {0.75, 0.75} with resize individually and considering ruler units  resize image 1 of selection in parent coordinates from top left anchor by multiplying current dimensions by values {0.75, 0.75} with resize individually and considering ruler units

 

But unfortunately, if the image is skewed, the result is not what we can expect: the image is resized, but misplaced.

 

Any suggestion?

dropdownlist used onchange of an another dropdownlist

$
0
0

Hi everyody,

 

I try to select my way by using two dropdownlist.

Each item on the first list change the second dropdownlist

 

example

 

List A                              List B               List C               List D  etc..

ItemA1  -> call ListB     ItemB1               ItemC1

ItemA2  -> call ListC     ItemB2               ItemC2

itemA3  -> call ListD     ItemB3               ItemC3

itemA4  -> call ListE     ItemB4               ItemC4              

 

I scripted like this :

 

var myList0= ["ItemA1", "ItemA2", "ItemA3", "ItemA4"];

var myListA = ["ItemB1", "ItemB2", "ItemB3", "ItemB4"];

var myListB = etc ....

 

var columns = myOption2.add("group");

var dimC = [0, 0, 100, 50];

var col1 = columns .add('dropdownlist', dimC , myList0);

col1.onChange = function()

{

     if (col1.selection == 0)

          {

               var col2 = columns .add('dropdownlist', dimC, myListA);

               return col2;

          }

     else if (col1.selection == 1)

          {

               var col2 = columns .add('dropdownlist', dimC, myListB);

          }

     etc ....

}

 

finally, it happens that my second dropdownlist overlap the first, and i want it separately.

 

Please, if anyone have an idea ?

 

best regards

 

Américo


Which .dll contains the Splash Screen?

$
0
0

Hey gang,

 

Do any of you know which .dll file within Adobe InDesign CS6 contains the startup splash png image file?

 

Best,

 

Mike Witherell, ACE

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

Exporting a 6 pg document and changing a text frame on 1st and 6th page for each 50 times

$
0
0

I have these 6 page brochures and there are 50 marketing codes which need to be on first and 6th pages (different codes for each document exported). Rather than manually changing the marketing codes on the 2 pages 50 times (which takes too long) there has to be a easy way to do it. Anyone came across this?

find a text frame on the page with script label

$
0
0

hello to all

 

 

I need to create a script to

find a text frame on the page with script label "xxx"

and read its contents into a variable.

 

 

The content of the text frame is a number.

 

 

thanks

Beginner: help with ungroup script

$
0
0

I just began learning Javascript for InDesign CS5 and I would appreciate some step by step help

 

Goal: Ungroup all grouped objects in the active document.

 

- Active document

- Select all grouped items

- Ungroup the items

 

I tried a bunch of different ways… but I always got an orange highlight in the ESTK. What would the first step be?

Save Indd Filename as Filename of placed PDF

$
0
0

Hi all, I'm not much of a programmer so this may seem like an incredibly easy problem for most of you, but it's baffling me. I'm running Indesign 5.5, and I have a javascript I've hacked together that will step a PDF times onto a page at specific spacing. What I'd like the script to do next is to insert the filename of that placed PDF into a textbox somewhere on the page, and then prompt you to save the indesign file, with the filename defaulting to the name of the placed pdf.

 

Ie. If the filename of the PDF placed on that page is "cct-smith-1.pdf", the text "cct-smith-1" would appear in a textbox on that page, and then the indesign file would prompt you to save with a default filename of "cct-smith-1.indd". Does that make sense?

 

Thanks!

Getting undefined error for current document in script

$
0
0

I'm getting a "Error Number: 2" "Error String: myDoc is undefined" in my script.

 

I tweaked some scripts so they traverse my entire book, and open up every section (document) in my book and run the code for each section.ext

 

The code runs great and opens and closes sections where it doesn't find text to add links to, but once it opens a document and finds text that it CAN add links to, it throws that error.  Below is my code:

 

 

main();
exit(); 
function main() {    var myBook = app.activeBook,            myDocs = myBook.bookContents.everyItem().getElements(),            myDoc,            myHyperlinkStyle,            myCount = 0;     for (var i=0; i< myDocs.length; i++) {        myDoc = app.open(File("\\\\computerOnNetwork\\c$\\Folder\\" + myDocs[i].name));        myHyperlinkStyle = myDoc.characterStyles.item("linkstyle");         try{            var script = app.activeScript;        }catch(err) {            var script = File(err.fileName);        }        var myScriptFolderPath = script.path;        var myFindChangeFile = new File(myScriptFolderPath + "/SearchTextAndUrls.txt"); //mac path for users desktop //File.openDialog("Choose the file containing the tab separated list");         //alert(myFindChangeFile)        myFindChangeFile = File(myFindChangeFile);        var myResult = myFindChangeFile.open("r", undefined, undefined);        if(myResult == true){            app.findTextPreferences = NothingEnum.nothing;            app.changeTextPreferences = NothingEnum.nothing;            //Loop through the find/change operations.            do{                //read 1 line into myLine                myLine = myFindChangeFile.readln();                myFindChangeArray = myLine.split("\t");                 //The first field in the line is the value to find                 myFindVal = myFindChangeArray[0];                 // second is the url                myFindUrl = myFindChangeArray[1];                 doSearchAndReplace(myFindVal, myFindUrl, app.activeDocument);             }while(myFindChangeFile.eof == false);                myFindChangeFile.close();                // reset search                app.findTextPreferences = NothingEnum.nothing;                app.changeTextPreferences = NothingEnum.nothing;        }        alert("Done! " + myCount + " hyperlinks have been added.");         myDoc.close();    }} 
function doSearchAndReplace(stringfind, urlstring, searchin) {    app.findTextPreferences.findWhat = stringfind;     //Set the find options.    app.findChangeTextOptions.caseSensitive = false;    app.findChangeTextOptions.includeFootnotes = false;    app.findChangeTextOptions.includeHiddenLayers = false;    app.findChangeTextOptions.includeLockedLayersForFind = false;    app.findChangeTextOptions.includeLockedStoriesForFind = false;    app.findChangeTextOptions.includeMasterPages = false;    app.findChangeTextOptions.wholeWord = false;     var myFoundItems = searchin.findText();     for (i = 0; i < myFoundItems.length; i++) {        var myHyperlinkDestination = myMakeURLHyperlinkDestination(urlstring);        myMakeHyperlink(myFoundItems[i], myHyperlinkDestination);        myFoundItems[i].applyCharacterStyle(myHyperlinkStyle, false);        myCount++    }} 
function myMakeHyperlink(myFoundItem, myHyperlinkDestination){    try{        var myHyperlinkTextSource = myDoc.hyperlinkTextSources.add(myFoundItem);        var myHyperlink = myDoc.hyperlinks.add(myHyperlinkTextSource, myHyperlinkDestination);        myHyperlink.visible = false;    }    catch(myError){    }} 
function myMakeURLHyperlinkDestination(myURL){    //If the hyperlink destination already exists, use it;    //if it doesn't, then create it.    try{        var myHyperlinkDestination = myDoc.hyperlinkURLDestinations.item(myURL);        myHyperlinkDestination.name;    }    catch(myError){        myHyperlinkDestination = myDoc.hyperlinkURLDestinations.add(myURL);    }    myHyperlinkDestination.name = myURL;     //Set other hyperlink properties here, if necessary.    return myHyperlinkDestination;}

 

Any and all help is greatly appreciated!


Applescripts no longer work

$
0
0

Hi all,

I had to update some old applescripts, but apparantly none of them work anymore on my machine (OSX Mavericks).

It seems to be related with calling InDesign (tried with CS5, 55 and 6), but I'm not sure.

Sample:

set myJavaScript to "alert (\"lalala\");"

 

tell application "Adobe InDesign CS6"

          do script myJavaScript language javascript

end tell

 

Result:

Sytax error:

Expected end of line but found “script”.

 

This used to work fine and actually still works on other machines (also OSX Mavericks)

 

Hoping anyone has experienced something like this and knows a solution...

 

Thanks!

How to place an asset from the library to all pages via JavaScript?

$
0
0

Hello, I'm newbie in scripting that's why I need a help from one who knows. I need a javascript to place an asset from the library to all pages of my document.

I've tried to do it but all i have :

 

var myLibPath = (File("C:/Library.indl"));

var myLib = app.open(myLibPath);

var libItem = app.libraries[0].assets[0].placeAsset(app.documents[0]);

 

this places asset to the selected page only, may be someone can tell me how can it works for all pages.

 

Thanks!

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

Destroying ScriptUI Palette Windows

$
0
0

In ExtendScript, I've run up against a very strange scenario with which I need some help from a ScriptUI guru. I've got a huge InDesign script that, during the course of its execution, displays a progress bar in a palette window:

var w = new Window("palette", "Progress");

I would like this palette to be closed when the script is finished, so I added a w.close() at the end of the script.

 

However, this only occurs if the focus is still in InDesign. Some of our people like to work on other tasks while the InDesign script is running on another screen in the background, which is fine, but when they return to InDesign, that progress bar palette is still on the screen, showing 100% completion. This palette window can be moved around, but it cannot be closed, even if the little red 'x' in the corner is clicked. This eventually leads to multiple palettes staying on the screen throughout the day, as this script is called dozens of times in a normal workday.

 

Reading Peter Kahrel's excellent guide to ScriptUI, I learned that all palettes remain in memory, even after being closed with .close(). I want them completely erased from memory and purged, so they don't stay on the screen if the user switches to another application while the script is running. Any ideas on how to accomplish this?

 

By the way, I wanted to include some sample code so you could see for yourself, but it doesn't seem to work when it's just some small code called from with the ESTK; only in my 4,647-line production script. Thus, I cannot paste any example code.

How to alphabetical order pages at indesign cs4?

$
0
0

I have a text box at the beginning of each page and I want to alphabetical order pages based on that text box. Do you know how to do that?

Viewing all 15932 articles
Browse latest View live


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