It basically says that there is no selection. Which is really weird. Maybe @cgrunenberg has an idea?
Iām seeing the same issue here, so youāre not going nutsā¦ wellā¦
With a small variationā¦
The only thing I see we changed in regard to processing a selection, was the addition of the selected records
property for faster attribute retrieval.
Thank you both @BLUEFROG and @chrillek - very interesting issue.
I can see some definite. benefits to having the option to use either Applescript or Javascript
So why does this work in some situations but not others???
Try console.log(n.name())
(with the parenthesis instead).
The weird thing here is that for @rkaplan it doesnāt work with selectedRecords
nor with selection()
. Whereas for me (and apparently for you) both are ok.
The undefined is normal since thereās no return value. You must check the output.
Regardless, I suppose that youāll still see 0 for the length there. DT has to clear that up.
Output remains blank for all the Javascript trials
Thanks
No, as (1) the JavaScript support isnāt something weāve built in, and (2) the AppleScript is functioning as expected.
The support (if it works) is automatic, not built by the developer? (If you support Applescript, Javascript in theory works with no changes?)
How can it be that the same script works for some installations but not others? That seems odd.
Exactly.
So we conclude Apple has basically deprecated or ended support for JXA even though not officially announced?
Not Apple
Devon Technologies
Given that JS should automatically work just like AppleScript, it would be nice if it actually worked reliably. And if a perfectly simple JS works on in some situations but not in others, it would be nice if this fact would receive a bit more attention.
Iām aware that historically AS is dear and near to the heart of many people here. But frankly: It is a dying language. Apple does not do work on it anymore, and outside of the AppleVerse nobody is using it. It is not up to par with any current technology like HT/XML or even old stuff like regular expressions. Even itās normal text processing capabilities are light years behind, not to mention array methods, introspection, functions as first level citizens. It goes on and on.
On the other hand, JavaScript is the only scripting language available across all Apple platforms. There is no AS support on iOS or iPadOS. So if DT wants to ever provide anything like scripting support on i*OS, it would have to be with JavaScript. Which in turn means that it should become a first class citizen, not relegated to the 2nd or 3rd place.
Yes, Iām aware that Apple has more or less abandoned any development on JXA. On the other hand, it just announced that itās going to offer shortcuts on MacOS 12. They work cross platform, and they can be programmed with (for example) Scriptable. In JavaScript, no less.
And Iām not advocating to drop AppleScript at all. Just to acknowledge that there is another scripting language available that can do the same things as AS and then some more. It should receive the same support in DT as AS. Just as in Hazel, for example.
Since it now āworksā on one Mac DT3 installation but not on others, that suggests to me there might be some workaround possible if we at least knew why that behavior is inconsistent. Maybe it is an Apple issue; maybe it is a DevonTech issue. Do we really know for sure?
In my mind, it works on @BLUEFROGās and my installation. At least @BLUEFROG got a selection. So itās 2:1 But DT would have to investigate this in depth.
We have not deprecated or ended support for JXA.