Hello Guest it is January 20, 2021, 09:08:03 PM

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - ggagnon

Pages: 1 2 3 4
Thank you Bob and Craig, with your help I finally begin to see the light at the end of the tunnel  :)

Hi Craig,
If my understanding is correct, there is a register automatically associated with each dro that I added to my panel with the screen editor.  And when I write to that register, the content of the dro changes accordingly. Is this correct?

Then how do I know the number of the register that was automatically associated with my DROs ?


With Mach4 screen editor I create a button that I called setCamOffset and two dros called droCamX and droCamY.

When I click the button I want the actual XY coordinates of the tool to be copied to my dros like:

droCurrentX --> droCamX

droCurrentY ==> droCamY

I wrote the following script for the button (without the line numbering):

1. local inst = mc.mcGetInstance()
2. local Xcoords = scr.GetProperty("droCurrentX","Value")
3. local Ycoords = scr.GetProperty("droCurrentX","Value")
4. scr.SetProperty(inst,"droCamX",tostring(Xcoords))
5. scr.SetProperty("droCamY",tostring(Ycoords))

Problem:  Nothing is being written to my dros .

What is wrong with this script? Do I even use the right functions for the job?

Thanks for your time,



Yes, I am using DazTheGas's XBox controller example as the basis for getting acquainted with mach4 programming. Thanks DazTheGas for you very useful video on this.

Steve, you code snippet is promising. I think get the idea .

At this time I can write the script and incorporate it in the screen.  But I have some errors and I need to run in debug mode with the xbox connected.

I could certainly appreciate some pointers on how to do this as I did not have much success so far.

Thanks for you help,


Is this is what you mean?

   if  Yval > 25  or Yval < -25  then
      if Yval >25 then

Something must be missing, nothing moves.

Thanks Craig, let see if this makes more sens.
I am writing a script to control Mach4 with a Xbox360 device. If that matter, the screen set used is Wx4. The Xbox360 plugin is written by DasTheGas.

My goal is to use the jogging screen as it is but actuate the jogging buttons: x+,x-,y+,y-,z+,z- with the controls of the xbox360.
I have not found a function to simply press and release a screen button like X+

Any thought on how this can be done or simply a function mc.mc??? or a snippet of code to achieve this?

Thanks for your help,

Same message, just made the object a bit more significant if that can help.

Mach4 General Discussion / how to press a button within a script
« on: May 15, 2019, 08:53:08 PM »
Newbie to mach4 coding here, sorry :-\

What function can I use to actuate one of the jogging buttons: x+,x-,y+,y-,z+,z- as if I was using the mouse but from within a script?

Bingo, that does it.
I had forgotten that a macro could be executed when mach3 starts.

Thanks Klaus,
That will solve my problem,
Two questions:
 How to assure the led is off when Mach3 starts?
 Is there a way to prevent Machscreen's editor from inserting tabs automatically?


Pages: 1 2 3 4