Hello Guest it is March 28, 2024, 09:01:59 PM

Author Topic: Wizard and VB Script questions (Brian Barker)  (Read 20439 times)

0 Members and 1 Guest are viewing this topic.

Wizard and VB Script questions (Brian Barker)
« on: January 13, 2006, 03:58:07 PM »
Hi all

Art ......First question for you! Is there a way of adding a user field for naming the file that he will be busy with ,instead of using the default name inside the vb script in the wizard.

The other questions are for any other members that are willing to help!!
I am busy with a specialised wizard for my company's use, it consist of three different simple operations.This is operations we use every day but to different measurements.
I've made three different pages in Screen designer to set the measurements. They are almost without bugs when used separately.

Now my problem.........I would love to throw all three's G code
together when exiting from the posting from the wizard instead of taking time to copy and paste.

The little I know about VB and wizards come from looking at other and then trying on my own, so I don't know as much as it sounds like.

Can some one assist me in some sample VB to link to pages and operations together.

Any help will be greatly appreciated.
Thanks for a stunning forum.

Deon Gerber.
 ???
If A is a success in life, then A equals X plus Y plus Z.
                               Work is X: Y is play and Z is keeping
                                                             your mouth shut.
Re: Wizard and VB Script questions (Brian Barker)
« Reply #1 on: January 13, 2006, 08:43:17 PM »
Deon,
Thank you for the post!
On the screen you are going to need to have a button to make a new File and this will have the open teach file that you have been using.

when you would like to add to the program you can use the AppendTeachFile "File.tap" .
For now get this running with the file.tap and we will worry about changing the name of the file latter:) For an example please look at the Teach wizard.

Please see what that will do for you and we will go from there, I think this is going to be fun to get this running for you!
Fixing problems one post at a time ;)

www.newfangledsolutions.com
www.machsupport.com
Re: Wizard and VB Script questions (Brian Barker)
« Reply #2 on: January 14, 2006, 07:12:38 AM »
Hi Brian

Thanks for the time and effort in trying to help. I also downloaded the VBScript manual at machsupport.com. I will see how far I get before getting stuck and will then again give you a shout.

Thanks
Deon ;D
If A is a success in life, then A equals X plus Y plus Z.
                               Work is X: Y is play and Z is keeping
                                                             your mouth shut.
Re: Wizard and VB Script questions (Brian Barker)
« Reply #3 on: January 14, 2006, 08:22:40 AM »
Anytime! I just need to see where you are at before I start telling you what to do :)

There are no dumb questions, other than the one that you didn't ask!
Fixing problems one post at a time ;)

www.newfangledsolutions.com
www.machsupport.com
Re: Wizard and VB Script questions (Brian Barker)
« Reply #4 on: January 14, 2006, 09:42:44 AM »
Hi Brian

Well this is how I am doing so far. Here follow some snips of VB I am using wth comments next to them in brackets. The comments is not included in the script , Thye are there for you to see what I am up to.


OpenTeachFile "turn.tap"
CloseTeachFile                                          (Button for adding user file name)
call LoadTeachFile()

OpenTeachFile "turn.tap"
Call DoOEMbutton (2)                               (Selecting first operation) 

OpenTeachFile "turn.tap"
Code "G18 G40 G49 G90 G94 G80"         (Starting Code for first operation)
G0 X100Z150
Code "M3"

G0 X100Z150
Code "M5"
CloseTeachFile
Call LoadTeachFile()                                  (End and posting Code for first operation)
Call DoOEMbutton(1)
End Sub

OpenTeachFile  "turn.tap"
Call LoadTeachFile()                                  (Selecting second operation)
Call DoOEMButton (3)

call LoadTeachFile()
appendTeachFile "turn.tap"
G0 X100Z150                                             (Starting code for second operation)
Code "M3"

G0X100Z150
Code "M5"
Code "M30"
CloseTeachFile                                           (Ending and posting second operation)
Call LoadTeachFile
End Sub
Main

Well now for what is hapening when I run the wizard. At the moment there are no VB errors given when run.

1.   The script for the File name button seems to work but I can't see some physical evedence of that. Again I guese it only uses the name in the script . As you said we will look at giving a user to enter a name at a later stage.

2.   It looks like the second operation over writes the first operation when posting. Maybe my sequence or somthing els is wrong.

Please have a look and get me on the right track.

Thanks
Deon
If A is a success in life, then A equals X plus Y plus Z.
                               Work is X: Y is play and Z is keeping
                                                             your mouth shut.
Re: Wizard and VB Script questions (Brian Barker)
« Reply #5 on: January 14, 2006, 09:48:17 AM »
Hi Brian

One other thing I noticed was that when going from the first to the second operation, the code and tool pathe dispay window of the second operation is empty .
The first operation are not displayed. Thats why I think it gets overwrited.

Thanks
Deon
If A is a success in life, then A equals X plus Y plus Z.
                               Work is X: Y is play and Z is keeping
                                                             your mouth shut.
Re: Wizard and VB Script questions (Brian Barker)
« Reply #6 on: January 14, 2006, 10:25:30 AM »
Try this :) as you can see I have changed "OpenTeachFile" to  "AppendTeachFile". you need one OpenTeachFile to start the file and after that you are going to stick everything on the end of the file.



OpenTeachFile "turn.tap"
CloseTeachFile                                          (Button for adding user file name)
call LoadTeachFile()

AppendTeachFile"turn.tap"
Call DoOEMbutton (2)                               (Selecting first operation)

AppendTeachFile "turn.tap"
Code "G18 G40 G49 G90 G94 G80"         (Starting Code for first operation)
G0 X100Z150
Code "M3"

G0 X100Z150
Code "M5"
CloseTeachFile
Call LoadTeachFile()                                  (End and posting Code for first operation)
Call DoOEMbutton(1)
End Sub

AppendTeachFile "turn.tap"
Call LoadTeachFile()                                  (Selecting second operation)
Call DoOEMButton (3)

call LoadTeachFile()
appendTeachFile "turn.tap"
G0 X100Z150                                             (Starting code for second operation)
Code "M3"

G0X100Z150
Code "M5"
Code "M30"
CloseTeachFile                                           (Ending and posting second operation)
Call LoadTeachFile
End Sub
Main

After you are all done with the file we are going to add a SAVE code button that will give you a chance to chnge the file name.
Fixing problems one post at a time ;)

www.newfangledsolutions.com
www.machsupport.com
Re: Wizard and VB Script questions (Brian Barker)
« Reply #7 on: January 14, 2006, 11:54:12 AM »
Hi Brian

You are a star. The Script runs like a dream adding everything together. Now last problem to solve.......The ability for the user to specify his own file name.

You must help because my head is full of holes solving the previous one.

Thanks
Deon
If A is a success in life, then A equals X plus Y plus Z.
                               Work is X: Y is play and Z is keeping
                                                             your mouth shut.
Re: Wizard and VB Script questions (Brian Barker)
« Reply #8 on: January 14, 2006, 12:23:32 PM »
Put this in a button :) This is going to make your head hurt ....

This should do it
Brian


Begin Dialog FILERENAME 15,42, 213, 62, "File Save"
  Text 20,12,60,12, "Enter File Name:"
  TextBox 84,12,100,12,  .EditBox_1
  OKButton 36,36,37,12
  CancelButton 136,36,37,12
End Dialog


Dim Dlg1 As FILERENAME
Dlg1.EditBox_1 = "*.tap"
Button = Dialog (Dlg1)
 If Button = 0 Then
    Exit Sub
 End If   
 Newfilename = "C:\Mach3\GCode\" + Dlg1.EditBox_1
 FileCopy "C:\Mach3\GCode\turn.tap", Newfilename 
 MsgBox ("File Saved to" &  Newfilename )
Fixing problems one post at a time ;)

www.newfangledsolutions.com
www.machsupport.com
Re: Wizard and VB Script questions (Brian Barker)
« Reply #9 on: January 14, 2006, 12:51:52 PM »
Hi Brian

Thanks for all the help. I realy do apreciate it. One last question befor I log of.

I have not as yet tried this but just for info , will it be possible to do safty alert with the ticker acros different pages in a wizard.

Thanks Again

Deon
If A is a success in life, then A equals X plus Y plus Z.
                               Work is X: Y is play and Z is keeping
                                                             your mouth shut.