Machsupport Forum
Mach Discussion => VB and the development of wizards => Topic started by: M250cnc on January 14, 2010, 11:33:40 AM
-
I have it named MacroPump.1ms
I have the use macro pump box ticked on the Config General Config page
It runs correctly if i open it with the Mach VB script editor
Anyone have any ideas what's wrong ?
Phil
-
Make sure it is the same folder as your profile name:
If you load "myprofile" it will be in:
C:\Mach3\macros\myprofile\macropump.m1s
Also you have to restart Mach after checking the macropump box.
-
Thanks Jason
It is in the profile folder, & Mach has been restarted.
Is there any other way of checking that its working other than what it is supposed to do ?
Phil
-
Put this in the Macropump to check:
i=i+1
message "Macro Running #"&i
it will show you in Mach’s statues line how many times the macro has ran.
-
Thanks Jason,
It does run. ;D
It just doesn't like my macro, there are only 4 lines. ::)
If(GetLED(801)=1)Then
DOOEMBUTTON (1021)
MESSAGE " Went Into Inch Mode"
end if
No laughing. :-[
Phil
-
You'll need to use "GetOEMLED"... but more important use "True/False":
Dim Inch_LED_boolean As Boolean
Dim Inch_LED_interger As Integer
Inch_LED_boolean = GetOEMLED(801)
Inch_LED_interger = GetOEMLED(801)
MsgBox "boolan "&Inch_LED_boolean
MsgBox "Number "&Inch_LED_interger
'Number way
If(Inch_LED_interger = -1)Then
MsgBox "Number lookup"
End If
'Boolean way
If(Inch_LED_boolean = True)Then
MsgBox "boolean lookup"
End If
'Boolean way with out ==
If(Inch_LED_boolean)Then
End If
'Boolean way with out ==
If Not(Inch_LED_boolean)Then
End If
-
Jason,
Thanks i got the macropump to work, but now it resets itself and just leaves my message i want it to stay in reset mode.
Obviously VB scripting is not an area where i excel, do i need an else somehow :-[
Phil
-
Great,
You can put a sleep in there to clear the message.
Dim Inch_LED_boolean As Boolean
Inch_LED_boolean = GetOEMLED(801)
If(Inch_LED_boolean = True)Then
MESSAGE " Went Into Inch Mode"
Sleep(2000)'2 seconds
MESSAGE ""
End If
...you might want to use a userlabel or ticker as well as well.
In Screen4 you'll want to drop a Userlabel or ticker:
SetUserLabel 12, "You must enter a whole number of holes"
SetTicker 205, "This is a very long error message because you seem to have done something very silly"
-
Hi Jason,
Thanks for your patience in helping this dummy. :-[
I want the message to stay i just want the event once its happened to leave the machine disabled until i reset the machine.
Is that possible.?
Phil
-
Hi Phil,
Let me get a better idea of sequence of events.
If the machine goes into Inch mode, no matter what it is doing Estop(reset) the system, send a message about being in Inch mode and wait for a "reset" before removing the message?
Are you using the VB popup message display or the Mach label message display?
Jason
-
Hi Jason,
All correct in your observation and i am using the Mach label message display.
Phil
-
I give the user 2 seconds to change it to MM after the estop is hit or it estops the sytem again.
Dim Inch_mode As Boolean
Dim Estopped As Boolean
Estopped = GetOEMLED(800)
Inch_mode = GetOEMLED(801)
If(Inch_mode)Then
'Is the sytem estopped already
If Not(Estopped)Then
'Estop system
DoOEMButton(1021)
End If
While(GetOEMLED(800))
MESSAGE "Went Into Inch Mode:"&i
sleep(250)
Wend
'Give the user time to change to mm?
Sleep(2000)
End If
-
Hi Jason,
Thank you so much, it beats checking a custom screen with a flashing red led 25mm x 50mm while turning the MPG. ;D
It's so easy when you know how, i would never have got that.
Phil
-
Great to hear!
I wasn't sure that was what you wanted, but you can make changes and maybe have it force it back to MM mode or something :)
-
Jason,
I can understand the workings, with a bit of thought :-[, but why fix something that isn't broke. ;D ;D ;D
Phil