BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
JeffreyLowe
Obsidian | Level 7
I am trying to run a SAS EG 7.1 project with Ordered List from a VBScript (below). It seems to execute just fine but after about two minutes I get an error about missing parameters. It finds and runs my Ordered List but then returns the error. Sounds like it is looking for a parameter for the ordered list, but I don't have parameters for it. Any assistance would e greatly appreciated.
 
Option Explicit
Dim Application
Dim Project
Dim orderedListContainer
Dim orderedList
' Change if running a different version of EG
Dim egVersion
egVersion = "SASEGObjectModel.Application.7.1"
'If WScript.Arguments.Count = 0 Then
'  WScript.Echo "ERROR: Expecting the full path name of a project file"
'  WScript.Quit -1
'End If
' Create a new SAS Enterprise Guide automation session
On Error Resume Next
Set Application = WScript.CreateObject(egVersion)
WScript.Echo "Opening project: " & WScript.Arguments.Item(0)
If Err.Number <> 0 Then
  WScript.Echo "ERROR: Need help with 'Set Application = WScript.CreateObject(egVersion)'"
  WScript.Quit -1
End If
' Open the EGP file with the Application
Set Project = Application.Open(WScript.Arguments.Item(0),"Weekend Data Validation 7.1 Version.egp")
If Err.Number <> 0 Then
  WScript.Echo "ERROR: Unable to open " _
    & WScript.Arguments.Item(0) & " as a project file"
  WScript.Quit -1
End If
Set orderedListContainer = Project.ContainerCollection.Item("Ordered Lists")
For Each orderedList in orderedListContainer.Items
  WScript.Echo orderedList.Name
    If orderedList.Name = "OrderList" Then
        orderedList.Run
        WScript.Echo "Error: " & Err.Description
    End If
Next
If Checkerror("OrderedList.Run") = True Then
  WScript.Echo orderedListContainer.Items
    WScript.Echo "Error Finding OrderList " & Err.Description
    WScript.Quit -1
End If
 
VBS Error.jpg
1 ACCEPTED SOLUTION

Accepted Solutions
JeffreyLowe
Obsidian | Level 7

I resolved the issue myself. Rather than deleting my original question I am going to leave it up to hopefully help someone else attempting the same thing.

 

So in SAS EG 7.1, you don't have to run the OrderedList, just open the project and run the project. The portion of the code below in RED is not needed. Issuing Project.Run will kick off the project and execute the Ordered List.

 

Option Explicit
Dim Application
Dim Project
Dim orderedListContainer
Dim orderedList
' Change if running a different version of EG
Dim egVersion
egVersion = "SASEGObjectModel.Application.7.1"
'If WScript.Arguments.Count = 0 Then
'  WScript.Echo "ERROR: Expecting the full path name of a project file"
'  WScript.Quit -1
'End If
' Create a new SAS Enterprise Guide automation session
On Error Resume Next
Set Application = WScript.CreateObject(egVersion)
WScript.Echo "Opening project: " & WScript.Arguments.Item(0)
If Err.Number <> 0 Then
  WScript.Echo "ERROR: Need help with 'Set Application = WScript.CreateObject(egVersion)'"
  WScript.Quit -1
End If
' Open the EGP file with the Application
Set Project = Application.Open(WScript.Arguments.Item(0),"Weekend Data Validation 7.1 Version.egp")
If Err.Number <> 0 Then
  WScript.Echo "ERROR: Unable to open " _
    & WScript.Arguments.Item(0) & " as a project file"
  WScript.Quit -1
else
 WScript.Echo "Attempting to run the Project " & project
 Project.run
End If
/*
Set orderedListContainer = Project.ContainerCollection.Item("Ordered Lists")
For Each orderedList in orderedListContainer.Items
  WScript.Echo orderedList.Name
    If orderedList.Name = "OrderList" Then
      WScript.Echo "Orderedlist.name is: " & orderedlist.name
        orderedList.Run()
    End If
Next
If Checkerror("OrderedList.Run") = True Then
    WScript.Echo Err.Description
    WScript.Quit -1
End If

View solution in original post

1 REPLY 1
JeffreyLowe
Obsidian | Level 7

I resolved the issue myself. Rather than deleting my original question I am going to leave it up to hopefully help someone else attempting the same thing.

 

So in SAS EG 7.1, you don't have to run the OrderedList, just open the project and run the project. The portion of the code below in RED is not needed. Issuing Project.Run will kick off the project and execute the Ordered List.

 

Option Explicit
Dim Application
Dim Project
Dim orderedListContainer
Dim orderedList
' Change if running a different version of EG
Dim egVersion
egVersion = "SASEGObjectModel.Application.7.1"
'If WScript.Arguments.Count = 0 Then
'  WScript.Echo "ERROR: Expecting the full path name of a project file"
'  WScript.Quit -1
'End If
' Create a new SAS Enterprise Guide automation session
On Error Resume Next
Set Application = WScript.CreateObject(egVersion)
WScript.Echo "Opening project: " & WScript.Arguments.Item(0)
If Err.Number <> 0 Then
  WScript.Echo "ERROR: Need help with 'Set Application = WScript.CreateObject(egVersion)'"
  WScript.Quit -1
End If
' Open the EGP file with the Application
Set Project = Application.Open(WScript.Arguments.Item(0),"Weekend Data Validation 7.1 Version.egp")
If Err.Number <> 0 Then
  WScript.Echo "ERROR: Unable to open " _
    & WScript.Arguments.Item(0) & " as a project file"
  WScript.Quit -1
else
 WScript.Echo "Attempting to run the Project " & project
 Project.run
End If
/*
Set orderedListContainer = Project.ContainerCollection.Item("Ordered Lists")
For Each orderedList in orderedListContainer.Items
  WScript.Echo orderedList.Name
    If orderedList.Name = "OrderList" Then
      WScript.Echo "Orderedlist.name is: " & orderedlist.name
        orderedList.Run()
    End If
Next
If Checkerror("OrderedList.Run") = True Then
    WScript.Echo Err.Description
    WScript.Quit -1
End If

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 1259 views
  • 0 likes
  • 1 in conversation