TextExpander Applescript to Retrieve DT3 Data

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… :thinking:
:wink:

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.

@rkaplan

Here is it in AppleScript…

And this is using the faster retrieval of selected records.

Still undefined

Applescript works fine using same database

Just not Javascript

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

Correct, just I you, @chrillek, and I have shown.

@BLUEFROG - Any solution anticipated?

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 :wink: But DT would have to investigate this in depth.

We have not deprecated or ended support for JXA.