photools.com Community

IMatch Bug Reports and Feature Requests => Feature Requests => Archive (Feature Requests) => Topic started by: JohnZeman on January 12, 2015, 06:24:23 PM

Title: Qualifying keys for scripts
Post by: JohnZeman on January 12, 2015, 06:24:23 PM
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.
Title: Re: Qualifying keys for scripts
Post by: ubacher on January 13, 2015, 05:38:38 AM
+1
Title: Re: Qualifying keys for scripts
Post by: Mario on January 13, 2015, 09:19:00 AM
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
Title: Re: Qualifying keys for scripts
Post by: JohnZeman on January 13, 2015, 03:41:15 PM
Excellent!  Thanks Mario!
Title: Re: Qualifying keys for scripts
Post by: Mario on January 13, 2015, 04:17:22 PM
Just giving something back.