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
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.activeDocumentdoc.allParagraphStyles.each do |style|puts style.nameputs style.properties["appliedFont"].nameputs "~~~~~~~~~~~~~~"endIn my case it returns the following:[No Paragraph Style]Minion Pro Regular~~~~~~~~~~~~~~[Basic Paragraph]Minion Pro Regular~~~~~~~~~~~~~~The available properties are:OTFContextualAlternateOTFDiscretionaryLigatureOTFFigureStyleOTFFractionOTFHVKanaOTFHistoricalOTFJustificationAlternateOTFLocaleOTFMarkOTFOrdinalOTFOverlapSwashOTFProportionalMetricsOTFRomanItalicsOTFSlashedZeroOTFStretchedAlternateOTFStylisticAlternateOTFStylisticSetsOTFSwashOTFTitlingalignToBaselineallowArbitraryHyphenationappliedFontappliedLanguageappliedNumberingListautoLeadingautoTcyautoTcyIncludeRomanbalanceRaggedLinesbasedOnbaselineShiftbulletCharbulletsAlignmentbulletsAndNumberingListTypebulletsCharacterStylebulletsTextAfterbunriKinshicapitalizationcharacterAlignmentcharacterDirectioncharacterRotationcjkGridTrackingcomposerdesiredGlyphScalingdesiredLetterSpacingdesiredWordSpacingdiacriticPositiondigitsTypedropCapCharactersdropCapLinesdropCapStyledropcapDetailendJoinfillColorfillTintfirstLineIndentfontStyleglyphFormgradientFillAnglegradientFillLengthgradientFillStartgradientStrokeAnglegradientStrokeLengthgradientStrokeStartgridAlignFirstLineOnlygridAlignmentgridGyoudorihorizontalScalehyphenWeighthyphenateAcrossColumnshyphenateAfterFirsthyphenateBeforeLasthyphenateCapitalizedWordshyphenateLadderLimithyphenateLastWordhyphenateWordsLongerThanhyphenationhyphenationZoneidignoreEdgeAlignmentimportedindexjidorijustificationkashidaskeepAllLinesTogetherkeepFirstLineskeepLastLineskeepLinesTogetherkeepRuleAboveInFramekeepWithNextkeepWithPreviouskentenAlignmentkentenCharacterSetkentenCustomCharacterkentenFillColorkentenFontkentenFontSizekentenFontStylekentenKindkentenOverprintFillkentenOverprintStrokekentenPlacementkentenPositionkentenStrokeColorkentenStrokeTintkentenTintkentenWeightkentenXScalekentenYScalekerningMethodkeyboardDirectionkinsokuHangTypekinsokuSetkinsokuTypelabellastLineIndentleadingleadingAkileadingModelleftIndentligaturesmaximumGlyphScalingmaximumLetterSpacingmaximumWordSpacingminimumGlyphScalingminimumLetterSpacingminimumWordSpacingmiterLimitmojikuminamenextStylenoBreaknumberingAlignmentnumberingApplyRestartPolicynumberingCharacterStylenumberingContinuenumberingExpressionnumberingFormatnumberingLevelnumberingRestartPoliciesnumberingStartAtobjectReferenceoverprintFilloverprintStrokeparagraphDirectionparagraphGyoudoriparagraphJustificationparentpointSizepositionpositionalFormpreviewColorrensuujirightIndentrotateSingleByteCharactersrubyAlignmentrubyAutoAlignrubyAutoScalingrubyAutoTcyAutoScalerubyAutoTcyDigitsrubyAutoTcyIncludeRomanrubyFillrubyFontrubyFontSizerubyFontStylerubyOpenTypeProrubyOverhangrubyOverprintFillrubyOverprintStrokerubyParentOverhangAmountrubyParentScalingPercentrubyParentSpacingrubyPositionrubyStrokerubyStrokeTintrubyTintrubyTyperubyWeightrubyXOffsetrubyXScalerubyYOffsetrubyYScaleruleAboveruleAboveColorruleAboveGapColorruleAboveGapOverprintruleAboveGapTintruleAboveLeftIndentruleAboveLineWeightruleAboveOffsetruleAboveOverprintruleAboveRightIndentruleAboveTintruleAboveTyperuleAboveWidthruleBelowruleBelowColorruleBelowGapColorruleBelowGapOverprintruleBelowGapTintruleBelowLeftIndentruleBelowLineWeightruleBelowOffsetruleBelowOverprintruleBelowRightIndentruleBelowTintruleBelowTyperuleBelowWidthscaleAffectsLineHeightshataiAdjustRotationshataiAdjustTsumeshataiDegreeAngleshataiMagnificationsingleWordJustificationskewspaceAfterspaceBeforespanColumnMinSpaceAfterspanColumnMinSpaceBeforespanColumnTypespanSplitColumnCountsplitColumnInsideGuttersplitColumnOutsideGutterstartParagraphstrikeThroughColorstrikeThroughGapColorstrikeThroughGapOverprintstrikeThroughGapTintstrikeThroughOffsetstrikeThroughOverprintstrikeThroughTintstrikeThroughTypestrikeThroughWeightstrikeThrustrokeAlignmentstrokeColorstrokeTintstrokeWeighttabListtatechuyokotatechuyokoXOffsettatechuyokoYOffsettrackingtrailingAkitreatIdeographicSpaceAsSpacetsumeunderlineunderlineColorunderlineGapColorunderlineGapOverprintunderlineGapTintunderlineOffsetunderlineOverprintunderlineTintunderlineTypeunderlineWeightverticalScalewarichuwarichuAlignmentwarichuCharsAfterBreakwarichuCharsBeforeBreakwarichuLineSpacingwarichuLineswarichuSizexOffsetDiacriticyOffsetDiacriticThat'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.- Mattp.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.bridgesupportOn Tue, Nov 1, 2011 at 9:42 AM, Spencer Rose <dspencerr@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