Because S+ needs to always have the exact (non-scaled) coordinates to behave as expected (and draw gestures in the right place!), I have entries in the application manifest that tells Windows that S+ will manage the DPI on its own, so don't scale anything:
Code:<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true/pm</dpiAware>
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">permonitorv2,permonitor</dpiAwareness>
Yes, the DllCall equivalents are a bit more verbose here because .NET is a managed environment, where AHK is native code. .NET requires a bit more marshalling between managed and native code - plus I wanted to make this flexible to support things like callbacks, sequential typedefs, etc. Also, we have another layer of translation with JavaScript to .NET as well.
For
host, that's the provided functions from Microsoft ClearScript:
https://microsoft.github.io/ClearScript/Reference/html/Methods_T_Microsoft_ClearScript_HostFunctions.htmTheir FAQtorial (basics):
https://microsoft.github.io/ClearScript/Tutorial/FAQtorialThe ClearScript repo:
https://github.com/microsoft/ClearScriptClearScript is what provides the bridge between JavaScript and C#/.NET, translating objects back and forth, exposing sp.* functions, etc.
If you look in the
Script Help window, the first entry
.NET and ClearScript (poorly) explains the mapping of the objects exposed to the script engine/JavaScript.
So
clr is for all classes within the mscorlib, System, and System.Core (base .NET Framework) classes.
For example, see this MSDN page:
https://docs.microsoft.com/en-us/dotnet/api/system.int32?view=netframework-4.8Notice in the header area it reads: Assembly: mscorlib.dll
So the Int32 type (struct) would be within the
clr object.
Note that you still have to fully qualify the namespace (unless you alias that separately).
Another example, in S+ script
forms.System.Windows.Forms.MessageBox translates to this:
https://docs.microsoft.com/en-us/dotnet/api/system.windows.forms.messagebox?view=netframework-4.8Intellisense is really a big pain, so not much actually has it, lol. And the .NET framework is massive, so intellisense would be very cumbersome and sluggish without some huge caching.
Also, check out this post:
https://forum.strokesplus.net/posts/t5028-Debugging-ScriptsI often find that using Chrome to hit a debugger breakpoint in scripts, then using Watch / Console commands in Dev Tools really helps to discover a lot of things going on under the hood and available.
Also, if you're researching anything in the .NET docs, make sure that you're only looking at
.NET Framework 4.8, as that's what S+ is currently referencing. Meaning, there are some new things in .NET 5.0 which may not be available for .NET Framework 4.8.
Let me know if you have any other questions!
Edited by user Thursday, February 11, 2021 3:24:02 AM(UTC)
| Reason: Not specified