Hello Guest it is August 19, 2019, 08:40:24 AM

Author Topic: vb script tutorial help  (Read 388 times)

0 Members and 1 Guest are viewing this topic.

vb script tutorial help
« on: May 29, 2019, 03:05:16 PM »
Hi
i have been getting some help from one of the forum members with Macro's for which I'm very grateful.  I would like to learn for myself instead of bothering other people.
Can anyone point me to books ,video tutorial etc .i just want to get the basics so i can make and alter macro's.

cheers

Online Tweakie.CNC

*
  • *
  •  7,884 7,884
  • Super Kitty
    • View Profile
    • Tweakie.CNC
Re: vb script tutorial help
« Reply #1 on: May 30, 2019, 01:31:17 AM »
There is a lot of information, including examples, in the Mach2 Customisation Manual and this may be a good tutorial to start with.

 https://www.machsupport.com/wp-content/uploads/2013/02/Mach2_6.11_Custom.pdf

Tweakie.

Success consists of going from failure to failure without loss of enthusiasm.  Winston Churchill.

Offline TPS

*
  •  1,375 1,375
    • View Profile
anything is possible, just try it.
if you find some mistakes, in my bad bavarian english,they are yours.
Re: vb script tutorial help
« Reply #3 on: July 17, 2019, 03:22:52 PM »
Hi- 1st post ever on anything but I'm desperate!  To the point-I have what I'm sure is a simple problem in getting macros to run.  I programmed for a living and have looked up every reference to scripting in every Mach2&3 manual online and can't find any solution for what I am sure is a simple(but elusive) problem. The VB Script editior, final version of mach3, will run w/o error: setvar(100,Getvar(101)+3) M99 as a stand alone snippet of code in a macro I named M881.m1s.  Using the Operator/#var monitor, I can verify the read/write results.  First problem, which may bear on a second problem,  If I place M99 on the line following the set/get,

setvar(100,Getvar(101)+3)
M99

the change of placement  of m99 generates a compile error.  Why???  I want to adjust #vars in g code program using conditional logic in my macro but when I embed my working setvar/getvar  in a simple  IF- Then- End if, I get compile and syntax errors in the Msg bar on the mach3 screen - the script writer (debugger) provides no clue as to what is generating the errors. I have tried placing the m99 at every conceivable location/s but to know avail.   NFS help desk banished be to the forums for a solution.  I hope that stepping into this thread isn't violating forum etiquette. If so, please offer kindly guidance on where to start. Thanks!

Offline TPS

*
  •  1,375 1,375
    • View Profile
Re: vb script tutorial help
« Reply #4 on: July 19, 2019, 02:12:29 AM »
setvar(100,Getvar(101)+3)
Code "M99"

anything is possible, just try it.
if you find some mistakes, in my bad bavarian english,they are yours.

Offline BR549

*
  •  6,886 6,886
    • View Profile
Re: vb script tutorial help
« Reply #5 on: July 30, 2019, 06:28:34 PM »
What exactly are you hoping to do with teh M99 call?? Teh M99 cal is  a Gcode call to return to teh M98 calling line. It does nothing in a macro as there is nothing to return to. IF you are trying to return to teh Gcode program you would use

Code"M98 Pnnn" where nnn is teh Oword marker you place in teh Gcode program as a return point which is placed on teh line after teh conditional macro call. OR where ever you want to return to in teh gcode

Hope that helps, (;-) TP