Automating Monarch v15.x using Command Line in .bat Files

Al_22614
Al_22614 Altair Community Member
edited September 2019 in Community Q&A
Hello All

I am a long time Monarch user and have done some amazing work using the tool.  I have a Monarch v15.x client wanting to automate Monarch sessions using the Command Line automation with .bat files, which will be called from Excel VBA scripts.  Does anyone have any experience with this configuration and can share your experience and "dos and don'ts".  Any good documentation for reference?

There are other ways to approach this, but I want to check in with my Monarch friends as this has always been a rich source of support for me.

Thanks,
Al

------------------------------
Al Rice
Owner - President- CEO
Trends In Data, LLC
West Bloomfield MI
(248) 761-5238
------------------------------
Tagged:

Answers

  • Steve Caiels_21881
    Steve Caiels_21881
    Altair Employee
    edited September 2019
    Hi Al,

    Good to hear from you again.  

    Are you aware that Command Line automation via batch of com (vba, vb .net etc) requires an additional license?

    As long as your client has that, then it all works great.  If vba is in use, I would tend to use the com automation rather than Monarch Command Line as you will get more flexibility.  For example, you can dynamically set the input report, active filter and many other aspects of the Monarch session.

    If you don't need any dynamic interaction, then command batch line will also work well.  Please note that Version 15 requires the switches that were optional in some previous versions.  I'm not sure when they became mandatory.

    A typical command line might be  . . . 

    "C:\Program Files\Datawatch Monarch 15\Monarch.exe" /rpt:"E:\Temp\MyReport.prn" /mod:"E:\Models\MyModel.dmod" /exp:"E:\Exports\MyExport.xlsx" /T

    Projects can also be automated.  I think the format is . . . 
    "C:\Program Files\Datawatch Monarch 15\Monarch.exe" /prj:"E:\Temp\MyProject.dprj" /PXAll

    A simple vba script might be . . . 

    Set MonarchObj = CreateObject("Monarch32")
    MonarchObj.SetProjectFile("C:\Betty Test\Betty Test.xprj")
    t = MonarchObj.RunAllExports()
    MonarchObj.Exit

    Using vba, t can be inspected to see if the export has been successful.  For example, 
    If T = False Then
      Result = WSHShell.Popup("Export Failed!",, "Export Results", 16)
    Else
      Result = WSHShell.Popup("Export Passed", 3, "Export Results", 64)
    End If

    The programmers reference guide can be downloaded from docs.datawatch.com in the "Other Monarch Documentation" section.

    Regards,
    Steve.





    ------------------------------
    Steve Caiels
    Professional Services
    Altair
    ------------------------------
    -------------------------------------------
    Original Message:
    Sent: 09-07-2019 12:06 PM
    From: Al Rice
    Subject: Automating Monarch v15.x using Command Line in .bat Files

    Hello All

    I am a long time Monarch user and have done some amazing work using the tool.  I have a Monarch v15.x client wanting to automate Monarch sessions using the Command Line automation with .bat files, which will be called from Excel VBA scripts.  Does anyone have any experience with this configuration and can share your experience and "dos and don'ts".  Any good documentation for reference?

    There are other ways to approach this, but I want to check in with my Monarch friends as this has always been a rich source of support for me.

    Thanks,
    Al

    ------------------------------
    Al Rice
    Owner - President- CEO
    Trends In Data, LLC
    West Bloomfield MI
    (248) 761-5238
    ------------------------------"
  • Al_22614
    Al_22614 Altair Community Member
    edited September 2019

    Hi Al,

    Good to hear from you again.  

    Are you aware that Command Line automation via batch of com (vba, vb .net etc) requires an additional license?

    As long as your client has that, then it all works great.  If vba is in use, I would tend to use the com automation rather than Monarch Command Line as you will get more flexibility.  For example, you can dynamically set the input report, active filter and many other aspects of the Monarch session.

    If you don't need any dynamic interaction, then command batch line will also work well.  Please note that Version 15 requires the switches that were optional in some previous versions.  I'm not sure when they became mandatory.

    A typical command line might be  . . . 

    "C:\Program Files\Datawatch Monarch 15\Monarch.exe" /rpt:"E:\Temp\MyReport.prn" /mod:"E:\Models\MyModel.dmod" /exp:"E:\Exports\MyExport.xlsx" /T

    Projects can also be automated.  I think the format is . . . 
    "C:\Program Files\Datawatch Monarch 15\Monarch.exe" /prj:"E:\Temp\MyProject.dprj" /PXAll

    A simple vba script might be . . . 

    Set MonarchObj = CreateObject("Monarch32")
    MonarchObj.SetProjectFile("C:\Betty Test\Betty Test.xprj")
    t = MonarchObj.RunAllExports()
    MonarchObj.Exit

    Using vba, t can be inspected to see if the export has been successful.  For example, 
    If T = False Then
      Result = WSHShell.Popup("Export Failed!",, "Export Results", 16)
    Else
      Result = WSHShell.Popup("Export Passed", 3, "Export Results", 64)
    End If

    The programmers reference guide can be downloaded from docs.datawatch.com in the "Other Monarch Documentation" section.

    Regards,
    Steve.





    ------------------------------
    Steve Caiels
    Professional Services
    Altair
    ------------------------------
    -------------------------------------------
    Original Message:
    Sent: 09-07-2019 12:06 PM
    From: Al Rice
    Subject: Automating Monarch v15.x using Command Line in .bat Files

    Hello All

    I am a long time Monarch user and have done some amazing work using the tool.  I have a Monarch v15.x client wanting to automate Monarch sessions using the Command Line automation with .bat files, which will be called from Excel VBA scripts.  Does anyone have any experience with this configuration and can share your experience and "dos and don'ts".  Any good documentation for reference?

    There are other ways to approach this, but I want to check in with my Monarch friends as this has always been a rich source of support for me.

    Thanks,
    Al

    ------------------------------
    Al Rice
    Owner - President- CEO
    Trends In Data, LLC
    West Bloomfield MI
    (248) 761-5238
    ------------------------------"

    Thanks Steve:

    This is a new client, and I believe he has Command Line automation, not .COM.  If Command Line works with Monarch 15.x, then we should be good as certain automated routines can be run during off hours on an active computer.  The .COM server is a quite expensive add on which make take some cost justification.

    Thanks,

    ------------------------------
    Al Rice
    Owner - President- CEO
    Trends In Data, LLC
    West Bloomfield MI
    (248) 761-5238
    ------------------------------
    -------------------------------------------
    Original Message:
    Sent: 09-08-2019 08:53 AM
    From: Steve Caiels
    Subject: Automating Monarch v15.x using Command Line in .bat Files

    Hi Al,

    Good to hear from you again.

    Are you aware that Command Line automation via batch of com (vba, vb .net etc) requires an additional license?

    As long as your client has that, then it all works great.  If vba is in use, I would tend to use the com automation rather than Monarch Command Line as you will get more flexibility.  For example, you can dynamically set the input report, active filter and many other aspects of the Monarch session.

    If you don't need any dynamic interaction, then command batch line will also work well.  Please note that Version 15 requires the switches that were optional in some previous versions.  I'm not sure when they became mandatory.

    A typical command line might be  . . .

    "C:\Program Files\Datawatch Monarch 15\Monarch.exe" /rpt:"E:\Temp\MyReport.prn" /mod:"E:\Models\MyModel.dmod" /exp:"E:\Exports\MyExport.xlsx" /T

    Projects can also be automated.  I think the format is . . .
    "C:\Program Files\Datawatch Monarch 15\Monarch.exe" /prj:"E:\Temp\MyProject.dprj" /PXAll

    A simple vba script might be . . .

    Set MonarchObj = CreateObject("Monarch32")
    MonarchObj.SetProjectFile("C:\Betty Test\Betty Test.xprj")
    t = MonarchObj.RunAllExports()
    MonarchObj.Exit

    Using vba, t can be inspected to see if the export has been successful.  For example,
    If T = False Then
      Result = WSHShell.Popup("Export Failed!",, "Export Results", 16)
    Else
      Result = WSHShell.Popup("Export Passed", 3, "Export Results", 64)
    End If

    The programmers reference guide can be downloaded from docs.datawatch.com in the "Other Monarch Documentation" section.

    Regards,
    Steve.





    ------------------------------
    Steve Caiels
    Professional Services
    Altair
    ------------------------------

    Original Message:
    Sent: 09-07-2019 12:06 PM
    From: Al Rice
    Subject: Automating Monarch v15.x using Command Line in .bat Files

    Hello All

    I am a long time Monarch user and have done some amazing work using the tool.  I have a Monarch v15.x client wanting to automate Monarch sessions using the Command Line automation with .bat files, which will be called from Excel VBA scripts.  Does anyone have any experience with this configuration and can share your experience and "dos and don'ts".  Any good documentation for reference?

    There are other ways to approach this, but I want to check in with my Monarch friends as this has always been a rich source of support for me.

    Thanks,
    Al

    ------------------------------
    Al Rice
    Owner - President- CEO
    Trends In Data, LLC
    West Bloomfield MI
    (248) 761-5238
    ------------------------------"