Hello Guest it is April 27, 2024, 12:12:58 AM

Author Topic: The basics of making a switch run a script?  (Read 16225 times)

0 Members and 1 Guest are viewing this topic.

Re: The basics of making a switch run a script?
« Reply #20 on: July 06, 2006, 12:35:20 PM »
Sorry i missed the End sub... It is hard to go from C++ to VB :(  I know this is not as simple as you would like but this gives you the most power...

Sub Main()

if (GetLED(4)) Then'This is where the Macro is told not to run if there is a job running
MsgBox("Could Not load there is a Job running")
Exit Sub
End if

'TODO add Macro code here
End Sub
Main

Tried this method, works the same way the IF THEN ELSE method i tried earlier, if you press it two times fast, it runs 2 times, if you press it 3 times fast it runs two times and the third displays the message box.
BTW, i tried it with the ISMoving command because my script does not load a file and run it, and my screen does not have a led 4. might this be the problem...
Im starting to think about a workaround, have a led light up at the begining of my script, and turn off at the end, and check for that lead instead.
Regards
Fernando
Re: The basics of making a switch run a script?
« Reply #21 on: July 06, 2006, 12:58:09 PM »
Ok I tried this with the same results as the previous two versions:

Sub Main()

if (GetUserLED(1000)) Then'This is where the Macro is told not to run if there is a job running
MsgBox("Could Not load there is a Job running")
Exit Sub
End if

SetUserLed(1000,1)
Code "F1350"
Code "G01 x100"
Code "G01 X0"
While IsMoving()
Wend
SetUserLed(1000,0)
End Sub
Main
Re: The basics of making a switch run a script?
« Reply #22 on: July 06, 2006, 02:56:20 PM »
I have found a way but it is using the Macro pump  as well as a few LED's
Fixing problems one post at a time ;)

www.newfangledsolutions.com
www.machsupport.com
Re: The basics of making a switch run a script?
« Reply #23 on: July 10, 2006, 01:54:38 AM »
I guess I can wait till you get around to buffered comands.
Any ideas on why all the scripts I tried worked the way they did?
Cant think of any reason why they only work when pressed more than 2 times fast.
regards
Fernando