I talked with Laurent and it said that the fact that the object type is SBObject is probably done on purpose by the inDesign API.
- Matt On Tue, Nov 1, 2011 at 12:12 PM, Matt Aimonetti <mattaimone...@gmail.com>wrote: > I generated the header file and looked at the description and I think that > the issue us that the returned value isn't cast: > > @property (copy) id appliedFont; // The font applied to the find glyph > preference, specified as either a font object or the name of font family. > Can return: font, string or nothing. > > "id" in Objective-C means refers to an object that isn't typed (could be > anything). That might be the reason why you get an object that isn't cast. > There is a workaround and it's to use the properties hash: > > framework 'Foundation' > framework 'ScriptingBridge' > > app = SBApplication.applicationWithBundleIdentifier('com.adobe.indesign') > load_bridge_support_file 'inDesign.bridgesupport' > doc = app.activeDocument > doc.allParagraphStyles.each do |style| > puts style.name > puts style.properties["appliedFont"].name > puts "~~~~~~~~~~~~~~" > end > > In my case it returns the following: > > [No Paragraph Style] > Minion Pro Regular > ~~~~~~~~~~~~~~ > [Basic Paragraph] > Minion Pro Regular > ~~~~~~~~~~~~~~ > > The available properties are: > OTFContextualAlternate > OTFDiscretionaryLigature > OTFFigureStyle > OTFFraction > OTFHVKana > OTFHistorical > OTFJustificationAlternate > OTFLocale > OTFMark > OTFOrdinal > OTFOverlapSwash > OTFProportionalMetrics > OTFRomanItalics > OTFSlashedZero > OTFStretchedAlternate > OTFStylisticAlternate > OTFStylisticSets > OTFSwash > OTFTitling > alignToBaseline > allowArbitraryHyphenation > appliedFont > appliedLanguage > appliedNumberingList > autoLeading > autoTcy > autoTcyIncludeRoman > balanceRaggedLines > basedOn > baselineShift > bulletChar > bulletsAlignment > bulletsAndNumberingListType > bulletsCharacterStyle > bulletsTextAfter > bunriKinshi > capitalization > characterAlignment > characterDirection > characterRotation > cjkGridTracking > composer > desiredGlyphScaling > desiredLetterSpacing > desiredWordSpacing > diacriticPosition > digitsType > dropCapCharacters > dropCapLines > dropCapStyle > dropcapDetail > endJoin > fillColor > fillTint > firstLineIndent > fontStyle > glyphForm > gradientFillAngle > gradientFillLength > gradientFillStart > gradientStrokeAngle > gradientStrokeLength > gradientStrokeStart > gridAlignFirstLineOnly > gridAlignment > gridGyoudori > horizontalScale > hyphenWeight > hyphenateAcrossColumns > hyphenateAfterFirst > hyphenateBeforeLast > hyphenateCapitalizedWords > hyphenateLadderLimit > hyphenateLastWord > hyphenateWordsLongerThan > hyphenation > hyphenationZone > id > ignoreEdgeAlignment > imported > index > jidori > justification > kashidas > keepAllLinesTogether > keepFirstLines > keepLastLines > keepLinesTogether > keepRuleAboveInFrame > keepWithNext > keepWithPrevious > kentenAlignment > kentenCharacterSet > kentenCustomCharacter > kentenFillColor > kentenFont > kentenFontSize > kentenFontStyle > kentenKind > kentenOverprintFill > kentenOverprintStroke > kentenPlacement > kentenPosition > kentenStrokeColor > kentenStrokeTint > kentenTint > kentenWeight > kentenXScale > kentenYScale > kerningMethod > keyboardDirection > kinsokuHangType > kinsokuSet > kinsokuType > label > lastLineIndent > leading > leadingAki > leadingModel > leftIndent > ligatures > maximumGlyphScaling > maximumLetterSpacing > maximumWordSpacing > minimumGlyphScaling > minimumLetterSpacing > minimumWordSpacing > miterLimit > mojikumi > name > nextStyle > noBreak > numberingAlignment > numberingApplyRestartPolicy > numberingCharacterStyle > numberingContinue > numberingExpression > numberingFormat > numberingLevel > numberingRestartPolicies > numberingStartAt > objectReference > overprintFill > overprintStroke > paragraphDirection > paragraphGyoudori > paragraphJustification > parent > pointSize > position > positionalForm > previewColor > rensuuji > rightIndent > rotateSingleByteCharacters > rubyAlignment > rubyAutoAlign > rubyAutoScaling > rubyAutoTcyAutoScale > rubyAutoTcyDigits > rubyAutoTcyIncludeRoman > rubyFill > rubyFont > rubyFontSize > rubyFontStyle > rubyOpenTypePro > rubyOverhang > rubyOverprintFill > rubyOverprintStroke > rubyParentOverhangAmount > rubyParentScalingPercent > rubyParentSpacing > rubyPosition > rubyStroke > rubyStrokeTint > rubyTint > rubyType > rubyWeight > rubyXOffset > rubyXScale > rubyYOffset > rubyYScale > ruleAbove > ruleAboveColor > ruleAboveGapColor > ruleAboveGapOverprint > ruleAboveGapTint > ruleAboveLeftIndent > ruleAboveLineWeight > ruleAboveOffset > ruleAboveOverprint > ruleAboveRightIndent > ruleAboveTint > ruleAboveType > ruleAboveWidth > ruleBelow > ruleBelowColor > ruleBelowGapColor > ruleBelowGapOverprint > ruleBelowGapTint > ruleBelowLeftIndent > ruleBelowLineWeight > ruleBelowOffset > ruleBelowOverprint > ruleBelowRightIndent > ruleBelowTint > ruleBelowType > ruleBelowWidth > scaleAffectsLineHeight > shataiAdjustRotation > shataiAdjustTsume > shataiDegreeAngle > shataiMagnification > singleWordJustification > skew > spaceAfter > spaceBefore > spanColumnMinSpaceAfter > spanColumnMinSpaceBefore > spanColumnType > spanSplitColumnCount > splitColumnInsideGutter > splitColumnOutsideGutter > startParagraph > strikeThroughColor > strikeThroughGapColor > strikeThroughGapOverprint > strikeThroughGapTint > strikeThroughOffset > strikeThroughOverprint > strikeThroughTint > strikeThroughType > strikeThroughWeight > strikeThru > strokeAlignment > strokeColor > strokeTint > strokeWeight > tabList > tatechuyoko > tatechuyokoXOffset > tatechuyokoYOffset > tracking > trailingAki > treatIdeographicSpaceAsSpace > tsume > underline > underlineColor > underlineGapColor > underlineGapOverprint > underlineGapTint > underlineOffset > underlineOverprint > underlineTint > underlineType > underlineWeight > verticalScale > warichu > warichuAlignment > warichuCharsAfterBreak > warichuCharsBeforeBreak > warichuLineSpacing > warichuLines > warichuSize > xOffsetDiacritic > yOffsetDiacritic > > That's probably enough info for you to use ;) > > " My current project requires a JPEG >> export and an IDML (InDesign's package XML for 3rd parties) export and I >> cannot get the Dictionary standard "exports" to work." > > > Can you explain a bit more about what you call the standard exports to > work? I *might* be able to help. > > I had started writing a very simple parser for the sdef header file, but I > never finished the project nor released my code since nobody seemed to need > it. > It would certainly be nice to have the equivalent of AppleScript Editor's > dictionary viewer but with the MacRuby method names. It shouldn't be hard > to do, but I really don't have much time to work on it at the moment. If > anyone is interested, please let me know, I can assist you. > > - Matt > > p.s: To generate the bridgesupport file I run the following commands: > $ sdef /Applications/Adobe\ InDesign\ CS5.5/Adobe\ InDesign\ CS5.5.app/ | > sdp -fh --basename inDesign > $ gen_bridge_metadata -c '-I.' inDesign.h > inDesign.bridgesupport > > > > On Tue, Nov 1, 2011 at 9:42 AM, Spencer Rose <dspenc...@gmail.com> wrote: > >> >> >> Hey Matt, >> >> Thanks for the response. I had already read and done the tutorial there. >> It was very helpful. >> >> The problem is not so much the weakness of Scripting Bridge, it is the >> difficulty in knowing all of the method calls and their syntax available >> from InDesign. >> >> Following an earlier thread in here i used "myIndesign.methods(true,true)" >> and now have a list of methods, but that list is completely devoid of >> really >> import actions like "open" & "export" and the documentation in the >> Scripting >> Dictionary for InDesign which I have been using for Javascript & Apple >> Script >> does not translate straight across. The code I used to start >> experimenting >> with speaking directly to the InDesign DOM and getting its info was as >> follows: >> @id = >> SBApplication.applicationWithBundleIdentifier('com.adobe.indesign') >> doc = @id.activeDocument >> >> pgph = doc.allParagraphStyles >> >> pgph.each do |style| >> puts "#{style.name}" >> puts style.appliedFont >> end >> >> I get the name of the Paragraph Style, but the appliedFont just prints an >> SBObject. >> >> This is a really small example, but is the basis for my work because I >> will need >> to get font names, styles, kerning, margins, the text of stories and >> coordinates >> of text boxes and a lot more information. My current project requires a >> JPEG >> export and an IDML (InDesign's package XML for 3rd parties) export and I >> cannot get the Dictionary standard "exports" to work. I really like >> macRuby and >> have totally jumped on it. Your book is awesome and has helped a ton. >> But I worry that it is not sufficiently evolved for me to use it >> on a project needing this level of control and access to InDesign >> >> Thanks in advance, Spencer >> >> _______________________________________________ >> MacRuby-devel mailing list >> MacRuby-devel@lists.macosforge.org >> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel >> > >
_______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel