Welcome, Guest. Please login or register.
Did you miss your activation email?
October 23, 2014, 12:10:16 PM

Login with username, password and session length
Search:     Advanced search
* Home Help Search Calendar Links Login Register
+  Machsupport Forum
|-+  Mach Discussion
| |-+  VB and the development of wizards
| | |-+  VB syntax
Pages: 1 2 3 »   Go Down
Print
Author Topic: VB syntax  (Read 4386 times)
0 Members and 1 Guest are viewing this topic.
MachineMaster
Active Member

Offline Offline

Posts: 151


View Profile
« on: March 18, 2009, 12:28:18 PM »

OK, I'm new at this so I am askin for help. I printed out the Mach Script Language Reference, all 139 pages.
I now have a macro that I have written.

a = GetVar (500)
b = GetVar (501)
c = GetVar (502)
d = GetVar (503)

a= a+1
If a>9 Then b=b+1
If a>9 Then a=0

If b>9 Then c=c+1
If b>9 Then b=0

If c>9 Then d=d+1
If c>9 Then c=0   

Print " " &d &c &b &a
SetVar 500, a
SetVar 501, b
SetVar 502, c
SetVar 503, d
End

I had help writing it. The reason I am writing is this macro does what I need but no where in the 139 pages do I find
GetVar, SetVar or a reference to variables in the 500 - 600 range being persistent.
That leads me to think that the 139 pages that I printed are not what I should be studying.
Where do I find the REAL language reference?

Darrell
Logged
ger21
Global Moderator
*
Offline Offline

Posts: 3,984



View Profile WWW
« Reply #1 on: March 18, 2009, 12:37:03 PM »

http://www.machsupport.com/MachCustomizeWiki/index.php?title=Mach_specific_Subroutines/Functions_grouped_by_purpose
Logged

poppabear
S S SYSTEMS, LLC
Global Moderator
*
Offline Offline

Posts: 2,101


Briceville, TN, USA


View Profile WWW
« Reply #2 on: March 18, 2009, 12:48:59 PM »

note you have to put a "End If" to follow your If statements. i.e.

if a<(a+1) then
your code here
end if

scott
Logged

Commercial Mach3 & Mach 4, Design/Build/Retrofit CNC and Industrial machines.
https://sites.google.com/site/sssystemsautomation/
MachineMaster
Active Member

Offline Offline

Posts: 151


View Profile
« Reply #3 on: March 18, 2009, 01:18:58 PM »

Scot,
Do you mean an End If after every If statement or an End If after the last If statement in my code?
Logged
poppabear
S S SYSTEMS, LLC
Global Moderator
*
Offline Offline

Posts: 2,101


Briceville, TN, USA


View Profile WWW
« Reply #4 on: March 18, 2009, 01:28:00 PM »

after every if
Logged

Commercial Mach3 & Mach 4, Design/Build/Retrofit CNC and Industrial machines.
https://sites.google.com/site/sssystemsautomation/
ger21
Global Moderator
*
Offline Offline

Posts: 3,984



View Profile WWW
« Reply #5 on: March 18, 2009, 02:29:15 PM »

If it's on one line, you shouldn't need an End If. At least you don't in regular VB.
Logged

MachineMaster
Active Member

Offline Offline

Posts: 151


View Profile
« Reply #6 on: March 18, 2009, 06:55:52 PM »

Thanks for all the replies. I am still looking for a good language reference. The Wiki page mentioned does have information not in the Mach Script Language Reference but there still seems to be a lot missing. Most needed for me are actual examples.
I am still not sure if I am supposed to be looking for VB Scripting or VB Programming or is there a difference?
Is VB something I need to buy or is there a free version?
Programming Macros interests me a lot as I have been using AHHA software's built in macro language for years and this looks to have even more possibilities.
Logged
vmax549
Guest
« Reply #7 on: March 19, 2009, 08:59:54 PM »

Darrel there is NOT alot published on the EXTRAS that were added in .  THere is a little in the Customising Mach manual that gives the very basics.

You just have to ask if you need to know something and HOPEFULLY someone has already figured out a way.  OR collectively we work on it to come up with a solution or two. (;-)

Hopefully someone creative willl come along and take ALL the post and sort through them and put them in a search engine type arrangement, then we may have a decent library of functions .

Just a thought, (;-) TP
Logged
MachineMaster
Active Member

Offline Offline

Posts: 151


View Profile
« Reply #8 on: March 20, 2009, 02:11:31 PM »

I have been unable to find any where the syntax for using variables in G code in a Macro.
I can declare a variable
V= GetVar (550)
and Print V will print the value that I have stored in 550 but if I use

V= GetVar (550)
Code "G90 G00 XV YV" or
Code "G90 G00 X&V Y&V"

it runs ok in the script window but Mach gives the error

No digits found where real number should be

What am I doing wrong?
Logged
ger21
Global Moderator
*
Offline Offline

Posts: 3,984



View Profile WWW
« Reply #9 on: March 20, 2009, 02:26:47 PM »

Try this:

Code "G90 G00 X " &V & " Y " &V
Logged

Pages: 1 2 3 »   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!