Qualifying keys for scripts

Started by JohnZeman, January 12, 2015, 06:24:23 PM

Previous topic - Next topic

JohnZeman

I would find it very useful if scripting supported the use of qualifying keys.

For example if the CTRL, ALT, or SHIFT keyboard key is held down at the time of script execution a Boolean value is set that could be read to have the script do an alternate action.


Mario

Well, you can do this easily by directly accessing the Windows functionality via an import statement. But that can get tricky. Or using one of the VB.NET methods.

Anyway, I have implemented a GetKeyState method for the 5.3.4 build. This method works like to the standard Windows API function:

http://msdn.microsoft.com/en-us/library/windows/desktop/ms646301%28v=vs.85%29.aspx

In 5.3.4 you then do a

if Application.GetKeyState(&H10) And &H80 <> 0 Then
' SHIFT presssed
end if


The method takes the key code of the key, a list of key codes can be found here:

http://msdn.microsoft.com/en-us/library/windows/desktop/dd375731%28v=vs.85%29.aspx
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

JohnZeman


Mario

-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook