Home
Downloads
Mach3
Plugins
CAM Post Processors
Screensets
Purchase
Support
Forum
Tutorial Videos
Documentation
Yahoo Group
Mach Wiki
Resources
Contact Us
Links
CNCZone
German Forum
Italian Forum
Korean Forum
Portugese (Brazil) Forum
Russian Forum (RSK CNCROUTER)
Thai Forum
Welcome,
Guest
. Please
login
or
register
.
Did you miss your
activation email?
May 28, 2012, 12:55:54 PM
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
Search:
Advanced search
Select from and to languages
Chinese-simp to English
Chinese-trad to English
English to Chinese-simp
English to Chinese-trad
English to Dutch
English to French
English to German
English to Greek
English to Italian
English to Japanese
English to Korean
English to Portuguese
English to Russian
English to Spanish
Dutch to English
Dutch to French
French to English
French to German
French to Greek
French to Italian
French to Portuguese
French to Dutch
French to Spanish
German to English
German to French
Greek to English
Greek to French
Italian to English
Italian to French
Japanese to English
Korean to English
Portuguese to English
Portuguese to French
Russian to English
Spanish to English
Spanish to French
Machsupport Forum
Mach Discussion
VB and the development of wizards
Possible to have 1 external button that runs previous VB script that was run?
Pages:
1
Go Down
« previous
next »
Author
Topic: Possible to have 1 external button that runs previous VB script that was run? (Read 1344 times)
0 Members and 1 Guest are viewing this topic.
Darc
Active Member
Offline
Posts: 177
Possible to have 1 external button that runs previous VB script that was run?
«
on:
April 22, 2007, 04:00:01 PM »
Yep me again, is it possible to have 1 external button (much the same as a cycle start), that will run the previous VB script that was run?
I have multiple buttons that all have there own script, but I was thinking it would be nice if you could click the correct button on the screen for the first time, then after that the user could just keep pressing this external button, until a different script is needed etc.etc.
Thanks
Logged
poppabear
S S SYSTEMS, LLC
Global Moderator
Offline
Posts: 1,707
Briceville, TN, USA
Re: Possible to have 1 external button that runs previous VB script that was run?
«
Reply #1 on:
April 22, 2007, 06:19:01 PM »
OK, it is me again..........too.........
Do this, drop an Led next to each of your buttons on the main screen, when ever you push one of the buttons, its associated led turns on, it also turns all others off.
Then in your external button, have your Macro pump monitor it, i.e.
'Macropump.m1s
If IsActive(INPUTx) Then 'this is your external button input pin
If GetUserLED(1001) Then 'your button fuction 1 LED
VB Script of that button here......
End If
If GetUserLED(1002) Then '2cd button script Led
VB Script for 2cd button here.....
End If
If GetUserLED(1003) Then '3rd button action led
VB Script for 3rd button here........
End If
End If
'You could also use a Case Statement if more complex....
Scott
Logged
Commercial Mach3: Screens (regular and flash), Wizards, Plug-ins, Brains, PLCs, Macros, ATC's, machine build, retrofit and Prototyping
http://sites.google.com/site/volunteerfablab/
Darc
Active Member
Offline
Posts: 177
Re: Possible to have 1 external button that runs previous VB script that was run?
«
Reply #2 on:
April 23, 2007, 07:51:24 PM »
You my friend are a freakin genius, it works great.
BTW in my script I have it turn OFF all LED's at the start e.g
SetUserLED (1001,0)
SetUserLED (1002,0)
etc.etc
I have it do this for 24 individual LED's is there a more efficient way of doing this?
Also how can I enter this into the MacroPump so it will turn OFF all LED's when Mach starts only, rather that making them OFF all the time?
I only ask this because if I estop the sytem when a script is running, my LED's stay on until I run the script again, and it reaches the end of it where I tell the LED's to turn OFF.
......Well my wife's always telling me I'm high maintenance.......
Logged
poppabear
S S SYSTEMS, LLC
Global Moderator
Offline
Posts: 1,707
Briceville, TN, USA
Re: Possible to have 1 external button that runs previous VB script that was run?
«
Reply #3 on:
April 23, 2007, 11:22:15 PM »
Genius, not really, that belongs to Art and Brian, and several others here, but, try the below.
BTW: I dont know of a more effeincet way of turning off those 24 leds, other than what you are doing.
To turn them all off with the macro pump only once your going to have to lock them out.
Put this piece in your Macro pump some where at the top. Note you will have to also put a "Renew LED" called (1200, or what ever), some where as well.
'add to top of macro pump
x=GetUserDro(1200)
If X=0 then
'put your turn off all led stuff here
x=x+1 'this adds 1 to x, so this script only runs once (unless see below).
End If
If X>0 and GetuserLED(1200) Then 'you have pushed the renew button this will reset X to 0
SetUserDro(1200,0)
End If
'Note: the above renew/reset is really only meant to re-run the off all 24, or to set the DRO
'back to 0, for persistant dros....... The macro pump will re-hit it while running faster
'than you can reset it. It is really just to reset your DRO to Zero.
Logged
Commercial Mach3: Screens (regular and flash), Wizards, Plug-ins, Brains, PLCs, Macros, ATC's, machine build, retrofit and Prototyping
http://sites.google.com/site/volunteerfablab/
Darc
Active Member
Offline
Posts: 177
Re: Possible to have 1 external button that runs previous VB script that was run?
«
Reply #4 on:
April 24, 2007, 01:38:15 AM »
Thanks Scott, is it possible to emulate a key being pressed?
I thought it may be easier, it'd save a lot of code in my MacroPump (Lazy I know), something like:
'Macropump.m1s
If IsActive(INPUT1) Then
If GetUserLED(1001) Then
Emulate pressing hotkey 110 (example only)
End If
If GetUserLED(1002) Then
Emulate pressing hotkey 111 (example only)
End If
End If
Also on another note, I might start a post where you VB guru's can offer tid bits of code e.g Set UserLED(1000,1) with a short description and example.
But mostly for the more complex equations. thoughts?
At least I wouldn't have to bug you guys as much.
«
Last Edit: April 25, 2007, 03:53:57 AM by Darc
»
Logged
poppabear
S S SYSTEMS, LLC
Global Moderator
Offline
Posts: 1,707
Briceville, TN, USA
Re: Possible to have 1 external button that runs previous VB script that was run?
«
Reply #5 on:
April 24, 2007, 07:43:33 AM »
Yes, look in the Mach OEM buttons codes on the wiki.
To emulate a button, put:
DoOEMButton(*********) (Some people use "DoButton" also, so if the OEM doesnt work use that one).
There is not a range of codes for "User Buttons", you can only emulate OEM codes. NOTE, this does NOT work on Jogs.
Scott
Logged
Commercial Mach3: Screens (regular and flash), Wizards, Plug-ins, Brains, PLCs, Macros, ATC's, machine build, retrofit and Prototyping
http://sites.google.com/site/volunteerfablab/
Pages:
1
Go Up
« previous
next »
Jump to:
Please select a destination:
-----------------------------
Mach Discussion
-----------------------------
=> General Mach Discussion
=> Mach3 under Vista
=> Quantum
=> Mach SDK plugin questions and answers.
===> Finished Plugins for Download
=> VB and the development of wizards
=> Brains Development
=> Video P*r*o*b*i*n*g
=> Mach Screens
===> Screen designer tips and tutorials
===> Works in progress
===> Finished Screens
===> Flash Screens
===> JetCam screen designer
===> Machscreen Screen Designer
===> CVI MachStdMill (MSM)
=> Feature Requests
=> Non English Forums
===> Italian
===> French
===> Spanish
===> Chinese
===> German
===> Russian
===> Romanian
===> Japanese
===> Vietnamese
=> FAQs
-----------------------------
*****VIDEOS*****
-----------------------------
=> *****VIDEOS*****
-----------------------------
General CNC Chat
-----------------------------
=> Share Your GCode
=> Show"N"Tell ( What you have made with your CNC machine.)
=> Building or Buying a Wood routing table.. Beginnners guide..
=> Show"N"Tell ( Your Machines)
-----------------------------
G-Code, CAD, and CAM
-----------------------------
=> G-Code, CAD, and CAM discussions
=> LazyCam (Beta)
-----------------------------
Third party software and hardware support forums.
-----------------------------
=> LazyTurn
=> GearoticMotion Preliminary testing
=> Tempest Trajectory Planner
=> Contec
=> dspMC/IP Motion Controller
=> HiCON Motion Controller
=> Third party software and hardware support forums.
=> Galil
=> Newfangled Solutions Wizards
=> Mach3 and G-Rex
=> Mesa
=> Modbus
=> NC Pod
=> PoKeys
=> SmoothStepper USB
=> Sieg Machines
=> Promote and discuss your product
-----------------------------
Tangent Corner
-----------------------------
=> Tangent Corner
=> Competitions
=> Polls
=> Bargain Basement
-----------------------------
Support
-----------------------------
=> Downloads
===> XML files
===> Post Processors
===> Macros
===> Tutorials
===> Others
===> Beta Brains
===> Screen Sets
===> Documents
===> MACH TOOL BOX
=> One on one phone support.
=> Forum suggestions and report forum problems.
-----------------------------
Mach4
-----------------------------
=> Mach4 pre-Alpha Testing
Loading...