Machsupport Forum

Mach Discussion => Mach Screens => Topic started by: mike^3 on March 22, 2014, 04:41:08 PM

Title: How to make a popup when a button is selected?
Post by: mike^3 on March 22, 2014, 04:41:08 PM
Hello,

Can anyone help me make an onscreen button pop up a message? Once you hit OK then the box will disappear?

I just need the VB script to say "Make sure Turret UP button is pressed before homing turret!"

Thank you!

Mike
Title: Re: How to make a popup when a button is selected?
Post by: ger21 on March 22, 2014, 04:50:27 PM
msgbox ("Make sure Turret UP button is pressed before homing turret!")
Title: Re: How to make a popup when a button is selected?
Post by: mike^3 on March 22, 2014, 04:53:07 PM
Thanks, but I think I have a problem...the button I put was to home A. Can I put the Home A macro in the VB script after the msg box?

I would like to press the Home A button, have the msg pop up, click ok, then run the homing cycle for A.

Thanks ger!
Title: Re: How to make a popup when a button is selected?
Post by: ger21 on March 22, 2014, 05:00:21 PM
Yes. I think it's #24


msgbox ("Make sure Turret UP button is pressed before homing turret!")
DoButton(24)
Title: Re: How to make a popup when a button is selected?
Post by: mike^3 on March 22, 2014, 05:15:15 PM
DoButton(24) seems to home just the Z, what the number for A axis?
Title: Re: How to make a popup when a button is selected?
Post by: ger21 on March 22, 2014, 05:41:05 PM
Try 25
Title: Re: How to make a popup when a button is selected?
Post by: mike^3 on March 22, 2014, 06:56:04 PM
Can you have a command prompt with an ok or cancel in the dialog box? So I can cancel out of it instead of continuing the homing...?
Title: Re: How to make a popup when a button is selected?
Post by: ger21 on March 22, 2014, 07:38:16 PM
I'm not sure. You'll need to look through the examples in the Cypress Basic manual.
Title: Re: How to make a popup when a button is selected?
Post by: ger21 on March 22, 2014, 07:51:52 PM
Try this.

Response = MsgBox ("Warning !!!" & (Chr(13)) & ""Make sure Turret UP button is pressed before homing turret!" & (Chr(13)) & "Press OK To Continue" & (Chr(13)) & "Or Press Cancel to Exit ",49,"Press Turret Up Button!!")

   If Response = 1 Then ' If OK
      ' Continue Homing
      ElseIf Response = 2 Then ' If Cancel
      Exit Sub
   End If
Title: Re: How to make a popup when a button is selected?
Post by: mike^3 on March 22, 2014, 10:39:47 PM
Thanks! Let me try that real quick :)
Title: Re: How to make a popup when a button is selected?
Post by: mike^3 on March 22, 2014, 10:46:50 PM
nope doesnt work... its compile error :(
Title: Re: How to make a popup when a button is selected?
Post by: ger21 on March 22, 2014, 10:56:04 PM
There's a double "" before the Make sure Turret.............

Remove one of the quotes and it should work.

 I copied the code from my Autozero macro and just changed the text. It works in my macro.
Title: Re: How to make a popup when a button is selected?
Post by: mike^3 on March 22, 2014, 11:02:00 PM
k one sec ;)
Title: Re: How to make a popup when a button is selected?
Post by: mike^3 on March 23, 2014, 10:52:13 AM
Hrmm, still doesnt work...I can get the OK on the box, but not the cancel...when I press of, it just starts homing.

Can we write a script that just ...

Activate output 1
pause for 0.5seconds
Home A axis
wait for homing to end,
then deactivate output 1
change tool changer dro to 1

Can this be done?
Title: Re: How to make a popup when a button is selected?
Post by: ger21 on March 23, 2014, 11:39:12 AM
Try this. I just tested it and it works here. This is all you need, it contains the homing in the message box.


Response = MsgBox ("Warning !!!" & (Chr(13)) & "Make sure Turret UP button is pressed before homing turret!" & (Chr(13)) & "Press OK To Continue" & (Chr(13)) & "Or Press Cancel to Exit ",49,"Press Turret Up Button!!")

   If Response = 1 Then ' If OK
      DoButton(25)
      ElseIf Response = 2 Then ' If Cancel
      Exit Sub
   End If
Title: Re: How to make a popup when a button is selected?
Post by: mike^3 on March 23, 2014, 04:32:31 PM
Hey Ger21 would this work for an auto tool home and seat to tool 1?

 Sub Main()

Code "G53 G0 X0 Z0"

ActivateSignal(OUTPUT1)  'Raise Turret
Code "G4 P0.5"
While IsMoving ()       
Wend
DoButton(25)     
While IsMoving ()       
Wend

DeActivateSignal(OUTPUT1)  'Drop Turret

SetCurrentTool(1)
Code "G90"
End Sub