Point the first: yes I know this is all beta stuff and I have read 
http://barebones.com/support/new-os.html#1010 so, I understand that "you + 
flying leap + rolling donut" is an acceptable answer here. I'm just hoping 
enlightenment will occur.

I'm on Yosemite public preview #2, with 10.5.12 (3392).

What I'm trying to do:

Replicate this script: 
http://bbedit-hints.tumblr.com/post/18903617528/applescript-inserting-some-text-as-the-current
 
via Javascript For Automation 
(https://developer.apple.com/library/prerelease/mac/releasenotes/interapplicationcommunication/rn-javascriptforautomation/index.html)

(Actually: I'm really just trying to *get* the selection, and that's 
failing.)

What's happening is:

I have this JS:

    var bbedit = Application('BBEdit');
    var front_doc = bbedit.windows[0].document;
    console.log(front_doc.id())


which works exactly as you'd expect; it prints "11" to the console in 
Script Editor. Looking at the dictionary for BBEdit, and comparing the the 
URL above, I should be able to replace the id() getter with the selection() 
getter.

It fails: Error -1728: Can't get object. (Yes I have selected text in the 
front text document, which I can get - all the text - via the text() 
getter, as expected)

Uh, that's weird. So I try just manually running down the list of items in 
the application scripting dictionary. Some work (eg, id(), name()) and 
others fail with various errors (selection(), buildNumber(), etc).

So here's my question:

I was under the impression that, under the hood, Apple Events were 
language-agnostic. Thus, "tell application BBEdit to set fred to the 
selection" actually compiled to some intermediate representation; it was 
then fed to some IPC dingus (pipe, shared memory - I have no actual idea 
what it is), the targeted app responds with something, and the event loop 
continues.

So, is it possible that the Yoz JavaScript OSA bits are failing to 
correctly compile the code to that IR? I can't imagine BBEdit not being 
crazy conformant to the guts part of OSA.

Or, do differences in the implementation of the JS OSA make the 
20-years-or-whatever-of-applescript OSA dictionary unhappy to suddenly have 
this lol-designed-in-10-days nonsense thrown at it?

Have I discovered a bug? Am I doing something completely insane? 

Like I said: I get that acceptable answers are "dude, beta" or "dude, FIGHT 
CLUB" but I thought I'd ask nonetheless.

-- 
This is the BBEdit Talk public discussion group. If you have a 
feature request or would like to report a problem, please email
"supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: <http://www.twitter.com/bbedit>

--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.

Reply via email to