Page 1 of 3

Ability to use screen buttons in Hotkeys

PostPosted: Sun Feb 06, 2022 2:04 pm
by johnsattuk
If it was possible to designate screen buttons to use in HotKeys it would allow all sorts of possibilities :D :D

Re: Ability to use screen buttons in Hotkeys

PostPosted: Sun Feb 06, 2022 2:11 pm
by cncdrive
It's possible, I mean that is exactly how it works now.
In the hotkeys menu you can assign a hotkey to a button code.
So, when you pressing the hotkey it calls the button code just like as if you were pressing that button on the screen.

Re: Ability to use screen buttons in Hotkeys

PostPosted: Sun Feb 06, 2022 3:21 pm
by johnsattuk
What I really meant was, Pressing a screenbutton initiates a hotkey

At the moment hotkeys only allow KEY presses I think

Perhaps a HotButtons menu

Re: Ability to use screen buttons in Hotkeys

PostPosted: Sun Feb 06, 2022 3:35 pm
by cncdrive
Sorry, I don't understand what you wrote. :(
Could you please explain?

Re: Ability to use screen buttons in Hotkeys

PostPosted: Sun Feb 06, 2022 4:07 pm
by johnsattuk
OK
example-
I create a screen button and give it the number 900
I would like to use the button number 900 in HotKeys to initiate functions 148 and 149
I can do this using keyboard Key numbers, but it would be great if it were possible with screen buttons

Re: Ability to use screen buttons in Hotkeys

PostPosted: Sun Feb 06, 2022 5:21 pm
by eabrust
How about a floating jog panel plugin? I prefer working w/ plugins vs screenset alterations and macros.

jogbox.PNG



I had made this as a demo a while ago as a plugin example. I added diagonal jog buttons pretty quickly today. It could use more work/refinement, but I won't put more time into it if no one will use it.


JogBox.zip
(113.93 KiB) Downloaded 427 times



Just drop it in your plugins folder, enable to show on startup. I can clean it up and make the source available if there is any interest in it.


regards
Eric

Re: Ability to use screen buttons in Hotkeys

PostPosted: Sun Feb 06, 2022 5:27 pm
by johnsattuk
Will give it a go :D :D

Re: Ability to use screen buttons in Hotkeys

PostPosted: Sun Feb 06, 2022 5:27 pm
by cncdrive
You can do that with button codes 20000 to 21999.
Then you can add a macro to the M20000.txt file and you can put in that macro the exec.Callbutton(148); etc.

Re: Ability to use screen buttons in Hotkeys

PostPosted: Sun Feb 06, 2022 6:48 pm
by johnsattuk
Thank you, that starts the diagonal movement :D
How do I stop it when the button is released :o

Re: Ability to use screen buttons in Hotkeys

PostPosted: Thu Feb 10, 2022 11:52 am
by dezsoe
OK, now I could finally get to write a macroloop for you. Honestly, I've never used AS3.Getbutton(), so first I had to try it. Change the four constants with the Btn in the end (UpRightBtn etc.) to the button numbers that you want to use. In the sample I set them to 55550..55553. Save the following code as Mxxx.txt where xxx is a macro number and set that number in the Macroloops window. Also, check auto run.

Code: Select all
// ================================================================================================
// Diagonal jog buttons
// ================================================================================================

// Read button press states
bool UpRight = AS3.Getbutton(UpRightBtn);
bool DownRight = AS3.Getbutton(DownRightBtn);
bool UpLeft = AS3.Getbutton(UpLeftBtn);
bool DownLeft = AS3.Getbutton(DownLeftBtn);

if (UpRight != lastUpRight)
{
  // Button was pressed or released
  if (UpRight)
  {
    // Button was pressed
    exec.Callbutton(JogOn + YPlus);
    exec.Callbutton(JogOn + XPlus);
  }
  else
  {
    // Button was released
    exec.Callbutton(JogOff + YPlus);
    exec.Callbutton(JogOff + XPlus);
  }
  lastUpRight = UpRight;
}

if (DownRight != lastDownRight)
{
  // Button was pressed or released
  if (DownRight)
  {
    // Button was pressed
    exec.Callbutton(JogOn + YMinus);
    exec.Callbutton(JogOn + XPlus);
  }
  else
  {
    // Button was released
    exec.Callbutton(JogOff + YMinus);
    exec.Callbutton(JogOff + XPlus);
  }
  lastDownRight = DownRight;
}

if (UpLeft != lastUpLeft)
{
  // Button was pressed or released
  if (UpLeft)
  {
    // Button was pressed
    exec.Callbutton(JogOn + YPlus);
    exec.Callbutton(JogOn + XMinus);
  }
  else
  {
    // Button was released
    exec.Callbutton(JogOff + YPlus);
    exec.Callbutton(JogOff + XMinus);
  }
  lastUpLeft = UpLeft;
}

if (DownLeft != lastDownLeft)
{
  // Button was pressed or released
  if (DownLeft)
  {
    // Button was pressed
    exec.Callbutton(JogOn + YMinus);
    exec.Callbutton(JogOn + XMinus);
  }
  else
  {
    // Button was released
    exec.Callbutton(JogOff + YMinus);
    exec.Callbutton(JogOff + XMinus);
  }
  lastDownLeft = DownLeft;
}

// ================================================================================================

#Events

// ================================================================================================

const int UpRightBtn = 55550;
const int DownRightBtn = 55551;
const int UpLeftBtn = 55552;
const int DownLeftBtn = 55553;

const int JogOn = 147;
const int JogOff = 229;

const int XPlus = 0;
const int XMinus = 1;
const int YPlus = 2;
const int YMinus = 3;

bool lastUpRight = false;
bool lastDownRight = false;
bool lastUpLeft = false;
bool lastDownLeft = false;

// ================================================================================================

/*
147    JogX+    Jogs the X axis to positive direction. 
148    JogX-    Jogs the X axis to negative direction. 
149    JogY+    Jogs the Y axis to positive direction. 
150    JogY-    Jogs the Y axis to negative direction. 

229    JogXplusoff    Switches the X axis positive direction jogging off. 
230    JogXminusoff   Switches the X axis negative direction jogging off. 
231    JogYplusoff    Switches the Y axis positive direction jogging off. 
232    JogYminusoff   Switches the Y axis negative direction jogging off. 
*/

// ================================================================================================