🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.scripting.indesign
Article #15442

Re: Setting Applied Char Style of Nested Style by name

#15442
From: Dave_Saunders
Date: Fri, 28 Nov 2003 22:43
26 lines
2021 bytes
Oh boy, now I'm really starting to understand the differences between AppleScript and JavaScript. Compare:

tell application "InDesign CS"
 tell document 1
  set myPstyle to paragraph style "Body"
  set myNstyles to nested styles of myPstyle
  tell myPstyle
   set myNewNstyle to make nested style
  end tell
 end tell
end tell

with:

myDoc = app.documents[0];
myPstyles = myDoc.paragraphStyles;
myNstyles = myPstyles.item('Body').nestedStyles
myNewNstyle = myNstyles.add();

These sure look mighty similar, but at the end of the AppleScript, myNstyles is a list of two items (the original two nested styles I started with) while at the end of the JavaScript (starting with the document in the same state as it was when I ran the AppleScript) myNstyles is a list of three objects.

In the one case, the AppleScript variable was loaded with references to the two styles and the adding of the third style didn't affect it. But in the other case, the JavaScript variable was loaded with a reference to the nested styles of paragraph style "Body" of myDoc and so when I added the third nested style the variable was automatically already pointing it along with the other two.

Wow! It's not that one or the other is good or bad, but the difference is utterly startling!

Dave
Technical Details
Message-ID: <2ccea3bf.7@webx.la2eafNXanI>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!uio.no!news.tele.dk!news.tele.dk!small.news.tele.dk!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!webx
References: <2ccea3bf.-1@webx.la2eafNXanI>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f939a,f6998017447264e4
X-Google-Attributes: gidf939a,public
X-Google-ArrivalTime: 2003-11-28 15:07:38 PST
From: Dave_Saunders@adobeforums.com
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!uio.no!news.tele.dk!news.tele.dk!small.news.tele.dk!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!webx
Newsgroups: adobe.scripting.indesign
Subject: Re: Setting Applied Char Style of Nested Style by name
Message-ID: <2ccea3bf.7@webx.la2eafNXanI>
Date: Fri, 28 Nov 2003 14:43:34 -0800
References: <2ccea3bf.-1@webx.la2eafNXanI>
Lines: 37
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit