dictation-toolbox / natlinkcore

Other
4 stars 4 forks source link

Scripts in the Natlink\SampleMacros directory #23

Open Voxellence opened 1 year ago

Voxellence commented 1 year ago

First of all, thank you to Quintijn and everyone else who has helped to modify NatLink to be able to use Python 3. I'm sure that there has been a tremendous amount of effort expended to make that happen, and I am grateful for it.

I've been away from NatLink for a few years and I'm attempting to get up to speed with it. The installation process went well and now I'm reviewing the scripts that come with it. I've noticed that the "SampleMacros" directory scripts have not been kept up to date. Therefore, I've attempted to go through them and correct errors to the extent that I could. I'm perfectly happy to submit a pull request when I'm done so that the results of this effort can be integrated into the repo. However, I would first like to get some feedback on one particular error, just in case anyone knows off the top of their head or can easily ascertain the cause of it.

In the process of moving only one script at a time into the "UserDirectory", after correcting as many errors as I could, I've noticed that each and every one of them individually causes the following to be output to the "Messages From Natlink" window in red: DPI awareness could not be set; it has been set already.

Does anyone have any idea of what is causing that and how to fix it?

LexiconCode commented 1 year ago

Thank you @Voxellence

I assume you setup dragonfly and the SampleMacros from natlinkcore?

This happen as DNS has DPI awareness but other speech recognition engines do not and other processes launched by dragonfly may not be DPI aware.

Whats strange is its happening multiple times.

I've noticed that each and every one of them individually causes the following to be output to the "Messages From Natlink" window in red: DPI awareness could not be set; it has been set already.

DPI awareness PR https://github.com/dictation-toolbox/dragonfly/issues/289 Code https://github.com/dictation-toolbox/dragonfly/blob/master/dragonfly/windows/win32_monitor.py#L51

@Danesprite if need be this can be moved to dragonfly repo!

Voxellence commented 1 year ago

Thanks for a quick reply.

First off, I haven't yet even installed Dragonfly. That is, unless somehow my old installation of Dragonfly is being found. I dunno. Haven't really thought about it, but I seriously doubt that it has any connection to my current NatLink installation.

And to be clear, I am talking about the NatLink macros that come with the latest pre-release of NatLink. It appears that Quintijn has updated some things and not others...or something.

Also, when I say "each and every one of them individually", I mean opening up Dragon when only one of the seven scripts is in the UserDirectory at that time. The message does indeed only print to the window once even when all scripts are present in the UserDirectory.

LexiconCode commented 1 year ago

In that case I can not answer directly about Dragonfly. Although double check and make sure it's not installed. There's been a huge change to the repository since the last pre-release. A new release will be out about 4 to 5 days when I get off work. A detailed change log will be created then.a big change is how the repository and code is structured:

C++ code lives in https://github.com/dictation-toolbox/natlink as the installer Python in https://github.com/dictation-toolbox/natlinkcore as a Python package

This allows for the Python code (natlinkcore) to be updated independently of the C++ code (natlink).

There's been significant bug fixes and enhancements like a new configuration GUI. So if inclined you can use the following:

natlinkcore-5.3.3-py3-none-any.zip natlink5.3.3-py3.10-32-setup.zip

Needs python 3.10 - 32 bit

  1. Uninstall any old version and delete C:\Program Files (x86)\Natlink if needed
  2. To install natlinkcore-5.3.3-py3-none-any.whl first! py -m pip install natlinkcore-5.3.3-py3-none-any.whl That way the installer doesn't reach for an old version on pypi. So it's just a workaround until we get a new release out to pypi and the new installer will behave correctly.
  3. Run the natlink5.3.3-py3.10-32-setup.exe
  4. Use the CLI (in natlink start menu) to set Natlink User Dir
Voxellence commented 1 year ago

Ah, thank you, LexiconCode. I will just forget about this problem and install the new version when it comes out, referring back here to your instructions and having my fingers crossed. I think the light bulb finally went on in my head about what 'natlinkcore' actually means, that being Python code only. I'm assuming that this means that the 'natlink' C++ project could then potentially work with both Python 2.7 and 3.x depending upon which Python library one chooses to install, although to me it seems like there's no compelling reason not to go with Python 3 since you guys have gotten 'natlinkcore' working apparently really well.

Maybe you understood me perfectly, but in case you did not, at this time I am working with NatLink and NatLink macros only, as though Dragonfly didn't even exist. After I get the sample macros working without error, I have a few of the other old macros that used to come with NatLink back in the day that I'd like to get working, as well as a few of my own.

After that's all done, then I'd like to install Dragonfly and start working on updating my old Dragonfly macros, but to me it seems logical to start with NatLink alone. I've been ill for several years and am looking forward to getting back into the world of voice recognition magic. Thanks again for your help.

It appears that the primary changes that need to be made to the NatLink sample macros are the use of the 'natlinkcore' Python module name in import statements, and adding parentheses around calls to 'print' for Python 3.

drmfinlay commented 1 year ago

Hello @Voxellence,

The error message you're seeing -- "DPI awareness could not be set; it has been set already" -- is from Dragonfly. That is, unless similar code has been added to natlink/natlinkcore. So it is being imported somewhere.

Regardless, I think this message is unnecessary and should be removed, or suppressed, in a future version. It doesn't give the user any actionable information. There is nothing the user can do about DPI awareness when, as in the case of natspeak.exe, it has been set at the executable level.

Voxellence commented 1 year ago

Well, that's interesting indeed. Being that this is a completely new install of NatLink using a version of Python that I've never before used or even installed, it's hard for me to fathom how a Dragonfly message is making its way through, unless it's through the Windows Registry maybe. But then again, I'm getting the idea that there's something I'm not aware of, which is nothing new for me.

Thanks.

drmfinlay commented 1 year ago

It is confusing to me too, @Voxellence. It looks like the library is being indirectly imported by natlinkcore itself, by way of the dtactions package.

The new architecture of the Natlink project is complicated. Too complicated, in my view… I'm not really sure why the dtactions package is needed at all.

On Mon, 12 Sep 2022 07:13:15 -0700 Voxellence @.***> wrote:

Well, that's interesting indeed. Being that this is a completely new install of NatLink using a version of Python that I've never before used or even installed, it's hard for me to fathom how a Dragonfly message is making its way through, unless it's through the Windows Registry maybe. But then again, there could be something I'm not aware of, which is nothing new for me.

Thanks.

-- Reply to this email directly or view it on GitHub: https://github.com/dictation-toolbox/natlinkcore/issues/23 You are receiving this because you were mentioned.

Message ID: @.***>

dougransom commented 1 year ago

dtactions is required because there is a bunch of stuff useful not just for dragonfly, but also other macro packages like unimacro. it is just reusable things pulled out of natlink or dragonfly or unimacro, not specifaclly required by natlink.

Voxellence commented 1 year ago

Thank you for your insights, @Danesprite and @dougransom.

Incidentally, where do I find the latest release of Dragonfly?

It seems that more investigation and documentation would be helpful. In my opinion, these NatLink and Dragonfly projects are amazing software, despite the fact that Nuance has taken their acquisition of Dragon and essentially abandoned the public-facing product. I suppose that's okay, since it's mature enough that it works really, really well.

I'm about to post another issue related to live debugging. I won't be doing it out of any expectation that something be fixed, but rather out of a desire to get others interested in it. Hope to see you there.

drmfinlay commented 1 year ago

dtactions is required because there is a bunch of stuff useful not just for dragonfly, but also other macro packages like unimacro. it is just reusable things pulled out of natlink or dragonfly or unimacro, not specifaclly required by natlink.

Thanks Doug, that makes sense. I had forgotten about the other parts of dtactions. By the way, the next version of dragonfly2 should reduce the requirements of dtactions somewhat.

No problem, @Voxellence. The latest release of Dragonfly (0.35.0) is available from pip:

pip install --upgrade dragonfly2

It may be the version you have installed. The project page is this one: https://github.com/dictation-toolbox/dragonfly/#readme

quintijn commented 1 year ago

Hello everyone, @Voxellence in particular. The dependency of dtactions in natlinkcore can be removed.

But.. dtactions has dragonfly as dependency because of the sendkeys function. I hope Mark Lillibridge will fix his SendInput module (which he developed for vocola) for python3. In that case this dependency can be dropped too.

It is indeed desirable, that natlinkcore has as little dependencies as possible. Likewise for dtactions, which should do actions like clipboard functions, sendkeys, .... dtactions (currently) is dependent on natlinkcore, because of getting the modInfo (progInfo) of the foreground window. BTW this progInfo can also be obtained with autohotkey, but when using Dragon/Natlink, via modInfo is probably faster.

quintijn commented 1 year ago

@Voxellence : about the samplemacros, thank you for testing these. I believe the original samples are working now. The others are still a mess. Some are for demo, and should be working. Some are for testing (suspected) bugs.

When you fork the natlinkcore repository, make a branch, and make your changes, you can then make a PR (Pull Request) for getting them merged into the repository. In the file readme.md you find instructions on how to work, but in your case moving sample by sample to your active directory, and moving back to your branch will be sufficient, I think.

thanks for your effort!

Voxellence commented 1 year ago

Hello, @quintijn. Thanks for your response. I'll try to do as you recommend with the samples as soon as I can. Regarding the code, I am not very familiar at all but would like to join in and begin to understand it. I can certainly appreciate your attention to design decisions, such as creating a sane dependency graph.

quintijn commented 1 year ago

I was also planning to go through the samples, and comment. Pick what you like. I think the originalsamplemacros https://github.com/dictation-toolbox/natlinkcore/tree/main/src/natlinkcore/SampleMacros/OriginalSampleMacros

are all working. Please check...

Voxellence commented 1 year ago

I'll use those as my starting point and work from there. It may take me some time, but it's definitely on my to-do list. In the meantime, the issue of live debugging has captured my attention.

Thanks again, @quintijn.

quintijn commented 1 year ago

Hi all, can we close this issue? And Voxellence and me keep contact about the sample macros?

Voxellence commented 1 year ago

@LexiconCode, this is a bit off topic for this issue, but since you offered installation support above, I thought I'd ask a follow-up question to the installation advice you offered.

I've installed NatLink and NatLinkCore from the files you referred me to: natlinkcore-5.3.3-py3-none-any.zip natlink5.3.3-py3.10-32-setup.zip

GitHub newbie question here, but I'm a bit confused as to how I can find these kinds of (pre-release?) files in the future. I suppose I would maybe need to get on board with contributing to these projects, which I have considered doing anyway, in order to see these things?

Also, since I did take your advice, is there a special version of Dragonfly that I should install, as opposed to running this command?
py -3.10-32 -m pip3 install dragonfly2

And for that matter, I saw some talk about using the old original dragonfly release channel instead of dragonfly2 since Christo Butcher gave his blessings on it. Is that a thing now?

I've been staring at this page... Inclusion of Dragonfly code in dtactions #1
....but only succeeded in making my head hurt. :-)

LexiconCode commented 1 year ago

@Voxellence

GitHub newbie question here, but I'm a bit confused as to how I can find these kinds of (pre-release?) files in the future. I suppose I would maybe need to get on board with contributing to these projects, which I have considered doing anyway, in order to see these things?

You should see them at https://github.com/dictation-toolbox/natlink/releases

Also, since I did take your advice, is there a special version of Dragonfly that I should install, as opposed to running this command? py -3.10-32 -m pip3 install dragonfly2

The latest dragonfly2 is best but it did not need to update as dragonfly2 calls the C++ in natlink not the python interface

And for that matter, I saw some talk about using the old original dragonfly release channel instead of dragonfly2 since Christo Butcher gave his blessings on it. Is that a thing now?

The package namespace might change in the future to dragonfly in (1.0?). Most people forget to add the 2 to the end of dragonfly during install.

Voxellence commented 1 year ago

@LexiconCode: Thanks. Yes, I see the NatLink 5.3.4 release there. Guess I need to uninstall/reinstall again since I installed 5.3.3. I'm gathering that 5.3.4 is the new version you were alluding to in your previous comment. What I don't see is a way for me to know (other than by accident as happened here) about stuff such as the wheel for the temporary NatLinkCore which isn't (or wasn't) up on PyPi yet as you warned above. It may be a situation that doesn't arise very often, but I thought maybe there was some inside track I'm missing out on. Maybe just the issues on the core site, I suppose? I'm probably worrying about problems that don't exist, buy hey, I never said I'm not neurotic.

You say most people forget to add the 2 on the end of dragonfly, but it's still required, correct? In any case, sounds like I can just proceed with the pip3 command and I won't be missing out on anything.

Really appreciate all your help!

drmfinlay commented 1 year ago

The package namespace might change in the future to dragonfly in (1.0?). Most people forget to add the 2 to the end of dragonfly during install.

Updating the package namespace to dragonfly for v1.0 is the plan. The dragonfly2 package will be updated at the same.