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

Auto Subtract Time Zone Values


grep to format numbers in [ ]

$
0
0

hello, I have citations in text which appear in such pattern as [1] or [1-3] or [1, 3-5, 4, 7-10]. I want to use blue color for the numbers in the pattern but everything (, or -) else remain black. I use this grep ((?<=[\[]))([[:digit:]]+(,\s|-))*[[:digit:]]+  which gives me blue color for every thing. How can I just blue color the numbers?

 

Thank you.

doc.AllGraphics crash in C#.

$
0
0

InDesign.Document doc = (InDesign.Document)app.Open(PathToInDesignFile, true); // works fine

InDesign.Graphics allGraphics = (InDesign.Graphics)doc.AllGraphics; // crashes with an exception

 

That's the exception:

Unable to cast COM object of type 'System.__ComObject' to interface type 'InDesign.Graphics'.

This operation failed because the QueryInterface call on the COM component for the interface with IID '{C85A4AB§-9492-...}' failed due to the following error:

No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).

 

How to solve this problem?

Script to delete alternate layout

$
0
0

I am writing a script that puts ID documents into the correct folder and naming structure to be batch imported into a folio. The documents have two alternate layouts, the original "Print" layout and an "I" layout for ipad. I want the script to delete the "Print" layout pages before processing the document. This is effectively the first section of the document. If I try to target it as below, I receive an error that says cannot delete the doc's default section.

 

 

var allSections = myDoc.sections;   var numSections = allSections.length;      if (numSections > 1){       allSections[0].remove();       }

 

How do I correctly target this section, and what is the correct syntax for targeting it by it's altenate layout name, "Print"

 

Many thanks,

Tim

[CS6][JS][Win]Append page number of citation

$
0
0

Hi guys,

 

I hope you can help me with this one, I have a Bibliography page structured like this:

 

DARWIN Charles Erasmus 7529 (1759–1799) Lorem ipsum dolor sit amet,

   consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore

   et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud

   exercitation ullamco laboris nisi ut aliquip ex ea commodo.

 

Then I need to search for the body of the book for pages where Darwin were cited then append it to the end of the paragraph which will look like this:

 

DARWIN Charles Erasmus 7529 (1759–1799) Lorem ipsum dolor sit amet,

   consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore

   et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud

   exercitation ullamco laboris nisi ut aliquip ex ea commodo. [23 35 102 204]

 

Please take note that the citation on the body of the book may come in different format like, CE Darwin, C.E. Darwin, or Darwin, CE.

 

I would really appreciate your help.

 

-CharlesD

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

GREP Commands from CS3 to CS6

$
0
0

Hi All

 

we got some GREP tags which we copied from InDesign CS3 to InDesign CS6. Is it possible that those tags don't work anymore? we use [[:punct:]] for example, but InDesign don't recognize the input...

 

Did Adobe made changes in CS6 the GREP process?

 

Thanks for your support!

 

Reto

exportFile() - export selection option via script?

$
0
0

Hello,

 

From InDesign, I can select a group/textFrame/pictureFrame, and then click File -> Export. From this dialog, after I select my "save location," I can then choose to "Export Selection" by selecting the "Selection" radio button.

 

I'm wondering if this is possible to do with a script? The reason I ask is because I need to export single picture frames (actually, grouped frames, there will be text frames grouped with picture frames). In the SDK I see exportFile() options where you can select if you wish to export as PDF, IDML, JPG, etc. But nothing on "exporting selection". Does anyone know if this is possible, and if so, how it is done?

 

I know there is a bool you can set to "true" to display the dialog, but this all needs to be automated. Anyone have any thoughts on this?

 

Thanks in advance!

 

-Lloyd


InDesign CC - Extract Pages

$
0
0

Not a script guy, but think it's probably the only solution for splitting up an INDD file.

 

I'm running CC and need to break up a few documents into single page InDesign files (not PDF). I've read most of the articles on scripting but don't see anything that will work with CC (already tried a couple). Any suggestions?

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!

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?

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

[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

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

Re-link lots of images? Indesign CS3

$
0
0
Hi - I posted this in the indesign forum and it was suggested to look here. I've had a quick look for a solution but thought I'd post aswell.

"Because I've resaved a load of jpegs to psds the links are now broken.

Is it possible to relink them all without doing each one manually?

The update link option is greyed out. All the psds are in the same folder. "

Thanks again

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

[JS] Menu Added via Scripting Moves

$
0
0

I've been able to sucessfully add items to the InDesign menu thanks in part to Marijan Tompa's (tomaxxi) blog post http://indisnip.wordpress.com/2010/08/08/create-customized-menu/

 

My test code (below) creates a new menu, and sucessfully adds two menu items plus a submenu. The submenu is causing me problems. When you first launch InDesign it's created in the proper place (in the middle of the menu). But when you relaunch InDesign, the submenu moves to the top of the menu and never goes back to it's proper position farther down in the menu where it was the first time InDesign was launched.

 

I've searched high and low in this forum, the web and InDesign's documentation and can't figure out how to keep it from moving (I want the menu to be farther down the menu, not at the top). I hope one of you kind souls will help me to control the position of the submenu (and have it stay there across launches).

 

Thanks in advance!

Dan

 

Here's the code I'm working with. This is saved as testMenu.jsx in the Scripts > startup scripts folder.

P.S. I'm testing this in CS5.5 currently, but ideally this solution should work in CS3 and later.

 

#targetengine "myTestMenu"  
var myFolder = Folder(app.activeScript.path);
myFolder = myFolder.parent + '/Scripts Panel/';  
var menuItem1Handler = function( /*onInvoke*/ ){  app.doScript(File(myFolder + 'MyTest1.jsx'));};  
var menuItem2Handler = function( /*onInvoke*/ ){  app.doScript(File(myFolder + 'MyTest2.jsx'));};  
menuInstaller()
function menuInstaller() {  var menuItem1T = "My Menu Item 1",       menuItem2T = "My Menu Item 2",       menuT = "MyTestMenu",             subT = "Sub Menu",       subs = app.menus.item("$ID/Main").submenus, sma, mnu;  var refItem = app.menus.item("$ID/Main").submenus.item("$ID/&Layout");    subMenu1 = app.scriptMenuActions.item(menuItem1T);  if( subMenu1 == null ) {          subMenu2 = app.scriptMenuActions.add(menuItem1T);  }    subMenu2 = app.scriptMenuActions.item(menuItem2T);  if( subMenu2 == null ) {          subMenu2 = app.scriptMenuActions.add(menuItem2T);  }  subMenu2.eventListeners.add("onInvoke", menuItem2Handler);    mnu = subs.item(menuT);  if( mnu == null ) {            mnu = subs.add(menuT, LocationOptions.after, refItem);  }  mnu.menuItems.add(subMenu1);  mnu.menuSeparators.add();    subsSubs = app.menus.item( '$ID/Main' ).submenus.item( menuT ).submenus;  mnuSubMenu = subsSubs.item( subT );  if( mnuSubMenu == null ) {          mnuSubMenu = subsSubs.add( subT);  }    mnu.menuItems.add(subMenu2);}

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.

how to get character count

$
0
0

Hi All,

 

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

 

Regards,

RockSelFindValue.JPG

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?

Viewing all 15932 articles
Browse latest View live


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