H-Core / H.Runners

HomeCenter runners repository.
MIT License
2 stars 0 forks source link

Project documentation? #1

Closed StormRSA closed 3 years ago

StormRSA commented 3 years ago

Hi.

Do you have any documentation regarding how the plugin works or what functions to call in order to take a screenshot or is it as simple as installing the plugin in then "using H.Runners" and then the selected library?

HavenDV commented 3 years ago

Hello. Thank you for your interest in this project. At the moment everything is under development and has no active users. But any Runner can be used as a separate NuGet package (they are already released and available under the same name). Code to use:

using H.Runners;

var runner = new ScreenshotRunner();
var image = await runner.ScreenshotAsync();

All of these runners are meant to be used in the final application. They can be called by any event, for example, by a global key combination or a voice command. At the moment it is static (that is, it requires recompilation to set other modules), I have not yet implemented dynamic loading of modules and settings for it. https://github.com/H-Core/H.Services/tree/master/src/apps/H.Services.Apps.WPF A Deskband is also available for executing commands: image

In my MVP, I was creating a screenshot of a specific area by holding LALT + RALT and selecting the desired area. After that the image appeared in the Clipboard.

HavenDV commented 3 years ago

The ultimate goal is to become an application that helps to actively use non-standard actions (voice, global hotkeys, eye gaze direction, etc.) in everyday work at the computer. Maybe add a little AI to this to simplify the things we do day after day. Existing alternatives: https://talonvoice.com/ https://serenade.ai/

StormRSA commented 3 years ago

Thank you for getting back to me so quickly.

Wow you have a really interesting project and I wish you all the best with it. You creating/using technologies to build a amazing product.

Appolgies because I know this isn't related to the same issue thread but:

I am currently building WPF in .Net Core that has a ML model embedded into it and currently need a screenshot library to capture selected regions of a screen. If I may ask does current screenshot script capture selected regions and if yes may I use the H.runners nuget?

Once again thanks for the quick response and all the best on your project.

HavenDV commented 3 years ago

https://www.nuget.org/packages/H.Utilities.Screenshoter/ https://github.com/HavenDV/H.Utilities/blob/master/src/libs/H.Utilities.Screenshoter/Screenshoter.cs https://github.com/H-Core/H.Runners/blob/master/src/libs/H.Runners.ScreenshotRunner/ScreenshotRunner.cs All source code is available under the MIT license and can be used for any purpose.

Besides Runner, you can use the original package, or just embed this class in your code. But I must warn you that I did not optimize this process, my standard use implied rare screenshots. So it might make sense to use something better if performance is important to you. But at the same time, I make certain improvements so that everything works with multiple monitors - you can also select a region at the junction of screens.

StormRSA commented 3 years ago

Okay thank you im going to give it a shot, because I have been unable to to get my region screenshot capture work on a multiple monitor setup.

Thank you and best of luck.

HavenDV commented 3 years ago

https://www.nuget.org/packages/H.Utilities.Screenshoter/ I want to note that I have released a new version that supports screens with different scales and performs a screenshot of the region much more efficiently.

StormRSA commented 3 years ago

Hey, thanks for updating. is it possible to call the region screenshot from a button press in a WPF and if so how would that look like using the H.Utilities.Screenshoter nuget?

HavenDV commented 3 years ago
var bitmap = Screenshoter.Shot();
var bitmap = await Screenshoter.ShotAsync();

// Rectangle in physical screen coordinates(Without DPI).
// The transmitted coordinates will select the first screen of three HD monitors, 
// where the second is specified as primary.
var bitmap = Screenshoter.Shot(Rectangle.FromLTRB(-1920, 0, 0, 1080));

The only difficulty can be in translating coordinates to physical coordinates if you dynamically define a rectangle in WPF. Because WPF respects the DPI of each screen by default.

To understand the various conversions, you can look at this code: https://github.com/H-Core/H.Runners/blob/master/src/libs/H.Runners.SelectRunner/Utilities/MouseUtilities.cs

There are three kinds of global coordinates:

StormRSA commented 3 years ago

Okay, thank you for clarifying this helped.