Re: VoiceOver error using accessible_output2

2020-11-06 Thread AudioGames . net Forum — Developers room : TJ . Breitenfeldt via Audiogames-reflector


  


Re: VoiceOver error using accessible_output2

Hi, so first thing I will say is that it was a bit harsh to say that the code was a mess, it is not actually that bad once I got a grasp on what is going on.I tested my theory about filtering the class instances for the outputs array in auto down to just those screen readers that are available on that platform, you were right Camlorn, it had no effect on the delay. I did figure out the issue though.It seems that the is_active method for VoiceOver is causing the delay. I tested this just by creating an instance of VoiceOver in my little pyglet example, called v.is_active() followed by the playing of a sound, and I am definitely getting the delay that is observed when using the Auto class. This is the code I used to test with:import pygletfrom pyglet.window import Window, keyfrom accessible_output2.outputs.voiceover import VoiceOverwindow = Window(caption="Test")v = VoiceOver()sound = pyglet.media.load("d4.wav")@window.eventdef on_key_press(symbol, modifiers):    if symbol == key.V:        v.is_active()        sound.play()pyglet.app.run()It seems that there is some long process that is occurring when checking if VoiceOver is running using the apple script. I pasted in the method in question from above plus the minor sintax fix also mentioned above. I do not know apple script, so I am not exactly sure what is happening here beyond the obvious, perhaps there is a better way to check if a process is running that can be used. def is_active(self):  return self.runAppleScript('return (name of processes) contains "VoiceOver"', 'system events').startswith(b'true') and not self.runAppleScript('try\nreturn bounds of vo cursor\non error\nreturn false\nend try').startswith(b'false')Ideas?

URL: https://forum.audiogames.net/post/587320/#p587320




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: VoiceOver error using accessible_output2

2020-11-06 Thread AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector


  


Re: VoiceOver error using accessible_output2

I don't have ideas, but all of Q's apps for Windows were accessible_output2 and it wasn't a problem on Windows.  I would expect any class not supported on the current platform to just return false immediately; it'd only really be expensive if they're deciding to do something IPC to check of Jaws is running on Mac or something, which is literally impossible.  Until proven otherwise, and bearing in mind that I haven't read the code, I blame Voiceover here.  Say what you want about accessible_output2 or Q, but it did get literally years of production-quality coverage.And I know that we have to stick to these hacky libraries, but my point is that when we try to get it from the first party platforms we can't justify it, and that's why we don't have it.

URL: https://forum.audiogames.net/post/587261/#p587261




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: VoiceOver error using accessible_output2

2020-11-06 Thread AudioGames . net Forum — Developers room : TJ . Breitenfeldt via Audiogames-reflector


  


Re: VoiceOver error using accessible_output2

Thank you Camlorn for the clarification. That is interesting, I am not that familiar with the low level accessibility APIs on Windows or Linux, so I appreciate the insite.The reality is that we are going to just have to continue moving forward with hackery libraries like accessibility_output2 to get our speech output unless like you mentioned someone who has enough knowledge cares to create a system that works better.Anyways, I had a chance to sit down and take a look at the Auto class for accessible_output2 and the first thing that jumps out at me is that it looks like Auto is collecting a list of all of the class instances found in the python modules in accessible_output2.outputs. This list is held in memory as a class level variable in Auto at instantiation time. This means that If you are on Windows, you are holding a reference for ESpeak, VoiceOver, and any other screen reader objects that are not relevant to that platform. This is important because when you go to call output, it is looping through that list of class instances and checking every single one if it is active or not. This just seems inefficient to me, to be checking for screen readers that are on other platforms. You might switch from JAWS to NVDA mid game, but it is impossible to switch platforms mid game, at least it would be so rediculus to do that it is not a case that should be checked for. I don't know if this is what is causing the delay on Mac, although I might see if I can fittle with the code to test this.If I am understanding this incorrectly please tell me. The other thing to mention here is that I believe that the class instances are being sorted, I think alphabetically, in which case VoiceOver is going to be last in the list every time. So you call output, and is_active is called on every screen reader class before it reaches VoiceOver. To maintain this design, we could just add an additional variable at the bottom of each output class  which declares the platform this screen reader runs on. Honestly it looks kind of messy, but I don't have a alternative design in mind right now. Any ideas on this?Timothy Breitenfeldt

URL: https://forum.audiogames.net/post/587249/#p587249




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: VoiceOver error using accessible_output2

2020-11-06 Thread AudioGames . net Forum — Developers room : TJ . Breitenfeldt via Audiogames-reflector


  


Re: VoiceOver error using accessible_output2

Thank you Camlorn for the clarification. That is interesting, I am not that familiar with the low level accessibility APIs on Windows or Linux, so I appreciate the insite.The reality is that we are going to just have to continue moving forward with hackery libraries like accessibility_output2 to get our speech output unless like you mentioned someone who has enough knowledge cares to create a system that works better.Anyways, I had a chance to sit down and take a look at the Auto class for accessible_output2 and the first thing that jumps out at me is that it looks like Auto is collecting a list of all of the class instances found in the python modules in accessible_output2.outputs. This list is held in memory as a class level variable in Auto at instantiation time. This means that If you are on Windows, you are holding a reference for ESpeak, VoiceOver, and any other screen reader objects that are not relevant to that platform. This is important because when you go to call output, it is looping through that list of class instances and checking every single one if it is active or not. This just seems inefficient to me, to be checking for screen readers that are on other platforms. You might switch from JAWS to NVDA mid game, but it is impossible to switch platforms mid game, at least it would be so rediculus to do that it is not a case that should be checked for. I don't know if this is what is causing the delay on Mac, although I might see if I can fittle with the code to test this.Any ideas on this?Timothy Breitenfeldt

URL: https://forum.audiogames.net/post/587249/#p587249




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: VoiceOver error using accessible_output2

2020-11-04 Thread AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector


  


Re: VoiceOver error using accessible_output2

@20NSAccessibility is the accessibility API on mac, the thing that apps which want to expose information to voiceover implement.  When I say it lags behind I mean that the iOS equivalent--confusingly named UIAccessibility--generally gets more features faster.  it's the same as Voiceover itself--iOS always runs far ahead of Mac.Live regions are, well, live regions.  As in Aria live regions, the thing that lets divs or whatever in a browser send messages to screen readers when they change.  That's something you can implement as a UI toolkit etc. without being in a browser, because all the browser stuff actually just maps to the accessibility API of the platform nowadays: you get a window up and running, you do whatever the specific platform wants to hook an accessibility API provider into the window (which sadly can't usually be done through something like SDL), you start sending the right events and you can get screen readers saying whatever you want them saying.  This is the officially correct way to talk to a screen reader in the fashion you want.  Too hard to do for any audiogame to bother, but when this lands on the desk of someone at Microsoft or Apple as a feature we want, the answer they've got on their end is "but we offer enough that browsers can do aria live regions, why implement this hack".  especially since for at least UIA, it's in theory nothing more than getting a UIA provider and calling one extra function (but that's Windows, and my knowledge is theoretical, not practical, so not helpful here. But mac shouldn't be much harder).  The problem is that audiogames don't generally have control over the window at the level necessary to do this.Windows Narrator has the same issue, however, at least so far as I know.  You can't talk to it directly.  You've got to go through alive region or equivalent implemented with the accessibility API.  On Windows, this is actually provided by Microsoft if you're using C#: you can just tag things in xaml and when they change a screen reader will announce it.  But the difference is that on Windows, almost no one uses Narrator as their main screen reader yet, so even though this is a problem, it's not one in practice for the time being.  But Narrator is actually pretty good now: if it came down to the wire and I had no other choice, I could probably code with it if I had to.  So that may not be so theoretical for much longer.

URL: https://forum.audiogames.net/post/586627/#p586627




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: VoiceOver error using accessible_output2

2020-11-04 Thread AudioGames . net Forum — Developers room : TJ . Breitenfeldt via Audiogames-reflector


  


Re: VoiceOver error using accessible_output2

At Camlorn, what is a live region in this context?Also, when you say NSAccessibility, are you refering to NSSpeechSynthesizer? What do you mean by it lags behind?At least the apple script code is working, and perhaps refactoring the Auto class can help improve the performance. It seems crazy to me that the problem is in the fact that we are probably forking the process twice as mentioned by #13. There is probably a 3 or 4 second delay, and it is hard for me to imagine that forking is taking that long. I have not dug into the code, I need to wrap up another project I am working on, but I am going to confirm what the issue is.

URL: https://forum.audiogames.net/post/586609/#p586609




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: VoiceOver error using accessible_output2

2020-11-04 Thread AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector


  


Re: VoiceOver error using accessible_output2

You can't talk directly to Voiceover as far as I know.  This is a thing that Apple doesn't allow on desktops, I think.  There are ways to do it, but only if you are hosting a window with enough control to implement live regions.  I know iOS got a function for it, but NSAccessibility lags behind last I checked.  I looked into doing something like this maybe 6 months ago.The say utility is just a horribly inefficient way to talk to the TTS API with no special VO integration, as far as I know.The thing about the APIs for this on Windows is that what happened is that Jaws semi-officially offered it via mostly undocumented interfaces in the early 2000s when accessibility APIs were barely a thing, back when Microsoft just didn't bother.  Then everyone blind started using them because hey, it's easier than making a proper accessible GUI.  NVDA actually required overwhelming demand to add it.  Point being that from the perspective of first party devs, it's a giant hack and you should just implement a live region.  This is one of the reasons I'm personally against trying to use SDL or whatever to make a self-voicing interface.  Not a significant enough reason on its own, but we are effectively saying "hey, I know, how about we reimplement a screen reader instead", which will just always be frowned on for obvious reasons.  Sadly there's not a good alternative, not unless I get a lot more bandwidth for projects and the sudden burning desire to spend a couple thousand dollars on a platform I loathe, or one of the very few other people takes on that bigger project.

URL: https://forum.audiogames.net/post/586574/#p586574




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: VoiceOver error using accessible_output2

2020-11-04 Thread AudioGames . net Forum — Developers room : TJ . Breitenfeldt via Audiogames-reflector


  


Re: VoiceOver error using accessible_output2

Okay, so I did some research into existing libraries. From what I found, Camlorn is kind of right. However, most of the libraries out there that I could find are all using the say utility, which as mentioned before uses a separate instance  of VoiceOver for speech output not the running instance. I think that including the Say utility in accessible_output2 is benificial in the same way that having support for SAPI is benificial on Windows. I remember that accessible_output2 used to have support for the say utility, but it got stripped out for some reason. It is not ideal though, and really what I want is to be able to talk to the currently running instance of VoiceOver like what is done with JAWS and NVDA. I believe it is possible especially since that is what the apple script is doing.I took a second look at the previous posts, and took a look at the link that #14 posted:https://developer.apple.com/documentati … ynthesizerThis might be what we want. I looked into existing python libraries for this and found this link:https://python.hotexamples.com/examples … mples.htmllooks like the key library is AppKit, and python does have existing support for this. I found this stack overflow thread about installing it:https://stackoverflow.com/questions/472 … med-appkitI am not sure if NSSpeechSynthesizer will actually talk to the running instance of VoiceOver, but I think it is a start.I have not tried it yet, I just wanted to post my findings since I won't be able to get to this right away.Timothy Breitenfeldt

URL: https://forum.audiogames.net/post/586538/#p586538




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: VoiceOver error using accessible_output2

2020-11-03 Thread AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector


  


Re: VoiceOver error using accessible_output2

If you just want to talk to the OS X TTS API rather than talk to Voiceover via automation, there are almost certainly at least 5 Python libraries for that.  There should be no need for a C extension, nor a need to write anything new at all.If you did need to talk to the Apple APIs though, you probably can't use Cython or Cffi until you've written an Objective-C to C translation that those tools can talk to; the OS X ABI is effectively "whatever Objective-C does" which is fine except for the part where Objective-C isn't quite doing method calls, it's doing a bunch of magical message dispatch stuff.  Technically there's a way to talk to it from C but it's involved, not really documented, and the kind of thing where just writing something in Objective-C that exposes 4 or 5 C functions is going to be easier.I believe accessible_output2 is using Apple Script, or whatever it's called.  I'd not be surprised if the auto thing has to do a bunch of marshalling and stuff that's latent.  I guess good on Apple for finally fixing VO lag enough that we can notice; back when Q's apps mattered, I don't remember anyone complaining about it.To be honest my approach for Mac for future projects is most likely going to be "sorry, use a Windows VM" and threads like this are why.

URL: https://forum.audiogames.net/post/586225/#p586225




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: VoiceOver error using accessible_output2

2020-11-03 Thread AudioGames . net Forum — Developers room : Hijacker via Audiogames-reflector


  


Re: VoiceOver error using accessible_output2

Why not use Cython to write something that does exactly what you need? Cython after all glues C and Python together, that sounds exactly like a task you can achieve that way.

URL: https://forum.audiogames.net/post/586216/#p586216




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: VoiceOver error using accessible_output2

2020-11-03 Thread AudioGames . net Forum — Developers room : TJ . Breitenfeldt via Audiogames-reflector


  


Re: VoiceOver error using accessible_output2

That thought has crossed my mind. If we can just get a C library written that talks directly to VoiceOver, we should be able to improve efficiency, as well as future proof the accessible_output2. Unfortunately I do not have the expertise in C to feel comfortable doing this well myself. I hope that someone else does. I would be willing to learn, although it would take me time to refresh my C skills.

URL: https://forum.audiogames.net/post/586188/#p586188




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: VoiceOver error using accessible_output2

2020-11-03 Thread AudioGames . net Forum — Developers room : bgt lover via Audiogames-reflector


  


Re: VoiceOver error using accessible_output2

OK, so I did some research on this my self when I had problems with it. yeah, apple is going to disallow many things in the future, as they always did since the beginning of time...anyway, I'd suggest you write some C lib to access the mac OS speech API directly, as it needs to work with objective C. note: you can also use swift for that, but really DK how swift handles exported functions, it needs to leave the names unaltered, a.k.a unmangled.afterwards, you have to use the C/swift lib you just made in conjunction with ctypes in order to expose a python class which you then can hook upto accessible_output2, instead of that broken one.I don't have a mac anymore, otherwise I would be able to do something, at least with vs code, as I didn't use XCode directly even back then.anyway, the most important link is thishttps://developer.apple.com/documentati … ynthesizerif you can convert this from objective C to a C lib, or perhaps even make a python extenssion, then I think you will be able to fix this once and forever.

URL: https://forum.audiogames.net/post/586109/#p586109




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: VoiceOver error using accessible_output2

2020-11-02 Thread AudioGames . net Forum — Developers room : Hijacker via Audiogames-reflector


  


Re: VoiceOver error using accessible_output2

OK, so I'd expect the delay to be a result of the fact that your VoiceOver class forks a subprocess whenever you're trying to check its existence or start or stop speech. Forking a process, although being rather fast on Linux and Mac compared to Windows, is still a rather slow process. When using Auto(), i'm pretty sure that the system checks the existence of the currently selected output engine before actually outputting something, meaning that it calls subprocess.Popen() atleast two times for every string output via VoiceOver. When using the VoiceOver class directly, that gets reduced to 1, significantly speeding up the process, although it will still be slow compared to almost any other screen reader.

URL: https://forum.audiogames.net/post/585887/#p585887




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: VoiceOver error using accessible_output2

2020-11-02 Thread AudioGames . net Forum — Developers room : TJ . Breitenfeldt via Audiogames-reflector


  


Re: VoiceOver error using accessible_output2

Okay, so I discovered a couple things, it seems that there is an issue with how Auto is working in accessible_output2 since it is causing the delay I mentioned. When I use the VoiceOver object there is no delay.So, I first setup a simple pyglet program like suggested, and just played a sound on key press. There is no issue there, the sound plays just fine with VoiceOver on without any delay.  so, I setup the accessible_output2  Auto object to speak on key press, and I got the delay that I was experiencing before. I also tried the VoiceOver object, and was surprised to find that I got no delay on speech. So, it seems that there is some delay that is occurring when Auto is used, my guess is the process of determining the running screen reader.This is the code I am using to test this:import pygletfrom pyglet.window import Window, keyfrom accessible_output2.outputs.auto import Autofrom accessible_output2.outputs.voiceover import VoiceOverwindow = Window(caption="Test")a = Auto()v = VoiceOver()@window.eventdef on_key_press(symbol, modifiers):    if symbol == key.A:        a.speak("This is auto speaking")    elif symbol == key.V:        v.speak("this is voice over speaking")pyglet.app.run()I am also getting some strange error when I run my pyglet programs on Mac, although I do not think it is related to accessible_output2 since I was getting it before I imported AO2.2020-11-02 18:37:58.898 Python[3461:81338] ApplePersistenceIgnoreState: Existing state will not be touched. New state will be written to (null)

URL: https://forum.audiogames.net/post/585837/#p585837




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: VoiceOver error using accessible_output2

2020-11-02 Thread AudioGames . net Forum — Developers room : TJ . Breitenfeldt via Audiogames-reflector


  


Re: VoiceOver error using accessible_output2

Hi, thanks for the advice, I am going to give that a shot testing with just an audio file. Do you have any suggestions for alternatives to VoiceOver? I know that there is a say command, I know that there used to be a class in accessible_output2 to leverage the say command, which seems to use a separate instance of VoiceOver from what I remember? That way VoiceOver should not be causing problems with key events if that is what is going on.

URL: https://forum.audiogames.net/post/585821/#p585821




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: VoiceOver error using accessible_output2

2020-11-02 Thread AudioGames . net Forum — Developers room : cartertemm via Audiogames-reflector


  


Re: VoiceOver error using accessible_output2

Try temporarily switching your event responses to something else, even if that's just calling afplay on a simple sound. Make sure VO is disabled while testing.Apple is a shitshow for reasons that have been stated in other topics many times before, but to add another to the pile there's an issue with QuickNav and keyboard events. I recommend actively discouraging the use of Voiceover. Any support you have for it shouldn't function as more than a fallback method. I've gone so far as to get in the habit of warning users when I notice it running. Just more trouble than it's worth at this point, and so long as your UI doesn't suck and you add rate/pitch control, I doubt users will complain too much.

URL: https://forum.audiogames.net/post/585745/#p585745




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: VoiceOver error using accessible_output2

2020-11-02 Thread AudioGames . net Forum — Developers room : TJ . Breitenfeldt via Audiogames-reflector


  


Re: VoiceOver error using accessible_output2

Thanks #8, I did not know there was another Github repository for accessible_output2. I will see about opening an issue for this.I tried your suggestion with startsWith(b"true") etc... and it worked.The one issue I am having now is a a terrible delay when I go to run my application. To be more specific, I am working on a audio_ui library. Basicly, I want user interface components, but audio only. I got a pretty good working version on Windows working with NVDA and JAWS, just trying to make it work with VoiceOver.I am using pyglet, so I am not sure if the problem is that there is a delay in pyglet sending the keypresses to the OS, or if it is VoiceOver lagging for some reason. Otherwise, it is working perfectly.Any suggestions on the lag that I am experiencing?Timothy Breitenfeldt

URL: https://forum.audiogames.net/post/585740/#p585740




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: VoiceOver error using accessible_output2

2020-11-02 Thread AudioGames . net Forum — Developers room : cartertemm via Audiogames-reflector


  


Re: VoiceOver error using accessible_output2

I've been trying to get people (accessiware and others) to use the official repositories that have been around for over a year now, with full commit history intact. It's right here.Feel free and open an issue with your findings. I can't promise a hotfix right at this second - school and work aren't giving me the time I'd like, but maybe someone else can.The solution to #7 should be pretty simple though. Try changing*.startswith("true")and*.startswith("false")to*.startswith(b"true")and*.startswith(b"false")

URL: https://forum.audiogames.net/post/585723/#p585723




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: VoiceOver error using accessible_output2

2020-11-02 Thread AudioGames . net Forum — Developers room : TJ . Breitenfeldt via Audiogames-reflector


  


Re: VoiceOver error using accessible_output2

Hi, sorry to double post, although I just learned that that VoiceOver class with the embedded apple script only works when you are using it by itself, when you use auto, you get an error:```Python 3.8.6 (v3.8.6:db455296be, Sep 23 2020, 13:31:39) [Clang 6.0 (clang-600.0.57)] on darwinType "help", "copyright", "credits" or "license" for more information.>>> from accessible_output2.outputs.auto import Auto >>> s = Auto()>>> s.speak("hello world")Traceback (most recent call last):  File "", line 1, in   File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/accessible_output2/outputs/auto.py", line 25, in speak    output = self.get_first_available_output()  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/accessible_output2/outputs/auto.py", line 20, in get_first_available_output    if output.is_active():  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/accessible_output2/outputs/voiceover.py", line 31, in is_active    return self.runAppleScript('return (name of processes) contains "VoiceOver"', 'system events').startswith('true') and not self.runAppleScript('try\nreturn bounds of vo cursor\non error\nreturn false\nend try').startswith('false')TypeError: startswith first arg must be bytes or a tuple of bytes, not str>>> ```Looks like it is some apple script issue. I am not sure who wrote the apple script, I am having an issue trying to look at the commits for the accessible_output2 repository. I all I am seeing is the most recent commit. I know it was transferred fover from another versioning system, so perhaps we are missing the commit history .Timothy Breitenfeldt

URL: https://forum.audiogames.net/post/585696/#p585696




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: VoiceOver error using accessible_output2

2020-11-02 Thread AudioGames . net Forum — Developers room : TJ . Breitenfeldt via Audiogames-reflector


  


Re: VoiceOver error using accessible_output2

Hi, at #5, yes, I have the setting enabled to allow voiceover to be controlled by apple script. I posted all of my findings below.Well, this is interesting, although I don't think this would be a cause for the error that is being thrown. I did not know that Apple was looking at getting rid of the runtime scripting environmentshttps://tidbits.com/2019/06/25/apple-to … -of-macos/Oh, here we go, the first problem is this dependency appscript, which is being used to link into Voiceover is not supported any morehttp://appscript.sourceforge.net/Last time I looked at accessible_output2 in the VoiceOver class, apple script was embedded into the python code to control the output of VoiceOver, the problem I remember with that was you had to enable apple script control in the VoiceOver settings like #5 mentioned.I am guessing that someone refactored to using appscript to get around this issue, but either was not paying attention, or recently appscript is not supported.I feel like in the past year I was able to use accessible_output2 on Mac without much trouble, although I think to make it work I had to enable the apple script control in Voiceover settings like I mentioned.I suppose it is possible, actually likely that I was using an older version of AO2 though.for people's reference, the Github repository I believe is here:https://github.com/Accessiware/accessible_output2Well... looking at the code for the VoiceOver class, this is what we are looking at:```from __future__ import absolute_importfrom .base import Outputclass VoiceOver(Output):    """Speech output supporting the Apple VoiceOver screen reader."""    name = "VoiceOver"    def __init__(self, *args, **kwargs):        import appscript        self.app = appscript.app("voiceover")    def speak(self, text, interrupt=False):        self.app.output(text)    def silence(self):        self.app.output(u"")    def is_active(self):        return self.app.isrunning()output_class = VoiceOver```I found a fork of accessible_output2 by frastlin which has the original apple script code that I remember seeing before:https://github.com/frastlin/accessible_output2```import subprocess, osfrom base import Outputclass VoiceOver(Output): """Speech output supporting the Apple VoiceOver screen reader.""" def runAppleScript(self, command, process = 'voiceover'):  return subprocess.Popen(['osascript', '-e', 'tell application "' + process + '"\n' + command + '\nend tell'], stdout = subprocess.PIPE).communicate()[0] name = 'VoiceOver' def speak(self, text, interrupt=0):  if interrupt:   self.silence()  os.system('osascript -e \"tell application \\\"voiceover\\\" to output \\\"%s\\\"\" &' % text) def silence (self):  self.runAppleScript('output ""') def is_active(self):  return self.runAppleScript('return (name of processes) contains "VoiceOver"', 'system events').startswith('true') and not self.runAppleScript('try\nreturn bounds of vo cursor\non error\nreturn false\nend try').startswith('false')output_class = VoiceOver```It is a mess to look at, the result of embedding code in code, but if it works, then it might be worth for now rolling back to this until a better solution can be found.So, just tried it. I took the VoiceOver class from frastlin's fork, copied it into my outputs directory in my python 3.8.6 installation, and after fixing a single import statement, it works.Well, I guess for now I will use this. I suppose I could open a pull request in the github repo, but I am going to wait until I get some replies on what I found before I do anything.Timothy Breitenfeldt

URL: https://forum.audiogames.net/post/585691/#p585691




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: VoiceOver error using accessible_output2

2020-11-02 Thread AudioGames . net Forum — Developers room : NicklasMCHD via Audiogames-reflector


  


Re: VoiceOver error using accessible_output2

You need to allow voice over to be controlled by apple script (you can allow it from the voice over utility with vo+ F8).If that is not allowed / unchecked you will get the error that you got.

URL: https://forum.audiogames.net/post/585687/#p585687




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: VoiceOver error using accessible_output2

2020-11-02 Thread AudioGames . net Forum — Developers room : TJ . Breitenfeldt via Audiogames-reflector


  


Re: VoiceOver error using accessible_output2

Hi, thank you for the fast replies. I have heard that accessible_output2 has not been updated in a few years, although I still prefer it because it is the only cross platform screen reader library solution in python that I know of. I mainly want Mac support, and care less about Linux honestly though.I might dig into the code myself and see what I can find. I was just hoping that someone who had worked on AO2 had an idea. I feel like I have seen this error before, and perhaps even posted here. I will do some digging and report back if I find anything.Thanks,Timothy Breitenfeldt

URL: https://forum.audiogames.net/post/585677/#p585677




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: VoiceOver error using accessible_output2

2020-11-02 Thread AudioGames . net Forum — Developers room : TJ . Breitenfeldt via Audiogames-reflector


  


Re: VoiceOver error using accessible_output2

Hi, thank you for the fast replies. I have heard that accessible_output2 has not been updated in a few years, although I still prefer it because it is the only cross platform screen reader library solution in python that I know of. I mainly want Mac support, and care less about Linux honestly though.I might dig into the code myself and see what I can find. I was just hoping that soemone who had worked on AO2 had an idea. I feel like I have seen this error before, and perhaps even posted here. I will do some digging and report back if I find anything.Thanks,Timothy Breitenfeldt

URL: https://forum.audiogames.net/post/585677/#p585677




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: VoiceOver error using accessible_output2

2020-11-02 Thread AudioGames . net Forum — Developers room : Turret via Audiogames-reflector


  


Re: VoiceOver error using accessible_output2

Hmm, I've never seen this. Although, I don't develop for Mac much anymore and use Cytolk. Let's take a look.Okay... A KeyError of all things? That's... I really don't know what the hell it's trying to do. As another poster said, an update could've broke it or something, or something could be broken in that absolute mess of code. I'm not sure, but on mac OS 10.15.6, it works fine, leading me to believe it's the former, but knowing Q, it could also be the latter, "it works, until it doesn't!" .

URL: https://forum.audiogames.net/post/585568/#p585568




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: VoiceOver error using accessible_output2

2020-11-02 Thread AudioGames . net Forum — Developers room : Hijacker via Audiogames-reflector


  


Re: VoiceOver error using accessible_output2

accessible_output2 itself is quite a few years old and didn't get updated since then. Its very possible that it doesn't work with newest Mac OS versions anymore. I don't know anything specific though.

URL: https://forum.audiogames.net/post/585557/#p585557




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


VoiceOver error using accessible_output2

2020-11-01 Thread AudioGames . net Forum — Developers room : TJ . Breitenfeldt via Audiogames-reflector


  


VoiceOver error using accessible_output2

Hi, I am trying to use accessible_output2 with VoiceOver on my Mac and get the following error:Python 3.8.6 (v3.8.6:db455296be, Sep 23 2020, 13:31:39) [Clang 6.0 (clang-600.0.57)] on darwinType "help", "copyright", "credits" or "license" for more information.>>> from accessible_output2.outputs.voiceover import VoiceOver >>> speech = VoiceOver()>>> speech.speak("ehllo world")Traceback (most recent call last):  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/aeosa/appscript/reference.py", line 599, in __getattr__    selectortype, code = self.AS_appdata.referencebyname()[name]KeyError: 'output'The above exception was the direct cause of the following exception:Traceback (most recent call last):  File "", line 1, in   File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/accessible_output2/outputs/voiceover.py", line 16, in speak    self.app.output(text)  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/aeosa/appscript/reference.py", line 601, in __getattr__    raise AttributeError("Unknown property, element or command: {!r}".format(name)) from eAttributeError: Unknown property, element or command: 'output'Not sure if there was an update that broke something or what. I am running Mac OS Catalina version 10.15.7. I am using python 3.8.6 . I just installed accessible_output2 from pip, so it should be up to date.Any ideas what is going on here?Thanks,Timothy Breitenfeldt

URL: https://forum.audiogames.net/post/585536/#p585536




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector