BookmarkSubscribeRSS Feed
gzr2mz39
Quartz | Level 8

I'm using SAS Enterprise Guide 5.1 (32-bit)

When I try to run these two lines of code in VBScript:

Set Application = WScript.CreateObject("SASEGObjectModel.Application.5.1")
WScript.Echo Application.Name & ", Version: " & Application.Version

I receive the error below. Is there another line of code that I need to add or do I need to specify the path of EG 5.1?

Error: could not locate automation class named "SASEGObjectModel.Application.5.1".
Code: 80020009
Source: WScript.Createobject

Thank you.

10 REPLIES 10
TomKari
Onyx | Level 15

I'm not an expert on VBScript, but when you use the File | Schedule project menu option in EG, it creates a VBScript file to run the project. When I did that on my PC, the equivalent line to what is giving you a problem is

    Set app = CreateObject("SASEGObjectModel.Application.5.1")

Could your having WScript in front of CreateObject be causing the problem?

Tom

ChrisHemedinger
Community Manager

If you have 32-bit EG but a 64-bit Windows, make sure you're running the correct CSCRIPT.exe.  See the notes at:

Using SAS Enterprise Guide to run programs in batch - The SAS Dummy

Chris

It's time to register for SAS Innovate! Join your SAS user peers in Las Vegas on April 16-19 2024.
gzr2mz39
Quartz | Level 8

Chris,

Thank you for the link. Lots of good info.

With other vbscripts I am able to run them by double-clicking on the vbs file.

Is this possible with the code in the link you sent or do you have to use command line to run the vbscript code?

Thank you.


ChrisHemedinger
Community Manager

The default action for a VBS file on your 64-bit machine is probably to run the 64-bit version of WSCRIPT.  That won't work if you are trying to automate 32-bit EG, because the required entries are not present in the 64-bit region of the Windows registry.

So, long story made short, best to run the 32-bit version of WSCRIPT or CSCRIPT.  I like CSCRIPT because it puts output to the console instead of popping up windows that might hang your process.

Chris

It's time to register for SAS Innovate! Join your SAS user peers in Las Vegas on April 16-19 2024.
SASUser000
Calcite | Level 5

Hi Chris,

 

I'm testing automation on SAS EG7.1 {precisely, 7.11 HF2 (7.100.1.2785) (32-bit)} using a Windows 7, 32-bit machine, and SAS EG is also 32-bit.  So I only have the 32-bit version of cscript.exe.  

 

I am getting a similar error as the one from 3 years ago above - Could not locate automation class named "SASEGObjectModel.Application.7.1"

 

Dim Application
Set Application = WScript.CreateObject("SASEGObjectModel.Application.7.1")
WScript.Echo Application.Name & ", Version: " & Application.Version

 

Please advise.  Thanks in advance!

ChrisHemedinger
Community Manager

You might need to register the EG automation object model.  Run this from a command prompt:

 

c:\Windows\Microsoft.NET\Framework\v4.0.30319\regasm /codebase "c:\Program Files\SASHome\SASEnterpriseGuide\7.1\sasegscripting.dll"

 

Sample output:

 

Microsoft .NET Framework Assembly Registration Utility version 4.0.30319.18408
for Microsoft .NET Framework version 4.0.30319.18408
Copyright (C) Microsoft Corporation.  All rights reserved.

Types registered successfully

Then try your script.

It's time to register for SAS Innovate! Join your SAS user peers in Las Vegas on April 16-19 2024.
SASUser000
Calcite | Level 5

Brilliant!  I couldn't find the dll there, but I did find it elsewhere. Pretty much working now, except that it prompts me to login to the SAS server.  I can probably figure that one out 🙂

 

Much appreciated...

kritima
Obsidian | Level 7

Hi Chris,

I use EG 7.11(64 bit) scheduling on Windows 10(64 bit).
I follow your instruction ( Using SAS Enterprise Guide to run programs in batch - The SAS Dummy) and do more as you mention.
c:\Windows\Microsoft.NET\Framework\v4.0.30319\regasm /codebase "c:\Program Files\SASHome\SASEnterpriseGuide\7.1\sasegscripting.dll"

 

But Scheduler can not invoke vbs which get from EG , right now.

Could you mind to suggest how to fix?

ChrisHemedinger
Community Manager

I'd start by verifying that you can use automation from a VBS script.

 

Here's a simple script that you can save into a local VBS file -- for example, testEg.vbs:

 

' force declaration of variables in VB Script
Option Explicit
Dim Application
' Create a new SAS Enterprise Guide automation session
Set Application = WScript.CreateObject("SASEGObjectModel.Application.7.1")
WScript.Echo Application.Name & ", Version: " & Application.Version
Application.Quit

 

I know we've touched on this, but make sure you're running the proper version of the scripting engine for your 64-bit SAS Enterprise Guide:

 

%windir%\system32\cscript.exe c:\projects\testEg.vbs

 

The output should be something like:

C:\Projects>%windir%\system32\cscript c:\projects\testEg.vbs
Microsoft (R) Windows Script Host Version 5.8
Copyright (C) Microsoft Corporation. All rights reserved.

Enterprise Guide, Version: 7.100.2.0

If that works, but the scheduler doesn't, then you'll need to dig into why the Windows Task Scheduler isn't launching your process at the appointed time.  The cause is probably not related to SAS Enterprise Guide; you could run some independent tests of the scheduler to see what's going on.

It's time to register for SAS Innovate! Join your SAS user peers in Las Vegas on April 16-19 2024.
kritima
Obsidian | Level 7

Thank you very much Chris,

 

The problem is on Windows Task Scheduler

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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
  • 10 replies
  • 11306 views
  • 3 likes
  • 5 in conversation