Re: JXA with VoiceOver Commander
Re: JXA with VoiceOver Commander
- Subject: Re: JXA with VoiceOver Commander
- From: Chi Kim via Accessibility-dev <email@hidden>
- Date: Mon, 5 Jun 2023 08:30:23 -0400
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=BXruuxsmGytV+KMVzt9/uvCNtdavhVSFfdi0E8+unIU=; b=hD/NoQzBheAe8gUGq+UkV61L5/IV1+0DqBaig6kTJTrx9Px9G8KCESsWp11uYHLN6aP5AmWwRA5ahxDkqhwFpNzL4P+Tl2eeXFD0AbGfUtpxtr5IHS3b2P8zrLk1ZQTnNHsgfZoiIbrriEr8vBXMJky51XuTQO05nEtRJRSfHxUCVsbpK1ifmnVyeNjaux8EYBuVyBwOiOAR2t/FtNtDoYxQOvobSYkuJNL1GN79mtOrB8vTSrkXKVVaX1YKtttEzhS/X40f09/JUCSN7+9NKKJ3jGHbrO5OTzwDa7xeZjvBKUfudBzMUm2KU5/N3A0TtsVWgp/ejakw6ayttu2L+Q==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eAcnTKUrP6fgHud4Gl4njopNTiCm/tx+WO6qPJuK6rH5a4gpeGagJCDL0kKJb204Btc+Og7IgJQX+pRohV27z6I8R9QBr+n49+l+zinx77gSmVWHdH+BX5FF9KtjK3Az6lzVAQBowEBKjSiHOXC30FoPwnRlbzWMOQDGS/+QjpZfYlqqJEkFt8mWP4pJv1s2S736NxH9YNVUHqhPNCXVy0q18+zK4PbrdwVoXNzAXA5uHxrTn2Oz0mVZjz2jaH+2Ga3Vh7pLweQV4XDOzRP0NTIT1R1ocyLL0Lp7xmqnAv6nBbZFw6xbrSNs1C6Cq/Myr+hE97/BRRX6B6p9LvZmcw==
Thanks Peter.
I posted on various places, but no one seems to know the answer
unfortunately.
KM Forum:
https://forum.keyboardmaestro.com/t/can-someone-help-me-to-convert-a-very-short-applescript-to-jxa/32200/12
Stackoverflow:
https://stackoverflow.com/questions/76384207/executing-voiceover-command-in-jxa
Apple developer forum: https://developer.apple.com/forums/thread/730855
I even asked Chat GPT-4, and it gave up on combination of JxA and
accessibility. lol
ChatGPT:
JavaScript for Automation (JXA) in macOS is a bit more complex than
AppleScript when it comes to interacting with system applications like
VoiceOver.
Unfortunately, as of my knowledge cutoff in September 2021, it seems
like there's a limitation with JXA where certain system commands,
especially the ones tied to assistive technologies like VoiceOver, might
not work as expected.
The error "Error 6: An error occurred" is a generic message and can come
up in a variety of situations. The issue you're experiencing might be
due to a lack of support for the specific API used by VoiceOver in JXA,
or due to a limitation in the JXA language itself.
As of my last update, the Apple community has not provided a direct
solution for this specific case. It would be best to look for more
recent updates or ask for help in the relevant Apple forums or communities.
I recommend using AppleScript for interacting with system applications
like VoiceOver, as it is more straightforward and less error-prone for
such tasks.
I'm hoping someone here with inside scoop could help. :)
Chi
On 6/1/2023 9:42 PM, Peter N Lewis wrote:
On 2 Jun 2023, at 00:57, Chi Kim via Accessibility-dev
<email@hidden> wrote:
I can't seem to execute Voiceover command with JXA.
The following AppleScript works.
tell application "VoiceOver"
tell commander to perform command "item chooser"
end tell
However, the following script in JXA throws a mystery error.
vo = Application("VoiceOver")
vo.commander.performCommand("item chooser")
Error 6: An error occurred.
I'd really appreciate any help with this!
That looks fine to me, but I'm afraid I am not really a JXA (or AppleScript for
that matter) expert. I suggest you ask on the forum
(https://forum.keyboardmaestro.com/), as there are some JXA experts there who
would likely know the reason.
Peter.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Accessibility-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden