586,082 active members*
3,831 visitors online*
Register for free
Login
Results 1 to 5 of 5
  1. #1
    Join Date
    Sep 2011
    Posts
    26

    VB Syntax errors for no reason?

    Z-touch plate code from CNCrouterparts.


    This is copied right off their website. I'm getting a syntax error on the 2nd period of the first line. Which makes no sense to me, random syntax errors in the entire thing. I feel like im doing something wrong and its not the code?

    Message( "Auto Zeroing..." )
    If IsSuchSignal (22) Then
    code "G31 Z-3 F20"
    While IsMoving()
    Wend
    Call SetDRO( 2, 1.00 )
    code "G1 Z1.5"
    End If

  2. #2
    Join Date
    Apr 2009
    Posts
    2

    Re: VB Syntax errors for no reason?

    I have no experience with programming Mach, but I would suspect "fancy" quotes are being used, instead of standard ones. Try replacing all the double-quotes with standard ones using Notepad or another plain text-editor (i.e. not a word-processor). What you pasted seems to have standard quotes, but that could be the result of filtering by the forum software.

  3. #3
    Join Date
    Oct 2008
    Posts
    1

    Re: VB Syntax errors for no reason?

    TTBOMK, there is no "Message" command or function in VB. There is a "Msgbox" function which displays a message for the user. Try putting a single quotation mark (') in front of "Message" to comment it out and then check if the code works.

  4. #4
    Join Date
    Mar 2003
    Posts
    35538

    Re: VB Syntax errors for no reason?

    Sprinter, there is a Message function in Mach3's scripting language (Cypress Enable).


    Try it like this:

    Message "Auto Zeroing..."
    Gerry

    UCCNC 2017 Screenset
    http://www.thecncwoodworker.com/2017.html

    Mach3 2010 Screenset
    http://www.thecncwoodworker.com/2010.html

    JointCAM - CNC Dovetails & Box Joints
    http://www.g-forcecnc.com/jointcam.html

    (Note: The opinions expressed in this post are my own and are not necessarily those of CNCzone and its management)

  5. #5
    Join Date
    Jul 2011
    Posts
    37

    Re: VB Syntax errors for no reason?

    >>> This is copied right off their website <<<

    FYI, program compilers and interpreters don't give a rip what you think is right or what someone's website claims to be right.
    If the syntax is wrong or the command is wrong, it is wrong. Where the common moral axiom is "it's all in how you interpret
    it" is so often flouted as truth, in programming, such a sentiment results in a head slap from Special Agent Leroy Jethro Gibbs. :-)
    As far as the compiler or interpreter is concerned, syntax is absolute truth and there is no room for your interpretation or misunderstanding.

    You need to know two things:
    1. What the code is supposed to do.
    2. How to debug code.

    1. What the code is supposed to do.

    As far as the Visual Basic MessageBox command is concerned, that is not relevant because you are not dealing
    with a pop up message box. You are issuing a Message which is displayed in the status window so
    that the operator knows what the program is currently doing. A MessageBox would likely halt the program
    until a button was clicked.

    Based on my limited Google search: Message( "Auto Zeroing..." ) appears to be correct syntax.

    2. Debugging code:

    Is there G-Code on lines prior to the Message command?

    As odd as this may sound, sometimes the interpreter will issue an error
    on a given line at a particular character that has nothing to do with the
    actual line with the bug and when the error is in fact in code above the
    line indicated.

    The easiest way, though time consuming, to find the code that is actually creating the error is to
    first comment out the line that is indicated. if the program runs, then that is the line where the bug
    is located. If that is not the actual bug line, then the error message will stop on the line beneath
    the commented out line. Once you have confirmed that the line in question is not buggy using
    this method, begin commenting out each line above it until the program stops giving error messages.
    When this happens, the last line commented out is the line with the bug.

    This should help you find your bug.
    Take Care.
    SAT

Similar Threads

  1. Replies: 1
    Last Post: 01-03-2014, 08:58 AM
  2. Syntax check???
    By barbter in forum NCPlot G-Code editor / backplotter
    Replies: 1
    Last Post: 10-14-2011, 05:44 PM
  3. DNC problem syntax errors
    By nealg in forum HURCO
    Replies: 0
    Last Post: 12-19-2008, 04:58 PM
  4. Need help with VB script Syntax Please.
    By Adamj12b in forum Mach Software (ArtSoft software)
    Replies: 6
    Last Post: 09-18-2008, 01:18 PM
  5. Need a bit of help identifying some syntax
    By ethyrial in forum G-Code Programing
    Replies: 3
    Last Post: 07-24-2008, 03:05 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •