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

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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