G code viewer questions... - Page 2


Page 2 of 2 FirstFirst 12
Results 13 to 15 of 15

Thread: G code viewer questions...

  1. #13
    Registered
    Join Date
    May 2012
    Location
    canada
    Posts
    351
    Downloads
    0
    Uploads
    0

    Default Re: G code viewer questions...

    Hi Tom,

    I never heard back from you. You mention that the screen editor can send mouse clicks and keyboard keys. How can i configure a button or key to send that sequence of keys? Thanks.

    Mark



  2. #14
    Gold Member TomKerekes's Avatar
    Join Date
    May 2006
    Location
    USA
    Posts
    2986
    Downloads
    0
    Uploads
    0

    Default Re: G code viewer questions...

    Hi Mark,

    Sorry for the delay I'm still working on this but ran into a number of problems.

    Question: with the AutoHotKey program what happens if you are not in the GCode editor control and push Ctrl-Down? Does it push all those buttons and do crazy things? Or even in a different Windows App?

    The first problem I ran into was that the Ctrl-F must be pushed when the GCode Editor control has focus. But I wanted to allow a Graphical Push button to be able to trigger the sequence and/or a Hot-Key for the button. But clicking a button takes the focus away from the GCode and puts focus on the button.

    I was able to add a method to set the focus back to the GCode Editor. But in Windows when focus is set on an edit control all the contents are automatically selected. This looses where the cursor originally was. I was able to solve this with a special loose focus/gain focus handler to save and restore the current selection. BTW I think this is a minor problem with the AutoHotKey method also. Where you mouse click in the Editor, before or after an M6, will influence where the search takes you.

    Another problem is that I wanted to have this also work for Troy's situation where he wanted to do things like push F9 for Spindle On CW from a KFLOP initiated command. That works fine except if another Windows App is active instead of KMotionCNC. So if you are working in KMotion.exe or Notepad.exe pushing Troy's Spindle On CW physical button wouldn't work, and the other app might respond to F9 and do something odd.

    I thought it would be easy to just Activate KMotionCNC then send the keystroke. But Microsoft basically forbids any App from making itself Active. I guess the concern is that someone might be typing an email and all of a sudden their keystrokes start going to a different application.

    So I'm starting to think all this Auto Keyboard stuff is a bad idea. But I haven't given up just yet. If anyone has some ideas I'm open.



  3. #15
    Registered
    Join Date
    May 2012
    Location
    canada
    Posts
    351
    Downloads
    0
    Uploads
    0

    Default Re: G code viewer questions...

    Quote Originally Posted by TomKerekes View Post
    Hi Mark,

    Sorry for the delay I'm still working on this but ran into a number of problems.

    Question: with the AutoHotKey program what happens if you are not in the GCode editor control and push Ctrl-Down? Does it push all those buttons and do crazy things? Or even in a different Windows App?
    Hi Tom,

    If I push Ctrl-down without g code editor active, yes it does do all sorts of crazy things. I didn't think of that, good point. Its looks to be easy to add conditional statements to check if kmotioncnc is active in autohotkey. Not sure if this applies to how your programming kmotioncnc, but in Autohotkey something like this could be used:

    ; Untitled - Notepad
    #IfWinActive Untitled - Notepad
    !q::
    MsgBox, You pressed ALT+Q in Notepad.
    return

    ; Any window that isn't Untitled - Notepad
    #IfWinActive
    !q::
    MsgBox, You pressed ALT+Q in any window.
    return

    Mode details on this WinActive command here: https://www.autohotkey.com/docs/misc/WinTitle.htm

    Also, if it were done from a graphical push button this wouldn't this be enough to ensure kmotioncnc is active since you just clicked it?

    The first problem I ran into was that the Ctrl-F must be pushed when the GCode Editor control has focus. But I wanted to allow a Graphical Push button to be able to trigger the sequence and/or a Hot-Key for the button. But clicking a button takes the focus away from the GCode and puts focus on the button.

    I was able to add a method to set the focus back to the GCode Editor. But in Windows when focus is set on an edit control all the contents are automatically selected. This looses where the cursor originally was. I was able to solve this with a special loose focus/gain focus handler to save and restore the current selection. BTW I think this is a minor problem with the AutoHotKey method also. Where you mouse click in the Editor, before or after an M6, will influence where the search takes you.
    Sounds like another major problem, but you have a work around which is great. The minor problem you mention is the next tool button taking you to a line your already on if cursor is before m6? No big deal if you have to click it twice. Pretty sure the mastercam editor worked that way too. Still much faster then the whole sequence of right clicking and using find, typing m06 etc.

    Another problem is that I wanted to have this also work for Troy's situation where he wanted to do things like push F9 for Spindle On CW from a KFLOP initiated command. That works fine except if another Windows App is active instead of KMotionCNC. So if you are working in KMotion.exe or Notepad.exe pushing Troy's Spindle On CW physical button wouldn't work, and the other app might respond to F9 and do something odd.

    I thought it would be easy to just Activate KMotionCNC then send the keystroke. But Microsoft basically forbids any App from making itself Active. I guess the concern is that someone might be typing an email and all of a sudden their keystrokes start going to a different application.

    So I'm starting to think all this Auto Keyboard stuff is a bad idea. But I haven't given up just yet. If anyone has some ideas I'm open.
    Yeah seems like there are a few things that could go wrong there. Something like controlling the spindle is not something you want to play around with either. Imagine an emergency situation came up and first reaction was to hit spindle off button and it didnt work because calculator was open.

    But I dont see much problem with a graphical button you click (ensuring Kmotioncnc is active) sending some keystrokes to find next tool. Especially if you have a way of making the g-code editor active. Thanks again

    Mark



Page 2 of 2 FirstFirst 12

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


About CNCzone.com

    We are the largest and most active discussion forum for manufacturing industry. The site is 100% free to join and use, so join today!

Follow us on


Our Brands

G code viewer questions...

G code viewer questions...