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

[JS] ScriptUI CS6

$
0
0

Hi

 

Can anyone help me with a bit of ScriptUI. I am building a dialog box that contains a tabbed panel containing a single tab. I am filling this window with rows of editText boxes. Is it possible to make the tabed panel scrollable? There will be times when the screen is not deep enough, and need to be able to scroll up and down.

Screen Shot 2013-06-10 at 11.44.16 PM.png

Cheers

 

Roy


document.search() is not a function

$
0
0

We recently upgraded from InDesign CS2 to InDesign CS6.

We have scripts that we ran on Windows InDesign CS2 that we are trying to get to run on a Mac InDesign CS6.

 

We are getting the following error when executing one of the scripts.

 

Screen Shot 2015-04-09 at 4.14.23 PM.png

 

 

I looked in the Object Model Viewer and did not find a method search() for Document.

 

Screen Shot 2015-04-09 at 4.06.16 PM.png

 

Since it looks like this worked before in CS2, I am wondering if anyone knows if this method was deprecated in CS6 and if there is another method that does the same work?

This is the code that gets executed.

Screen Shot 2015-04-09 at 4.06.27 PM.png

Any help in the right direction is appreciated.

Switching Key board Shortcuts.....

$
0
0

I have stucked in one place in indesign scripting....

 

 

Problem - 1:

In  indesign keyboard shortcut menu ==>  many times I need to switch-over shortcut set from my shortcut to my shortcut 1 and vice versa...

 

Is there any way in scripting by which I can switch it without opening menu ?

 

 

Problem - 2:

   

I am using many scripts in my PC... also have assigned shortcuts to each scripts....Now I want to deploy the same scripts with same shortcuts to many other PCs... Is there any way to automate this task ?

 

I have tried by replacing InDesign Shortcut Sets at following folder....

C:\Users\rakshit\AppData\Roaming\Adobe\InDesign\Version 8.0\en_US\InDesign Shortcut Sets\ 

 

 

File which I am replacing in other PCs are My Shortcuts 1.indk

 

 

Thanks in advance....

Script to get the image height and width

$
0
0

I need to know the size (dimensions) of images placed in an InDesign 5.5 document.

 

I have made the following script by combining different code. It gets the metadata OK, but the witdh and height are empty. Am I using getProperty wrong?

 

// Refr
// https://forums.adobe.com/thread/288764
// https://forums.adobe.com/thread/2288546          var scriptName = "Get description from selected link",      doc;            PreCheck();        //exif:PixelXDimension   tiff:ImageWidth    //===================================== FUNCTIONS ======================================      function Main(image) {          var link = image.itemLink,          metadata = link.linkXmp,           description = metadata.description,        format = metadata.format,        author = metadata.author,        modificationDate= metadata.modificationDate,        creator = metadata.creator,        myLinkWidth = metadata.getProperty("http://ns.adobe.com/tiff/1.0/", "tiff:ImageWidth"),        myLinkLength = metadata.getProperty("http://ns.adobe.com/tiff/1.0/", "tiff:ImageLength"),         Width = metadata.getProperty("http://ns.adobe.com/exif/1.0/", "exif:PixelXDimension"),        Height = metadata.getProperty("http://ns.adobe.com/exif/1.0/", "exif:PixelYDimension");        alert("Description is: '" + description + "'\nFormat: " + format + "\nAuthor: " + author + "\nDate modified: " + modificationDate + "\nCreator: " + creator, scriptName, false);         alert("Pixel dimentions of image:\nWidth: " + myLinkWidth + Width + " pixels\nHeight: " + myLinkLength + Height +" pixels");    }      //--------------------------------------------------------------------------------------------------------------------------------------------------------      function PreCheck() {          var image;          if (app.documents.length == 0) ErrorExit("Please open a document and try again.", true);          doc = app.activeDocument;          if (doc.converted) ErrorExit("The current document has been modified by being converted from older version of InDesign. Please save the document and try again.", true);          if (!doc.saved) ErrorExit("The current document has not been saved since it was created. Please save the document and try again.", true);          if (app.selection.length == 0 || app.selection.length > 1) ErrorExit("One image should be selected.", true);                    if (app.selection[0].constructor.name == "Image") { // image selected with white arrow              image = app.selection[0];          }          else if (app.selection[0].images.length > 0) { // container selected with black arrow              image = app.selection[0].images[0];          }          else {              ErrorExit("No image in the selection.", true);          }                Main(image);      }      //--------------------------------------------------------------------------------------------------------------------------------------------------------      function ErrorExit(error, icon) {          alert(error, scriptName, icon);          exit();      }      //--------------------------------------------------------------------------------------------------------------------------------------------------------  

 

I'll explain why I'm doing this:

I'm making a magazine and the photos we get are in all different sizes and quality. In a layer called "picName" I have text frames on top of images with information from Text Variables such as name of file, PPI, actual PPI, dimensions, and scale. I make a pdf of the magazine and while my editor proof reads and edits the document I fix the photos (I cannot use InDesign at same time as she.). I use the information from the picName-layer and an Excel-sheet to determine the right size of the images, and then I edit the images in Photshop.

 

It would be a lot easier to have the calculation in the pdf itself. What I hope to achive is:

 

  1. Get the width (W) of the linked image.
  2. Get the PPI (P) of the linked image.
  3. Get the scale (S) of the image in the frame (percent).
  4. Calculate the width the image should have: W * S * 300 / P
  5. Insert the width the image should have in a text frame in the picName-layer on top of the image.

ScriptUI Multiline StaticText Frame Too Large

$
0
0

Hi Folks,

 

Has anyone here had an issue (and, hopefully come up with a workaround!) where multiline static text frames that are defined with a non-default width become taller than they should be? This seems to happen in all versions of InDesign. FWIW, this problem does not seem happen in Illustrator (using the same code).

 

The longer the static text, the more unnecessary white space appears at the bottom of the text frame--and the taller the window becomes. To me, it seems like the height of the frame is being calculated for a narrower frame width than what the script defines.

 

Here's sample code that displays a dialog box that shows the issue. (NOTE: The size of the static text's frame is filled with red to show what's happening). I would expect that the red area would stop at (or very near) the bottom of the static text.

 

var MsgBoxTest = new Window('dialog',undefined,undefined);
buildWindow();
MsgBoxTest.show();

function buildWindow(){
    MsgBoxTest.alignChildren = ['left','top'];    MsgBoxTest.orientation = "column";    // Properties for MsgBoxTest.MsgGroup    MsgBoxTest.MsgGroup = MsgBoxTest.add('group',undefined);    MsgBoxTest.MsgGroup.alignment = ['left','top'];    MsgBoxTest.MsgGroup.maximumSize= [650,600];    MsgBoxTest.MsgGroup.alignChildren = [' ','top'];    MsgBoxTest.MsgGroup.orientation = "column";    MsgBoxTest.MsgGroup.graphics.backgroundColor = MsgBoxTest.MsgGroup.graphics.newBrush(MsgBoxTest.MsgGroup.graphics.BrushType.SOLID_COLOR,[1,0,0],1);    // Properties for MsgBoxTest.MsgGroup.StaticText1    MsgBoxTest.MsgGroup.StaticText1 = MsgBoxTest.MsgGroup.add('statictext',undefined,"Nonserita demquat issimus ex eatiust, occatur, ut ommod expliquodi ratusam, que vendest dolorepro coreium volorempere doluptat as exceaquam quo qui\r\rBus reped mos exere od quodior porum?", {multiline:true});    MsgBoxTest.MsgGroup.StaticText1.alignment = ['left','top'];    MsgBoxTest.MsgGroup.StaticText1.maximumSize= [325,600];    MsgBoxTest.MsgGroup.StaticText1.preferredSize.width = 325;    MsgBoxTest.MsgGroup.StaticText1.preferredSize.height = -1;

}
 

 

Are there any workarounds for this issue?

 

TIA!!!

 

-- Jim

Placing & scaling a multi-page PDF in InDesign?

$
0
0

I need to place a 300+ page PDF that is 8 1/2 x 11 into an InDesign doc that is 5 1/2 x 8 1/2, and have the PDF pages scale proportionately to the smaller size.….can anyone help? In the "Place" command there is no option for this; yes, I can import then scale the pages one at a time but to have to do that 300+ times is simply ridiculous. There is what seems to be a great script here:

http://indesignsecrets.com/placing-all-the-pages-of-a-pdf-inside-indes ign.php/comment-page-3#comment-494840

however, there is no way I can figure out how to get to the dialog box pictured in the article. All I can do is right click on the script itself and tell it to run, but it doesn't bring up that snazzy little dialog box.......Am I missing something? Is there a particular folder inside the Scripts folder where I must place this script? And then is there some specific menu I must go to to bring up that dialog box?

 

Many thanks in advance!

Need script for find and change text

$
0
0

We have some set of texts that need to find and change in the entire InDesign CS4 document rather than doing manually. Kindly help me out to do the same successfully.

 

for e.g. find text - "mam" and replace with "man".

run on paragraphs

$
0
0

i need to add the main entry text before sub entry like below how to do this

 

para style name : inx1, inx2, inx3

 

eg

mainentry 

sub entry 10, 11

       sub sub entry of, 15,11

 

expected output

 

mainentry

mainentry sub entry 10, 11

mainentry   sub entry 10, 11   sub sub entry of, 15,11


access text in library asset- undefined

$
0
0

I have a library of text snippets in text frames.

 

I can place the asset on my page -- but my script is unable to access the text:

 

    var myObj = myAsset.placeAsset(app.activeDocument); // works -- text frame placed on page

    alert(myObj.contents); // undefined

 

 

the asset was created:

     tf=app.activeDocument.pages[0].textFrames.add();

    sel.duplicate(LocationOptions.AT_BEGINNING,tf);

        asset= lib.store([tf]);

        asset.name=name;

    tf.remove();

 

 

I can manually select/copy the text in the asset - but I need to select and then duplicate the snippet in my main text.

 

Any idea why it's not working?

 

Thanks

How can add a parallelogram shape by Script?

$
0
0

to add Rectangle i using:

var oRec= oDocument.rectangles.add();

But Can i setting this Rectangle to a parallelogram shape?

or

How can add a parallelogram shape by Script?

Delete unused layer..?

$
0
0

Hi Everyone!,

 

I am new baby to indesign scripting and anyone to help me find that below indesign script.

 

How do i delete unused layer in indesign CS4? and how do know linked image mode like CMYK, RGB, LAB.

 

Thanks in Advance.

 

- yajiv

Getting XML attribute value

$
0
0

Hi,

 

I tried to get particular attribute  value of a element in xml.I used

 

var famid=mySel.associatedXMLElement.parent.xmlAttributes.itemByName("family_id").value;  

 

This worked for me for some elements.But for some elements it returned 'Object is Invalid" error.What should be done to get the attribute value.?Please do guide on this..

 

Regards,

Revathi V

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

Move ObjectStyle to Layer

$
0
0

Hi,

 

I made a script that prompts for object style and layer, then moves all objects with selected object style to the selected layer.

Here's a link to .zip archive that contains script and .indd / .idml test files - Dropbox - MoveObjects2Layer.zip

 

The problem is that sometimes script works just fine, but sometimes it fails: doesn't move all objects and/or move objects with another object style...

Moreover, when it fails - there are totally random results...

Not sure if it's a script or InDesign bug.

Run .bat file with arguments?

$
0
0

Hi,

 

   I need to run the .bat file with parameters/arguments in Adode Indesign JavaScript. "File.execute()" executes the file using the appropriate application.It executes the .bat file suceessfully.But I am unable to pass the arguments.I need to execute the command like

Eg : test.bat parameter1 parameter2

 

var myFile=new File("c:\\test.bat");

myFile.execute();

 

The above statements works fine. Is it possible to execute the with parameters. Please suggest the solution to above problem.


Excel data merge to Indesign

$
0
0

Hi, I have an excel spreadsheet with a column of dimensions, height and width.   What I would like to do is import this list into Indesign and run a script creating frames/ boxes.   In addition to merging this list and creating boxes, I would hope to have these boxes align in a linear pattern each meeting up with the other flush.

 

Thanks in advance,

 

excel to Indesign.jpg

[JS]: Is there anyway to change a document's name?

$
0
0

Is there anyway to change a document's name? Or create a document with a certain name?

I'm looking at the JavaScript reference, and it says that document.name is a readonly value. Is this entirely true / is there any other way to change the name of a document?

 

Any help would be much appreciated

Thanks!

Finder Colour Tags

$
0
0

Hi,

I wondered if anyone can help, I'm trying to find how to alert the colour tags on a file from finder I.e. Green, Red etc.

I have put a "Test.indd" file on my desktop and tagged it Green to test this.

I have tried looking for this on the forum but can't find a Javascript version that I have been able to adapt, not sure if I'm going the right way but this is what I have at the moment.

 

alert(app.extractLabel ("~/Desktop/Test.indd"))

 

Many Thanks for any help, Bren

Call the Finder print window from within Indesign

$
0
0

Hi,

 

I have a few Applescripts to automate all of my print jobs.

 

Since we us a new pinter in the office, the machine uses a authentication.

That authentication is just a number provided in a submenu of the Finders Print window.

When printing manually, in the Indesign print window, we have to click the "printer" window first, click ok and then print, just to activate the authentication.

However, when I print from Indesign using a script, that print screen is ignored, so, the authentication code is also ignored.

Is there a way to call that Finder print window (and close it again) prior to the Indesign print command?

 

I hope my explanation is clear to understand :-)

Any help or suggestions are welcome.

 

Thanks!

Schermafbeelding 2018-05-07 om 13.22.03.png

 

Here's one example of one of my scripts (all credits go to MacGrunt for this)

on returnNumbersInString(inputString)  set s to quoted form of inputString  do shell script "sed s/[a-zA-Z\\']//g <<< " & s  set dx to the result  set numlist to {}  repeat with i from 1 to count of words in dx  set this_item to word i of dx  try  set this_item to this_item as number  set the end of numlist to this_item  end try  end repeat  return numlist
end returnNumbersInString


tell application id "com.adobe.InDesign"
  tell document preferences of active document  set myBleedText to document bleed top offset as string  end tell
end tell


set myBleed to returnNumbersInString(myBleedText)


tell application id "com.adobe.InDesign"
  tell active document  set theLinks to every link  repeat with aLink in theLinks  if status of aLink is link out of date then  -- update aLink  display dialog "Er zijn gewijzigde beelden aanwezig in het document, ben je zeker dat je wil verder gaan?"  else  if status of aLink is link missing then -- other options are normal/link out of date/link missing/link embedded  --missing link handling  display dialog "Er zijn ontbrekende beelden aanwezig in het document, ben je zeker dat je wil verder gaan?"  end if  end if  end repeat  set mgPgFace to facing pages of document preferences as string  set mgPgOrnt to page orientation of document preferences as string  set mgDocHght to page height of document preferences  set mgDocWdth to page width of document preferences  set mgDocHght to mgDocHght as integer  set mgDocWdth to mgDocWdth as integer  set the page range of print preferences to all pages  set mgPgHght to mgDocHght + myBleed + myBleed + 10  set mgPgWdth to mgDocWdth + myBleed + myBleed + 10  if mgPgFace is "true" then --print document as spreads  if mgPgHght is greater than 185 or mgPgWdth is greater than 130 then --use one of the A4 presets  if mgPgHght is greater than 277 or mgPgWdth is greater than 200 then --use A3 fit preset  set mgPrintPreset to "A3 comp liggend spread fit"  else --use A3 100% preset  set mgPrintPreset to "A3 comp liggend spread"  end if  else --use A4 horizontal preset  set mgPrintPreset to "A4 comp liggend spread"  end if  else --print document as single pages  if mgPgOrnt is "portrait" then --use one of the vertical presets  if mgPgHght is greater than 277 or mgPgWdth is greater than 200 then --use one of the A3 presets  if mgPgHght is greater than 400 or mgPgWdth is greater than 277 then --use A3 fit preset  set mgPrintPreset to "A3 comp staand spread fit"  else --use A3 100% preset  set mgPrintPreset to "A3 comp staand spread"  end if  else --use A4 vertical preset  set mgPrintPreset to "A4 comp staand spread"  end if  else --use one of the horizontal presets  if mgPgHght is greater than 200 or mgPgWdth is greater than 277 then --use one of the A3 presets  if mgPgHght is greater than 277 or mgPgWdth is greater than 400 then --use A3 fit preset  set mgPrintPreset to "A3 comp liggend spread fit"  else --use A3 100% preset  set mgPrintPreset to "A3 comp liggend spread"  end if  else --use A4 horizontal preset  set mgPrintPreset to "A4 comp liggend spread"  end if  end if  end if  print using (mgPrintPreset as string) without print dialog  if modified is true then save  display notification "Uw document wordt geprint" with title mgPrintPreset  end tell
end tell


print using (mgPrintPreset as string) without print dialog


if modified is true then save


display notification "Uw document wordt geprint" with title mgPrintPreset

end tell

end tell

How to Re-Sign an Old CS5.5 Extension

$
0
0

We have a large customer for whom we wrote a CS5.5 InDesign Extension about 5 years ago. 2 years ago we re-built and signed the Extension. The code signing cert was only good for 2 years. 2 years have passed and we no longer have the old Extension Builder available or anyone who would  know what to do with it ...

 

I thought I could take the old ZXP file, unzip it, remove the META-INF dir (and the signature.xml file in it), and then resign it with ZXPSignCmd and a new cert.

 

I thought wrong.

 

The Adobe Extension Manager reports that the signature is not valid.

 

I would appreciate any help.

 

TIA,

mlavie

Viewing all 15932 articles
Browse latest View live


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