×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Just a simple macro. Error running in batch mode

Just a simple macro. Error running in batch mode

Just a simple macro. Error running in batch mode

(OP)
Hi everybody,

I'm just starting working with CATIA macros, and I wrote my first CATScript. Just a simple one to open CATIA and to create a new part document and activate it. Please, see below the code. The problem is when I try to run it I get two errors. The first one, when I write in the command line

cd "C:\Program Files (x86)\Dassault Systemes\B19\intel_a\code\bin" CNEXT.exe -batch -macro "C:\Users\mjorge\Documents\iWork\Test.CATScript"

(believe me the path is correct) the message I receive is "The filename, directory name or volume label syntax is incorrect"

The second one, if I just click twice the CATScript file to execute it, it seems there is an error in line 29, the one in which appears Sub CATMain()!! How can it be wrong?? Any idea??

Thanks in advance...

Language="VBSCRIPT"
'-----
' Open CATIA Application
'-----
Function OpCATIA() As Object
    Dim CATIA As Object
    Set CATIA = CreateObject("CATIA.Application")
    CATIA.Visible = True

    Set OpCATIA = CATIA
End Function
'-----
' Create and activate new Part Document
'-----
Function GetCATIAPartDocument() As Object
    Set CATIA = OpCATIA
    Dim AuxPartDocument As Object

    CATIA.Documents.Add("Part")
    CATIA.Documents.Item(1).Activate

    Set AuxPartDocument = CATIA.ActiveDocument

    Set GetCATIAPartDocument = AuxPartDocument    

'-----
'MAIN PROGRAM
'-----
Sub CATMain()

GetCATIAPartDocument

End Sub

RE: Just a simple macro. Error running in batch mode

(OP)
Sorry, the End Function of GetCATIAPartDocument() is missing. However, in line 16, it gives the message:

Object doesn't support this property or method: 'CATIA'

Why?

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources