![]() Maybe it would be worth asking about on Apple’s AppleScript-Users mailing list? I can’t guarantee a response, of course, but some of the developers who work on JXA do seem to answer questions about it there from time to time-and I suspect they’re the only people who are in a position to be able to authoritatively answer this question. I tried searching the documentation, rereading the release notes for JXA from 10.10 and 10.11, and reviewing the WWDC 2014 session, but didn’t find any definitive answer about setting a property from JXA for an object specifier representing multiple objects. This fails with Error -10002: Invalid key form. I see the same thing when scripting TextEdit: app = Application("TextEdit")ĭoc.() // Returns, , ] That said, it looks to me like this problem is a limitation of JXA, unless there’s just something we’re both missing. (They replied that afternoon letting you know they’d filed the issue, hopefully you at least saw that reply?) Sorry, sounds like there was a misunderstanding about what you were expecting! Looks like they took your message to be a bug report, not a question, and filed it as such to see if there is anything we can fix in the app to make this work. whose()) allow us to set a property value across those collections ?Įmailed this question to Support a week ago, but haven’t heard back. setProperty() method on collections like. Or to put it another way, what type of arguments to the. What would be the correct syntax to batch-set the color of all lines on an OmniGraffle 6 layer ? We get an error, and the properties are not set. If we try the obvious translation: Application('OmniGraffle') (across a reference to a filtered collection of objects, without the much slower fetching of all objects and iterating through them, setting properties object by object) The question is, what is the JavaScript for Automation translation for setting a property like this ? ![]() To make all the referenced lines blue, for example, we can write, in AppleScript: tell application "OmniGraffle" ,, ,, , ]Įven more usefully, osascript allows for batch- setting of a property across a collection. The JXA translation of this for batch- reading properties would be: Application('OmniGraffle') In Applescript, to batch- read the colors of all lines on a layer, for example, we can write: tell application "OmniGraffle" Osascript economises on Apple Event traffic and performs less sluggishly if we work with references to sets/collections of objects, batch-reading and batch- setting properties across these sets, rather than fetching and reading/mutating one object at a time.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |