Sorry, my internet has been down for a while. As it turns out, there is nothing wrong with my code, and the limits aren't an issue. If I create a macro, and save it as a vbscript file, I can run it as many times as I want with no problem, but if I try to enter the script into the vbscript box on a button, it saves it ok, but when I try to run it from within Mach3 by clicking on the button I get a 'Compile Error' 'Invalid Syntax' or something like that.
I created a macro that will lower the Z axis until it touches my touchplate, then it retracts .252" (my plate is .498 thick), and sets the Z axis DRO to .750. It works EVERY time if I run it from the vbscript editing screen. I can copy the code and paste it into the vbscript box in Mach3Screen and save it, and when I look at the code in Mach3 it is identical. If I try to run it from the button I get a 'Compile Error' and it does nothing (except sometimes crash my computer).
I was initially using Screen4, but in that I haven't found any way to either change the code it is executing. Your choices are only to select what type of command, but for a vb script you can't tell it anything except to use a script edited in Mach3, and when you edit it there it won't save the new code. Every time you restart the code has reverted to what it has stored (sometimes, it will save it, I don't know why, but usually it doesn't)
I have also found that the While IsRunning(), Wend statement will lock my computer up completely (the only out is to pull the plug and restart) if it parses that line before the head starts moving. I had to put in a dummy argument to delay that line until the head had time to start moving.
Any ideas why it will run one way and not the other.