Machsupport Forum

Mach Discussion => Mach4 General Discussion => Topic started by: stevehuck on August 22, 2021, 04:38:48 PM

Title: Can't save edited screen load script
Post by: stevehuck on August 22, 2021, 04:38:48 PM
Trying to add a cycle start button. Found an old thread telling how to edit the file to make the button work. I do the edits and get an error trying to save. Access error, cannot save file. I have not registered the Mach4 yet as the docs say to get everything working first. Could that be stopping me from a save. I do start the program in administrator mode. Any ideas as to why I would not be allowed to save a script?

Title: Re: Can't save edited screen load script
Post by: Greekart on August 22, 2021, 04:49:29 PM
Trying to add a cycle start button. Found an old thread telling how to edit the file to make the button work. I do the edits and get an error trying to save. Access error, cannot save file. I have not registered the Mach4 yet as the docs say to get everything working first. Could that be stopping me from a save. I do start the program in administrator mode. Any ideas as to why I would not be allowed to save a script?

No idea what are you doing and not save, not have something with not registered. Only thing i did was:
Add button
Add at left up script
Code: [Select]
CycleStart()Save script and close
Save screen and exit edit
Load gcode and mouse click on new button
Title: Re: Can't save edited screen load script
Post by: stevehuck on August 22, 2021, 05:07:48 PM
I added a physical button in the control panel door. Then I mapped it thru the ESS and in mach4. If I go to the diagnostic screen and press the button the light for input0 lights. I read on the forum that the screen load file needs to be edited to associate the input0 button press with a cycle start to make the button work. I found the example in the file rem'd out. I made the changes to the script and when I tried to save the script I was denied.
Title: Re: Can't save edited screen load script
Post by: Greekart on August 22, 2021, 05:15:12 PM
I added a physical button in the control panel door. Then I mapped it thru the ESS and in mach4. If I go to the diagnostic screen and press the button the light for input0 lights. I read on the forum that the screen load file needs to be edited to associate the input0 button press with a cycle start to make the button work. I found the example in the file rem'd out. I made the changes to the script and when I tried to save the script I was denied.

This is something different..
At screen load script add or edit an already that is not used like this:
Code: [Select]
[mc.ISIG_INPUT0] = function (state)
    if (state == 1) then   
CycleStart()
   end
end,

If you show the code you try to change it would be better to find the error, lua language is not forgiving about grammar errors.
Title: Re: Can't save edited screen load script
Post by: thosj on August 22, 2021, 05:37:22 PM
You ARE editing the screen load script in the screen editor, correct? Not trying to edit some LUA file outside Mach4?

If so, just add a comment line somewhere, like:

--Comment to test

Save. Can you save?
Title: Re: Can't save edited screen load script
Post by: stevehuck on August 22, 2021, 05:39:44 PM
[mc.ISIG_INPUT0] = funtion (state)
    if (state == 1) then
        cyclestart()
    else
        mc.mcCntlFeedHold (0)
    end
end


This is what I believe the UnRemmed version would be based on my needs. I could be wrong I am used to VB script.



Yes I am editing inside of mach4 with the editor by clicking the "operator" tab and then "open script editor".

No I cannot save. tried at least half a dozen times
Title: Re: Can't save edited screen load script
Post by: Greekart on August 22, 2021, 05:45:05 PM
[mc.ISIG_INPUT0] = funtion (state)
    if (state == 1) then
        cyclestart()
    else
        mc.mcCntlFeedHold (0)
    end
end

This is what I believe the UnRemmed version would be based on my needs. I could be wrong I am used to VB script.

At the second "end" must have a "," if is not the last.
Code: [Select]
    end
end,
The "cyclestart()" need to be with capital c "Cyclestart() "
Title: Re: Can't save edited screen load script
Post by: stevehuck on August 22, 2021, 05:57:26 PM
Here is the code I tried and the error I get trying to save

Title: Re: Can't save edited screen load script
Post by: Greekart on August 22, 2021, 06:02:38 PM

Yes I am editing inside of mach4 with the editor by clicking the "operator" tab and then "open script editor".

No I cannot save. tried at least half a dozen times

Now i see it, no don't use "open script editor". Just go in "operator" and "edit screen" option.
Then you select the first selection at left and go to load script.
Title: Re: Can't save edited screen load script
Post by: Greekart on August 22, 2021, 06:04:11 PM
Check the picture
Title: Re: Can't save edited screen load script
Post by: stevehuck on August 22, 2021, 06:14:58 PM
I assume I should change mine to match yours?


Title: Re: Can't save edited screen load script
Post by: Greekart on August 22, 2021, 06:17:57 PM
I assume I should change mine to match yours?
Right of "Screen load Script" where says "pageid=0" if you click once with the mouse will get some "..." click there and will open the editor of load script.
There you will make the changes you want
Title: Re: Can't save edited screen load script
Post by: stevehuck on August 22, 2021, 06:37:12 PM
That did the trick! Cycle start button is working.

Here is what I ended up with.

[mc.ISIG_INPUT0] = funtion (state)
    if (state == 1) then
        Cyclestart()
    end
end

Thank you for taking the time to help. Much appreciated. Now I have a few other things to fix and I will be able to start making parts!!
Title: Re: Can't save edited screen load script
Post by: Greekart on August 22, 2021, 06:39:16 PM
That did the trick! Cycle start button is working.

Here is what I ended up with.

[mc.ISIG_INPUT0] = funtion (state)
    if (state == 1) then
        Cyclestart()
    end
end

Thank you for taking the time to help. Much appreciated. Now I have a few other things to fix and I will be able to start making parts!!

No problem, wish you the best!