Welcome, Guest. Please login or register.
Did you miss your activation email?
May 28, 2012, 02:21:35 PM

Login with username, password and session length
Search:     Advanced search
* Home Help Search Calendar Links Login Register
+  Machsupport Forum
|-+  Mach Discussion
| |-+  VB and the development of wizards
| | |-+  The basics of making a switch run a script?
Pages: « 1 2 3   Go Down
Print
Author Topic: The basics of making a switch run a script?  (Read 4288 times)
0 Members and 2 Guests are viewing this topic.
fer_mayrl
Global Moderator
*
Offline Offline

Posts: 452


View Profile
« Reply #20 on: July 06, 2006, 11:35:20 AM »

Sorry i missed the End sub... It is hard to go from C++ to VB Sad  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
Logged
fer_mayrl
Global Moderator
*
Offline Offline

Posts: 452


View Profile
« Reply #21 on: July 06, 2006, 11:58:09 AM »

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
Logged
Brian Barker
Administrator
*
Offline Offline

Posts: 3,383



View Profile
« Reply #22 on: July 06, 2006, 01:56:20 PM »

I have found a way but it is using the Macro pump  as well as a few LED's
Logged

Fixing problems one post at a time Wink

www.newfangledsolutions.com
www.machsupport.com
fer_mayrl
Global Moderator
*
Offline Offline

Posts: 452


View Profile
« Reply #23 on: July 10, 2006, 12: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
Logged
Pages: « 1 2 3   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!