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

JS ScriptUI CS4: How to create an indeterminate progress bar?

$
0
0

Hi Folks,

 

Does anyone here know if ExtendScript (I'm using the CS4 flavor of ES) can produce an indeterminate (i.e., "barber pole") progress bar using ScriptUI's progressbar control? I've tried a number of value settings for the progress bar control in hopes that they would trigger the barber pole behavior, but so far, no luck.

 

My current workaround is to "loop" the progress indicator. In other words, when the progress bar's value > maxvalue, I reset the value back to minvalue. Then rinse and repeat. Not really what I want, but the task being processed takes quite a bit of time, so I need to show some sign of something happening to the user.

 

Thanks!

 

-- Jim


Find and replace

$
0
0

Hi,

 

 

  XML poured document in InDesign, when moving the anchor it creates character like ":". 

 

I need to replace that character but I could not replace that. Even not able find that character in Indesign application manually.

 

 

 

char.png

 

find.png

 

 

 

 

If anyone knows, pls help me.

 

 

Thanks in advance,

Sudha K

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!

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!

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!

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!

Auto Subtract Time Zone Values

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?


Please help. How to remove some of index reference?

$
0
0

Sometimes I need to use an old indesign document to make another book. It is easy and fast. You do not need to define footnotes, running headers, master pages etc. 

 

I always have the problem with books that had index inside.

It is easy to remove an old text from the document and fill in a new text.

But if an old document had index, such reference like "see" "see also" etc. still remains unremoved (undeleted). 

The are stil listed in the index palette. 

And I don't know how can I remove them automatically from my old document before I import a new text to it.

 

Probably someone of you can write such simple script which can remove all index reference (or particularly such as "see" and see also") from the empty InDesign document.

I mean empty indesign document that is document without body text inside.

 

Thank you in advance for your help and sorry for my poor English.

[AS][CS6]Apply different styles in one text frame

$
0
0

Hello,

 

Currently, I have an AppleScript to fill a single text frame with a series of strings:

 

tell MyTextFrame to set (contents of parent story) to MyText1& MyText2&MyText3&MyText4

 

I would like to apply a different style (MyStyle1 to MyStyle4) to each of these strings (MyText1 to MyText4).

Accuracy: MyTexti strings can contain a word or a paragraph or more, so I cannot apply a style to a paragraph, for example.

 

Thomas

ExtendScript - Waiting Message?

$
0
0

I'm having a bit of an issue when trying to select my target in the ExtendScript ToolKit. When I select InDesign as the target, it launches the application but ESTK sits there with a message box saying "Waiting; press ESC to abort..." It appears that it's not able to communicate with the process at all, and I'd love a little help debugging this. Anyone have any ideas?

 

 

Thanks!

Why is There No Guidance for FindChangeList?

$
0
0

Dear Adobe Forums,

 

I am a very experienced user of InDesign, working on CS5.5 and EPUB production. I thought that using Adobe's provided "FindChangeList" JavaScript would be timesaver for preparing InDesign files for export to EPUB. But in my experience, despite spending days of time on it and bending over backward to code my queries carefully, FindChangeList does not work without endless error messages that, as a non-programmer, I am not able to decipher. I'm very frustrated and annoyed by what should be a much more user-friendly script! After all, wasn't the whole idea of "FindChangeList" to make multiple find-and-replace operations available to a user of InDesign?

 

I've read Adobe's support file at the top of the FindChangeList.txt doc. Here are just a few questions.

 

Why does it still say InDesign CS4 when it was provided with InDesign CS5.5?

 

Why are there no examples of how to change one character style into another, or one paragraph style into another?

 

What is the full list of "FindChangeOptions" available, and why isn't it provided somewhere?

 

Why is  there no mention of the "FindChangeList" JavaScript in your own InDesignCS5_ScriptingGuide_JS, available for download?

 

As just one example of how this script isn't working, I recently added the following to a script:

 

text{appliedCharacterStyle:"subru"}{appliedCharacterStyle:"sub-title"}{includeHiddenLayers:true, includeMasterPages:true, includeFootnotes:true, wholeWord:false, caseSensitive:false}
text{appliedCharacterStyle:"subsource"}{appliedCharacterStyle:"sub-src"}{includeHiddenLayers:true, includeMasterPages:true, includeFootnotes:true, wholeWord:false, caseSensitive:false}
text{appliedCharacterStyle:"s1"}{appliedCharacterStyle:"sub-herb"}{includeHiddenLayers:true, includeMasterPages:true, includeFootnotes:true, wholeWord:false, caseSensitive:false}
text{appliedCharacterStyle:"s2"}{appliedCharacterStyle:"sub-herb"}{includeHiddenLayers:true, includeMasterPages:true, includeFootnotes:true, wholeWord:false, caseSensitive:false}
text{appliedCharacterStyle:"s3"}{appliedCharacterStyle:"sub-herb"}{includeHiddenLayers:true, includeMasterPages:true, includeFootnotes:true, wholeWord:false, caseSensitive:false}

 

When run, this returned the error message:

Screen shot 2011-12-09 at 11.38.07 AM.png

 

I don't want to get 20 responses from a mixed bag of InDesign users guessing at what's going on. What I need is for Adobe to tell me where is the information needed to run this script properly?

 

I thought the whole point of "FindChangeList" was to quickly do batch changes. So far, it's been anything but. Either get this script working, provide the proper documentation, or retire it.

 

Thanks, Gary Niemeier

ScriptUI : edittext live modifications problem

$
0
0

Hi,

I set a scriptUI interface.

 

http://i.imagehost.org/0754/Image_1.png

I have two buttons :

     - one has to add a carriage return on the edittext field

     - one has to add tab.

I am using textselection property of the edittext object.

On Mac it works very fine.

On Windows, it just go crazy. Sometimes, it just ignores the click, other times, it adds the element unexpectingly.

ie tab or carriage return are placed everywhere but where I want it.

What do I do wrong ?

TIA Loic

Recent files list

$
0
0

Hi all,

 

I highly doubt that this can be done but....

Any chance of creating and saving a file without it being added to the recent files list.

 

Trevor

how to make own crop marks in indesign CS5

$
0
0

HaloMaster..
Iwant tomake ascripcropmarkownusejavascrip..
cropmarkstandardInDesignonly

 

1.jpg

butIwant toadd acolorbaritselfusingPDFFile
Ihaveadded ascrip

 

function myDisplayDialog(){

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

    with(myDialog){

//---------------------yazh---------------------------------

with(dialogColumns.add()){

            var myColorBarGroup = enablingGroups.add({staticLabel:"Color Bar", checkedState:true});

            with (myColorBarGroup){

                with(borderPanels.add()){

                    staticTexts.add({staticLabel:"Options:"});

                    with (dialogColumns.add()){

                          var myAllColorlesCheckbox = checkboxControls.add({staticLabel:"&All", checkedState:true});

                    var myTBColorCheckbox = checkboxControls.add({staticLabel:"&Top,Bottom", checkedState:false});

                    var myLRColorCheckbox = checkboxControls.add({staticLabel:"&Left,Right", checkedState:false});

                 }

                }

            }

        }

//---------------------yazh---------------------------------      

 

and..

 

var myReturn = myDialog.show();

    if (myReturn == true){

        //Get the values from the dialog box.

         //---------------------yazh---------------------------------   

        var myDoColorBar = myColorBarGroup.checkedState;

        var myColorBarAllColor = myColorBarGroup.checkedState;

        var myColorBarTBColor = myColorBarGroup.checkedState;

        var myColorBarLRColor = myColorBarGroup.checkedState;

         //---------------------yazh---------------------------------   

 

so thedisplay becomes

2 copy.jpg


getthemasterto helpmeadd ascripforcallinga PDFfileandadjustthearea,such as

3.jpg4.jpg


please help methemaster
I ama beginner..

 


Thank you

YazhiMyi


How do I write a javascript code to open InDesign template, import XML, save and export to pdf?

$
0
0

How do I write a javascript code to open InDesign template, import XML, save and export to pdf?

 

I mostly need the help with writing the javascript code to open the InDesign file, import some xml that will be randomly coming in and then saving the document.

how to get character count

$
0
0

Hi All,

 

How to read the below highlighted value in script. Pl help me.

 

Regards,

RockSelFindValue.JPG

socket connection not returning/reading response

$
0
0

Env: Indesign CS 5.5 and Indesign CS 6; Mac OS 10.8.4

 

I have a strange issue with reading the response from the server that just started after a client upgraded from a previous OS to Mac OS 10.8.4. However, this particular script has worked on other 10.8.4 machines so I believe it is another issue.

 

Here is the code in question:

var rtnData = "";
conn = new Socket; if (File.fs == "Windows") var isMac=0;          else var isMac=1; 
var myRequest = "GET "+vSubDir+"/get_Pathnames.asp?ismac="+isMac+" HTTP/1.0\n\n"if (debug) $.writeln(myRequest);    if (conn.open (vHost)) {                        conn.write (myRequest);       // send a HTTP request        rtnData = conn.read(999999);  // and read the server’s reply                conn.close();}

vHost=I.P address of server

vSubDir=subdirectory to the file

 

 

So some of the tests I ran already:

conn.open(vHost) returns true.

When I go to vHost+vSubDir+"/get_Pathnames.asp?ismac="+isMac+" directly in the browser I receive the response I expect.

 

 

Essentially Indesign is connecting to the server but not reading the response that I know exists. Has anyone else experienced this issue or something similiar? I can't recreate it anywhere but the client's machine.

InDesign CC addEventListener not work

$
0
0

Don't work in InDesignCC addEventListener:

 

var w =new Window ("dialog");

var b = w.add ("listbox", undefined, "Qwerty");

b.addEventListener("click", function (k){

    alert("detail: "+k.detail+'\r'+"X: "+ k.clientX+'\r'+"Y: "+ k.clientY);

});

w.show ();

 

 

it's ok to work in ESTK and CS.

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?

Viewing all 15932 articles
Browse latest View live


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