User M codes not working

More
14 years 1 week ago #25729 by Miselph
Hello all,

I am trying to use a custom M code (m101) to run an external program. In this case the program is a script which calls Zenity to display a pop up asking the user to check that the spindle is running as at the moment I am having to start and stop my spindle manually.

So, I created the following script:
Code:
#M101 #!/bin/bash zenity --info --text="Please ensure that the spindle is running and up to speed." exit 0

and saved it as m101.ngc in the folder specified in the [DISPLAY] section of the ini file and set the permissions to allow execution (chmod +x m101.ngc)
The script runs fine from the terminal but when I try and call the m code from the MDI interface in Axis it give me the "unknown m code used" error.
I have also tried placing the file in the same folder I place my oCodes in and it still doesn't work.

Any ideas?

Please Log in or Create an account to join the conversation.

More
14 years 1 week ago #25730 by Miselph
Replied by Miselph on topic Re:User M codes not working
Fixed it. Turns out that the file name needs to be M101 without any extension.

Please Log in or Create an account to join the conversation.

More
14 years 1 week ago #25742 by andypugh
Miselph wrote:

Fixed it. Turns out that the file name needs to be M101 without any extension.

I also think that #!/bin/bash ought to be the first line in the file.

Please Log in or Create an account to join the conversation.

More
14 years 6 days ago #25833 by TarHeelTom

Miselph wrote: Fixed it. Turns out that the file name needs to be M101 without any extension.


If memory serves me correctly, M codes are case sensitive. On my system M101 would work, but m101 would not.

The answer is to create a duplicate file with the file name "m101".


Tom

Please Log in or Create an account to join the conversation.

More
14 years 6 days ago - 14 years 5 days ago #25840 by BigJohnT
M100-199 codes are not case sensitive, however after you create a new M100-199 file you must restart the GUI or you will get the "Unknown m code used" error which can lead to confusion.

Edit: the file name is case sensitive and must use a capitol M.

John
Last edit: 14 years 5 days ago by BigJohnT.

Please Log in or Create an account to join the conversation.

More
14 years 5 days ago #25869 by Miselph
Replied by Miselph on topic Re:User M codes not working
I have been doing some tests regarding case sensitivity.
Whilst M codes themselves are not case sensitive the linux filesystem IS.

If the file is named M101 then it works regardless of if you use a capital letter or not in the MDI panel, but if the file is named m101 then it doesn't work at all.

Also andypugh is correct; technically the #/bin/bash bit should come first (although my files are working anyway, but I shall change them when I get a chance)

Thanks everyone.

Please Log in or Create an account to join the conversation.

Time to create page: 0.135 seconds
Powered by Kunena Forum