• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

With CS2, some things have changed

Participant ,
Apr 25, 2005 Apr 25, 2005

Copy link to clipboard

Copied

I have not located a place where changes in scripting between CS and CS2 are reported, so I thought I'd start a topic here with some of the things I know about.

This is about changes to the object model that are not related to changes in the functionality that have taken place.


1. User Interaction Control
2. Table Labels
3. Parent Text Frame
4. New Beep Function
5. Find/Change symbol for End Nested Style Here
6. Convert to Table
7. Active Script in doScript
8. Text selections more specific

9. Table selections
10. Indexes
11. Basic Paragraph style
12. Enumeration Name Changes
13. Placed Assets
14. Previous Text Frame
15. Version Property
16. Add Page Reference (Index)


In describing these in the following messages, I'll use JavaScript terminology, but most of these issues are independent of the language.
TOPICS
Scripting

Views

15.6K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Nov 03, 2005 Nov 03, 2005

Copy link to clipboard

Copied

Ah, that's a different issue. There is a bug that I reported a month or so ago. I'm not sure if I reported here, though. Here's how I got around the problem of the no-iteraction flag in the place command not working:

// 1. Import Excel File

var myFile = File.openDialog("Choose an Excel file");
if (myFile == null) { exit() }

if (app.version == 3) {
 app.userInteractionLevel = UserInteractionLevels.neverInteract;
} else {
 app.scriptPreferences.userInteractionLevel = UserInteractionLevels.neverInteract;
}

myDoc = app.documents.add();
setXLimportPrefs();
try {
 myDoc.pages[0].place(myFile,[0,0],undefined,false,true);
} catch (e) {
 alert (e + " " + app.excelImportPreferences.errorCode);
 exit();
}
if (app.version == 3) {
 app.userInteractionLevel = UserInteractionLevels.interactWithAll;
} else {
 app.scriptPreferences.userInteractionLevel = UserInteractionLevels.interactWithAll;
}

[snip]

function setXLimportPrefs() {
 with (app.excelImportPreferences) {
  alignmentStyle = [AlignmentStyleOptions.spreadsheet,
    AlignmentStyleOptions.leftAlign,
    AlignmentStyleOptions.rightAlign,
    AlignmentStyleOptions.centerAlign][0];
  //decimalPlaces = 3;
  //errorCode = 0;
  //preserveGraphics = true; // Not sure what this does either
  //rangeName = ""; // Hopefully leaving this blank will cause ranges to be ignored
  //sheetIndex = 0;
  //sheetName = "";
  //showHiddenCells = true;
  tableFormatting = [TableFormattingOptions.excelFormattedTable,
    TableFormattingOptions.excelUnformattedTable,
    TableFormattingOptions.excelUnformattedTabbedText][1];
  useTypographersQuotes = true;
  //viewName = "";
 }
}

As you can see, I ended up commenting out most of the import preferences.

Oh, this is JavaScript, so you'll need to translate.

Dave

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 04, 2005 Nov 04, 2005

Copy link to clipboard

Copied

Thanks for your script Dave.

But the problem is the same, because you can't specify the sheet and zone you want to import in your script. It seems I should have a file for each sheet in the excel file :(

Serge

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 04, 2005 Nov 04, 2005

Copy link to clipboard

Copied

Hi Dave

I finally decided to try make an import in Javascript and it works a lot
better. I "uncommented" the following lines

sheetName = "mysheetname";
rangeName = "xx:yy";

And it work perfectly well! selecting the right sheet!

I think there is a problem with the VBS feature. I'll continue in javascript then.

Thanks for your help.
Serge

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Nov 04, 2005 Nov 04, 2005

Copy link to clipboard

Copied

Ah, I was going to asked if you'd tried uncommenting those two lines. Glad it worked.

Dave

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 08, 2005 Dec 08, 2005

Copy link to clipboard

Copied

I am not a scripter but I'm hoping someone can help me with a problem given that it's likely to be small. The script below works in version 2.0 but not version CS2. This handy little thing saves me hours of work!

Any help is very much appreciated.

tell application "Adobe InDesign CS2"
tell document 1
set theSelection to selection

repeat with anItem in theSelection
set theTarget to anItem
set theClass to class of theTarget
if theClass is in {EPS, PDF} then -- if the image is selected by direct tools
set theTarget to parent of anItem
end if

if page item 1 of theTarget exists then
tell theTarget
«event K2 fitc» given «class givn»:content to frame
set horScale to round (horizontal scale of page item 1) + 0.5
-- add 0.5 %
set vertScale to round (vertical scale of page item 1) + 0.5
-- add 0.5 %

if horScale is greater than vertScale then
set vertical scale of page item 1 to horScale
set horizontal scale of page item 1 to horScale
else
set horizontal scale of page item 1 to vertScale
set vertical scale of page item 1 to vertScale
end if
«event K2 fitc» given «class givn»:center content
end tell
end if
end repeat
end tell
end tell

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Dec 08, 2005 Dec 08, 2005

Copy link to clipboard

Copied

tell application "Adobe InDesign CS2"<br /> set theSelection to selection<br /> <br /> repeat with anItem in theSelection<br /> set theTarget to anItem<br /> if exists graphic 1 of theTarget then<br /> set theTarget to graphic 1 of theTarget<br /> else<br /> set theClass to class of theTarget<br /> if theClass is not in {EPS, PDF} then<br /> set theTarget to {}<br /> end if<br /> end if<br /> if theTarget is not {} then<br /> tell theTarget<br /> fit parent given fill proportionally<br /> set horScale to round (horizontal scale) + 0.5<br /> -- add 0.5 %<br /> set vertical scale to horScale<br /> set horizontal scale to horScale<br /> fit parent given center content<br /> end tell<br /> end if<br /> end repeat<br />end tell<br /><br />-- <br />Shane Stanley <sstanley@myriad-com.com.au>

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 11, 2005 Dec 11, 2005

Copy link to clipboard

Copied

Thanks Shane. People like you make the world a better place!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jan 25, 2006 Jan 25, 2006

Copy link to clipboard

Copied

I couldn't find any of the commands for dealing with InCopy stories in the scripting reference. Commands like check in and check out. I looked under Links and under Stories and did a search for InCopy. Am I looking for the wrong thing?

ID has made it easy to export all stories to InCopy, but it doesn't make it easy to unlink. You have to select all the stories in the links pallet, choose check out and then unlink. It doesn't seem like much, but if you have 40 documents with multiple InCopy stories each, it can be time consuming. There is also no way to do a global check out of all IC stories in all the open documents which would be handy for making global changes like changing a font or doing an all documents find/replace.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 12, 2006 Feb 12, 2006

Copy link to clipboard

Copied

duplicate() has changed. In CS2 you can now add an offset to duplicate an object at a certain position. To duplicate an object and move the duplicate 4cm to the right and 3cm down, this can be done with one statement in CS2:
myObject.duplicate(['3cm',4cm'])

In CS1 you need two steps: duplicate and move:
myObject.duplicate()

myObject.move(undefined,['3cm',4cm'])

Peter

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 31, 2006 Aug 31, 2006

Copy link to clipboard

Copied

Is there a breakdown on the change of syntax for AppleScript as well? I have run into a few problems with updating scripts for CS2, and while I have been able to find the solutions with the help of this thread and the scripting guide the latest one I don't see a reference to. Specifically making an inline graphic (rectangle) in the text flow is not working in CS2.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 20, 2007 Aug 20, 2007

Copy link to clipboard

Copied

can u tell how to place assets in a library using adobe indesign CS3

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 20, 2007 Aug 20, 2007

Copy link to clipboard

Copied

LATEST
I answered in the topic: With CS3, some things have changed.

Dave

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines