Machsupport Forum

Mach Discussion => General Mach Discussion => Topic started by: DAlgie on January 06, 2011, 11:27:28 PM

Title: Keygrabber tips?
Post by: DAlgie on January 06, 2011, 11:27:28 PM
Mostly have my lathe working well now, and Keygrabber seems to work in this new version of Mach as well. I have a numeric keypad up on the enclosure door of the lathe and use it for jogging up to the stock and setting Z zero etc. So, I used keygrabber and changed the "/" to a shift button so I now have rapid there instead of having to go back to the main keyboard for rapids. Question, do you always have to start Keygrabber up to make it function in Mach, or is there something I can do to make it always work without starting Keygrabber each time?
Thanks, DaveA.
Title: Re: Keygrabber tips?
Post by: Hood on January 07, 2011, 03:07:23 AM
If you right click on the icon you use to launch Mach and select properties you will see the target similar to  C:\Mach3\Mach3.exe /p Mach3Mill , change the Mach3.exe to KeyGrabber.exe and it should work, ie  C:\Mach3\KeyGrabber.exe /p Mach3Mill  taking note there is a space after the exe and before the /

Title: Re: Keygrabber tips?
Post by: mhasting2004 on February 14, 2011, 07:02:11 PM
Does anybody know if its possible to change keygrabber so that it will re establish comms with a wireless controller that has gone to sleep?

The Xbox controller will refresh its conection if the controller is returned from hibernating (pushing big silver button) however Keygrabber refuses to recognise the controler once lost unless you restart Mach. The added functionality that Keygrabber affords to programming buttons on the Xbox controller is a really handy feature but is useless if one needs to exit Mach all the time.

Title: Re: Keygrabber tips?
Post by: mhasting2004 on February 14, 2011, 08:59:32 PM
One other keygrabber question.... How do you select the Alt key? its not in the special keys but is recognised when in test mode.
Title: Re: Keygrabber tips?
Post by: 4z7 on March 05, 2011, 02:55:38 AM
I have a plugin for a hand held keyboard and joystick. My problem is getting the keypress into Mach from the plugin. The plugin uses Windows::Forms::SendKeys::SendWait("KEY") like SendWait("1") would send the character 1 to whatever app has gotfocus on the desktop.  This Method is essentially a keyboard emulator and works for most other application.  For example if I have Mach open (the plugin is in Mach), then open another app like Notepad and give it focus, all the keypresses are correctly sent to Notepad.  Same for other apps that I have tried.

But in Mach, the keypresses are not getting processed. If the MDI textbox  (I assume it is a textbox) has got focus all the keypresses including arrow keys process except "ENTER" and "ESC".  If a DRO (I would also think it is a textbox) has got focus,  NO keypresses are processed.  If no controls have focus, just Mach,  "Enter" would be the only keypress that should process (the MDI Window shortcut key) but it doesn't.  All keypresses process in any of Mach's toolbar drop down forms.

I guess I've realized just by writing this that DROs  and the MDI aren't Windows::Form elements but the main Mach window certainly is a Windows::Form. So I suspect that I'll never get SendKeys to work with Mach.  I really only want to use the hand held keypress buttons to enter characters in the MDI or a DRO.

The reason I posted in this thread is because a search for "ScanCode"  most commonly returns  with KeyGrabber and this was the last posted to thread so I'm hoping someone will read this.  I am looking for the Method in Mach that processes keyboard scancodes to see if I can pass scancodes directly.  I assume that KeyGrabber intercepts any keyboard scancode  just sent to Mach, processes what it is set up to do, then passes them directly to only Mach.  Any ideas will be appreciated and I'll post a resolution if I find it.
Title: Re: Keygrabber tips?
Post by: 4z7 on March 11, 2011, 02:45:11 PM
The plugin can be set up for any button press to be a ShiftKey, Keypress, Macro, OEMCode,  or any other function designed into the plugin.  So, for any DRO I set up a macro to open a Message box for user input.  The DRO's that I frequently enter characters into  are X,Y and Z axis DROs.  So the simple macro to set  the X axis is

dro = Question("X DRO:")

Because the "Question Message Box" is a Window's compliant form all keypresses process with Windows::__::SendWait("key").  The DRO macros actually function more efficient since since I don't have to use  a mouse click  to set focus to the DRO.

For the MDI window I created  the macro 'SendKeys "{Enter}", false' which acts just as if ENTER was pressed from a keyboard within the  Mach Screen or MDI.  The only issue is the " macro ENTER" doesn't process within a Windows compliant control like the "Question Message Box" or a Mach Menu dropdown etc, so two ENTERs are required from button action, a " macro ENTER"  and a  Windows::Forms::SendKeys::SendWait("{ENTER}") .

The hand held keyboard and joystick has 2 joysticks controlling 4 axes and 26 buttons. Of the 26 buttons, 2  are designated as "ShiftKeys" so there are 49 button actions.  I have one button, like button17 set to Windows::Forms::SendKeys::SendWait("{ENTER}") and Shift-button17 set to "macro ENTER" so it isn't too confusing.  The two shift buttons when pressed together can also be set to a button action. 24 + Shifted 24 + 1shift-shift = 49.

I hope this helps anyone searching for SendKeys, SendWait, or ScanCodes. I would still like to find out how and/or if a ScanCode can be
processed in Mach's screen.