BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
jimbarbour
Meteorite | Level 14

I want to run a SAS EG project using the Windows Task scheduler.

 

SAS EG very kindly generates a vbs file for me (which is listed following my "signature," below).  However, when I attempt to execute the script I get and error code of 1AD with the following error description:

ActiveX component can't create object

 

I can see that the vbs command that is failing is:

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

 

Just for fun, I tried executing a CreateObject on a different object, to wit:

Set app = CreateObject("WScript.Shell")

Which works just fine.  In doing some Googling about, I see this type of error ("ActiveX component can't create object") usually indicates that a particular COM object isn't registered or is otherwise unavailable.  I also read that the proper SAS objects are installed on one's machine when one installs SAS.  I *suspect* that herein lies the problem.  SAS is a virtualized application in my environment.  In other words, SAS is not directly installed on my machine.  I instantiate SAS by means of the following command:  

C:\Program Files (x86)\Microsoft Application Virtualization Client\sfttray.exe" /launch "SAS Enterprise Guide 5.1_Win764bit 5.100.0.12019" C:\Users\barboujb\Documents\egp\SOC_BGAN_Report.egp

 

So, you see, I execute sfttray.exe which causes the virtualized app, SAS in this case, to execute on my machine.  Since SAS does not reside on my machine, I suspect that the proper object(s) (SASEGObjectModel.Application.5.1 at the very least) also do not reside on my machine.

 

I can get my SAS project to open via vbs by using the below commands, but I have not been able to get my project to automatically execute.

Set app = CreateObject("WScript.Shell")

app.run("""C:\Program Files (x86)\Microsoft Application Virtualization Client\sfttray.exe"" /launch ""SAS Enterprise Guide 5.1_Win764bit 5.100.0.12019"" ""C:\Users\barboujb\Documents\egp\SOC_BGAN_Report.egp""")

I really want to be able to automate SAS projects on my machine.  

QUESTIONS:

1.  Is there a way to call/invoke the proper SAS objects when one works in a virtualized environment as I do?  In other words, is there a way access SASEGObjectModel.Application.5.1 (and other required objects) in a virtualized environment?

 

2.  Alternatively, if I open my SAS project on my desktop using vbs commands (see above code), is there a way to cause my project to begin execution automatically?

 

Inasmuch as more and more companies are trending to virtualized apps for ease of installation, license control, and maintenance, I would think that being able to automate SAS projects in such an environment would be a valuable thing.  I suspect that the good folks at SAS have already worked this out, but my Google searches of the various SAS sites have turned up nothing that I can identify a solution in.

 

Any help or hints appreciated.

 

Thanks,

 

Jim Barbour

aka "Confounded in California"  🙂

 

vbs script generated by SAS:

Option Explicit
Dim app

Call dowork

'shut down the app
If not (app Is Nothing) Then
app.Quit
Set app = Nothing
End If


Sub dowork()
On Error Resume Next
'----
' Start up Enterprise Guide using the project name
'----
Dim prjName
Dim prjObject

prjName = "C:\Users\barboujb\Documents\egp\SOC_BGAN_Report.egp" 'Project Name

Set app = CreateObject("SASEGObjectModel.Application.5.1")
If Checkerror("CreateObject") = True Then
Exit Sub
End If

'-----
' open the project
'-----
Set prjObject = app.Open(prjName,"")
If Checkerror("app.Open") = True Then
Exit Sub
End If


'-----
' run the project
'-----
prjObject.run
If Checkerror("Project.run") = True Then
Exit Sub
End If


'-----
' Save the new project
'-----
prjObject.Save
If Checkerror("Project.Save") = True Then
Exit Sub
End If

'-----
' Close the project
'-----
prjObject.Close
If Checkerror("Project.Close") = True Then
Exit Sub
End If

End Sub

Function Checkerror(fnName)
Checkerror = False

Dim strmsg
Dim errNum

If Err.Number <> 0 Then
strmsg = "Error #" & Hex(Err.Number) & vbCrLf & "In Function " & fnName & vbCrLf & Err.Description
MsgBox strmsg 'Uncomment this line if you want to be notified via MessageBox of Errors in the script.
Checkerror = True
End If

End Function

1 ACCEPTED SOLUTION

Accepted Solutions
jimbarbour
Meteorite | Level 14

Well, I've dug deeper into this forum and other sources.  I can now create the object called for in Set app = CreateObject("SASEGObjectModel.Application.5.1").  The steps I took are listed below my "signature".

 

Now unfortunately, I'm getting error 80040417 -- Unable to connect to server:  SASApp 

This message is odd since I'm connecting to that server just fine when entering through the normal EG GUI interface.  

 

If anyone has any insights into error 80040417, I'd be most appreciative.

 

Thanks,

 

Jim

 

What I did to to get the "SASEGObjectModel.Application.5.1" object created is as follows:

1.  Obtain a copy of SASEGScripting.dll

2.  Place SASEGScripting.dll in the 5.1 subdirectory of your SASEnterpriseGuideDirectory

3.  Run RegAsm.exe which on my machine is in C:\Windows\Microsoft.NET\Framework\v4.0.30319\  I'll list the fully qualified command below.

4.  Run RegTypeLib.exe which on my machine is in C:\SASHome\x86\Integration Technologies\  I'll list the fully qualified command below.

5.  Run your vb script file using the appropriate version of cscript.exe   I'm using a 32 bit version of SAS EG 5.1, so I used C:\Windows\SysWOW64\cscript.exe

 

Here is the fully qualified command that I ran for step 3, above:

C:\Windows\Microsoft.NET\Framework\v4.0.30319\RegAsm.exe /tlb:SASEGScripting.tlb /codebase "C:\SASHome\x86\SASEnterpriseGuide\5.1\SASEGScripting.dll"

 

After which I received the following:

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 successfullyTypes registered successfullyAssembly exported to 'C:\SASHome\x86\SASEnterpriseGuide\5.1\SASEGScripting.tlb', and the type library was registered successfully

 

Here is the fully qualified command that I ran for step 4, above:

"C:\SASHome\x86\Integration Technologies\RegTypeLib.exe"  C:\SASHome\x86\SASEnterpriseGuide\5.1\SASEGScripting.tlb

 

After which I received the following:

Registered C:\SASHome\x86\SASEnterpriseGuide\5.1\SASEGScripting.tlb OK

View solution in original post

2 REPLIES 2
jimbarbour
Meteorite | Level 14

Well, I've dug deeper into this forum and other sources.  I can now create the object called for in Set app = CreateObject("SASEGObjectModel.Application.5.1").  The steps I took are listed below my "signature".

 

Now unfortunately, I'm getting error 80040417 -- Unable to connect to server:  SASApp 

This message is odd since I'm connecting to that server just fine when entering through the normal EG GUI interface.  

 

If anyone has any insights into error 80040417, I'd be most appreciative.

 

Thanks,

 

Jim

 

What I did to to get the "SASEGObjectModel.Application.5.1" object created is as follows:

1.  Obtain a copy of SASEGScripting.dll

2.  Place SASEGScripting.dll in the 5.1 subdirectory of your SASEnterpriseGuideDirectory

3.  Run RegAsm.exe which on my machine is in C:\Windows\Microsoft.NET\Framework\v4.0.30319\  I'll list the fully qualified command below.

4.  Run RegTypeLib.exe which on my machine is in C:\SASHome\x86\Integration Technologies\  I'll list the fully qualified command below.

5.  Run your vb script file using the appropriate version of cscript.exe   I'm using a 32 bit version of SAS EG 5.1, so I used C:\Windows\SysWOW64\cscript.exe

 

Here is the fully qualified command that I ran for step 3, above:

C:\Windows\Microsoft.NET\Framework\v4.0.30319\RegAsm.exe /tlb:SASEGScripting.tlb /codebase "C:\SASHome\x86\SASEnterpriseGuide\5.1\SASEGScripting.dll"

 

After which I received the following:

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 successfullyTypes registered successfullyAssembly exported to 'C:\SASHome\x86\SASEnterpriseGuide\5.1\SASEGScripting.tlb', and the type library was registered successfully

 

Here is the fully qualified command that I ran for step 4, above:

"C:\SASHome\x86\Integration Technologies\RegTypeLib.exe"  C:\SASHome\x86\SASEnterpriseGuide\5.1\SASEGScripting.tlb

 

After which I received the following:

Registered C:\SASHome\x86\SASEnterpriseGuide\5.1\SASEGScripting.tlb OK

jimbarbour
Meteorite | Level 14

In the above post, the :S (frustrated smiley) is actually a : followed by an S with no spaces in between.

 

Jim

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
  • 2 replies
  • 9881 views
  • 1 like
  • 1 in conversation