BridgeSupport (objC header file) simple parser
On my way down to RubyConf Argentina I wrote these few lines of code to parse the Objective-C header generated by the sdef/sdp commands into a Ruby object that I then dump to JSON. https://gist.github.com/1349038 Usage: $ ./bridgesupport_doc_parser.rb ~/tmp/inDesign.h Feel free to build whatever you want with this (very basic) code, in theory, it shouldn't be hard to write a small app showing the API provided by a 3rd party app. - Matt
Thanks for doing this Matt. I have not fallen off the earth on this one. :) Trying to do a lot of research and figure this thing out. InDesign's scripting API is complicated enough, but the way ScriptingBridge works with it is making me work hard. Annoying that running these two commands in the following languages gives me the following discrepant results; Javascript In Extend Script Editor: app.selection[0].contents -> results in the text of whatever is selected (eg.. line or word or paragraph) Ruby run at Terminal puts app.selection[0].contents -> <SBObject:0x209373520> Once again, that SBObject is not incredibly helpful. I appreciate the parser and will definitely start posting a lot of what I find as I have some success dissecting the Scripting calls. Spence
My guess is that JS automatically converts the object in its string representation while in Ruby, you get the real object and you have to call a method on it. I agree that this isn't great and I'm not a BridgeSupport/ScriptingBridge expert so I can't tell you if that's something wrong on SB side or Adobe's. Good luck, - Matt On Fri, Nov 11, 2011 at 4:13 PM, Spencer Rose <dspencerr@gmail.com> wrote:
Thanks for doing this Matt. I have not fallen off the earth on this one. :) Trying to do a lot of research and figure this thing out. InDesign's scripting API is complicated enough, but the way ScriptingBridge works with it is making me work hard. Annoying that running these two commands in the following languages gives me the following discrepant results;
Javascript In Extend Script Editor: app.selection[0].contents -> results in the text of whatever is selected (eg.. line or word or paragraph)
Ruby run at Terminal puts app.selection[0].contents -> <SBObject:0x209373520> Once again, that SBObject is not incredibly helpful.
I appreciate the parser and will definitely start posting a lot of what I find as I have some success dissecting the Scripting calls.
Spence
_______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
participants (2)
-
Matt Aimonetti
-
Spencer Rose