Desktop productivity for business analysts and programmers

Running SAS EG Ordered List from a Batch (*.bat)

Reply
Regular Learner MRW
Regular Learner
Posts: 1

Running SAS EG Ordered List from a Batch (*.bat)

I am wanting to open SAS EG from a *.bat file and run the ordered List.  I can get my .bat to open my project by using "Start K:\Dental_Database\Project_Dental.egp".  However what is the correct syntax to have it open and run the ordered List?

SAS Super FREQ
Posts: 271

Re: Running SAS EG Ordered List from a Batch (*.bat)

You can accomplish using EG's automation interface...

 

-Open your EG project and note the name of the ordered list you want to run (ex. "MyOrderList") and the parent folder (ex. "Ordered Lists").

-Click File->Schedule <projectName>, then click OK in the scheduler dialog to cause an EGScript1.vbs file to be created in the same directory as your EG project.  (EGScript1.vbs is a VBScript file that will use the EG automation interface to open your project, run your project, save it, and then close it.)

-Close your project.

-Run the EGScript1.vbs file (ex. "cscript.exe EGScript1.vbs")  (Note: If running 32-bit EG on 64-bit Windows, you'll have to use the 32-bit cscript.exe in c:\Windows\SysWOW64...  ex. "c:\Windows\SysWOW64\cscript.exe EGScript1.vbs".)

-Open your project in EG and confirm it was run by executing the VBScript file.

-After confirming EGScript1.vbs successfully ran your entire project, now we just need to edit it to only run the desired Ordered List.  For example, replace the portion of the EGScript1.vbs that runs the project (commented out below) with code that finds and runs the desired ordered list (example below):

 

    '-----
    ' run the project
    '-----
    'prjObject.run
    'If Checkerror("Project.run") = True Then
    '    Exit Sub
    'End If
    
    'Find and Run the desired ordered list
    Dim orderedListContainer
    Dim orderedList

    Set orderedListContainer = prjObject.ContainerCollection.Item("Ordered Lists")
    For Each orderedList in orderedListContainer.Items
        If orderedList.Name = "MyOrderList" Then
            orderedList.Run()
        End If
    Next
    If Checkerror("OrderedList.Run") = True Then
        Exit Sub
    End If

-The last step (assuming you really want to be able to do this from a batch file), is to run the VBScript file from your batch file.  For example:

 

@echo off
pushd %~dp0
cscript EGScript1.vbs
Ask a Question
Discussion stats
  • 1 reply
  • 176 views
  • 0 likes
  • 2 in conversation