4 Replies Latest reply: May 15, 2014 9:58 AM by Steve Caiels RSS

    Autoscript

    Jon Lake

      Hi

       

      I'm new to Monarch and need to have a .txt file modelled and exported to an MS Access database regularly. I would like to do this using Autscript but am unfamiliar with DOS programming. Does anyone know of an idiots guide to writing Autoscript command prompts?

        • Autoscript
          Grant Perkins

          Jon,

           

          You may have to go back to some DOS scripting docs to get what you want.

           

          I'm not a programmer - not close -  but, using the info available in the help files, I have in the past produced a few scripts to import files, manipulate using Monarch and export to either some sort of ascii file or Excel or Access.

           

          I don't do it often enough to be proficient - -have to re-learn each time - but as long as you can gather a selection of appropriate commands and remember that using the full path name often helps you, if not the script, is a start!

           

          The tricky thing is to also remember that Autoscript is a DOS application so long file names and directory names are not supported.

           

          However you can start external applications. So, for example, you could have a script that would start and ftp session on your PC, grab a file from a UNIX box (perhaps PREPping it on the way through), open it in Monarch, apply a model and export the data or summary to a specified location, start Access and leave the user in the Access screen viewing the data. (Or not).

           

          Most of that can be found in the help file.

           

          Perhaps some generic examples from other users would help? They could build to an on line  tutorial.

           

          Hope this helps.

           

          Grant

          • Autoscript
            Becky _

            I've copied code below from a simple Excel macro that I've used.

             

            PREWORK:

            1) A *.prj file from Monarch must be built.  This is a Monarch item that saves a specific file to import, and a specific model/filter to use.

             

            *********************************

             

                Set MonarchObj = CreateObject("Monarch32")

                MonarchObj.SetProjectFile

                     ("serverdriveyourname.prj")

             

                MonarchObj.ExportTable

                     ("serverdriveyourname.mdb")

             

                MonarchObj.CloseAllDocuments

                MonarchObj.Exit

                Set MonarchObj = Nothing

                 

            *******************

            That I know of, the automated scripts can only write a "new" database, it won't append.

             

            When I need to append, I add to the macro to open an access database, and run a macro to append the new information.

             

            You're welcome to contact me if this doesn't make sense.

            • Autoscript
              Becky _

              As an extra note . . . using an Excel macro, I have automated quite a few tasks to run based on either time-of-day, day-of-week, 1st day of the month, etc.

               

              Example: If I have a time consuming append/update to a large database on the 1st day of every month . . . I can automate the process to run at 1am, so it's all done and reports printed when I come in that day.  It works pretty slick.

              • Autoscript
                Steve Caiels

                Jon,

                The basic format for an Autocript Batch File is:

                "Monarch program path" "Report path" "model path" "export file path" "window switch" (/T for Table or /S for Summary)

                 

                An example for a single user Monarch installed in the default directory and using standard tutorial files is below.  A more efficient version is also below, but that may be harder to edit for your own Monarch installation, reports and model files. You can use long folder and file names as long as each part is included in ""'s

                 

                Long but easy example!!  This MUST be all on one line[/b]

                [font="courier"]  

                "c:program filesmonarchprogrammonarch" "c:program filesmonarch eportsclassic.prn" "c:program filesmonarchmodelslesson14.mod" "c:program filesmonarchexport

                ewfile.xls" /t

                /font[/quote][b]Shorter version that works well for turorial files[/b]

                [font="courier"]

                 

                C:

                "cd program filesmonarch"

                programmonarch reportsclassic.prn modelslesson14.mod newfile1.mdb /s

                programmonarch reportsemploy.prn modelslesson2.mod newfile2.mdb /t

                 

                /font[/quote]Regards

                Steve