BookmarkSubscribeRSS Feed
PhilC
Rhodochrosite | Level 12

How does one troubleshoot problems evident by the object not being able to open a file?

 

Option Explicit
Dim Application
Dim Project

' 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),"")
If Err.Number <> 0 Then
  WScript.Echo "ERROR: Unable to open " _
    & WScript.Arguments.Item(0) & " as a project file"
  WScript.Quit -1
End If

Output:

C:\Users\Dreamy\Desktop\ExtractCode>cscript ExtractCode_v7.vbs C:\Users\Dreamy\Desktop\ExtractCode\Qtr_ZZZZ.egp
Microsoft (R) Windows Script Host Version 5.812
Copyright (C) Microsoft Corporation. All rights reserved.

ERROR: Unable to open C:\Users\Dreamy\Desktop\ExtractCode\Qtr_ZZZZ.egp as a project file

 

What am I missing?:

 

0. I'm using SAS Enterprise Guide 7.1 (64-bit), B4N008 hotfixed, recently upgraded the install from 32-bit. I just upgraded Windows 10, and this OS is 64-bit .  

 

1. If I use the other 32 bit version of CSCRIPT then the script fails at create object.  I'm pretty sure I'm using the correct 64-bit CSCRIPT executable.

 

2. When I try to run these two lines of code in VBscript &colon;

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

I get:

Enterprise Guide, Version 7.100.5.0

 

3. I ran this for the sake of doing everything:

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

I received the 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

 

4.  The EGP file that I am opening, is not opened by another instance of SAS EG, although I have another copy open in the GUI.  

 

5.  Other EGP files that I once was able to open, prior to the upgrade to WinTen and EG 64-bit, do not open either.

 

If its easy -- give me hints and make me work for the solution.  thanks

12 REPLIES 12
PhilC
Rhodochrosite | Level 12

Good question.  yes.

PhilC
Rhodochrosite | Level 12

Could it be that there's some kind of environment problem? How do you start the vbs script? In batch, from a schedule, or in a simple cmd window?

CMD window

PhilC
Rhodochrosite | Level 12

I should add I have the B4N008 hot fix. 

 

@Kurt_BremserOther EGP files that I use to be able to open via the script do not open either...  I should have added that too, sorry.

ChrisHemedinger
Community Manager

If you enable Application Logging (Tools->Options in EG), then you should get some additional logs when running scripts.  They will have a CSCRIPT.EXE prefix.

 

Something in there could provide a hint about what's going on.  SAS Tech Support or R&D might need to help -- these logs are not super user friendly.

Check out SAS Innovate on-demand content! Watch the main stage sessions, keynotes, and over 20 technical breakout sessions!
CaseySmith
SAS Employee

A long shot, but does it fail if you try this command instead (without fully-qualified path to .egp file, since it appears to be in the same folder as your .vbs)?

C:\Users\Dreamy\Desktop\ExtractCode>cscript ExtractCode_v7.vbs Qtr_ZZZZ.egp

 

Or if you put the files somewhere other than your Desktop?

 

Reason I ask is that I can reproduce the same error when the .egp file cannot be located.  Your script works fine for me (using 32-bit 7.15 HF8; I didn't try 64-bit, but I'd expect it to work for me too).  (The Qtr_ZZZZ.egp file I created simply contains a single program with the code "proc print; data=sashelp.class; run;".)  However, I initially saw the same error when I ran this command (note, I'm using 32-bit EG, thus the 32-bit cscript.exe):

c:\Windows\SysWOW64\cscript.exe "C:\Users\cassmi\OneDrive - SAS\Desktop\ExtractCode_v7.vbs" "C:\Users\cassmi\Desktop\ExtractCode\Qtr_ZZZZ.egp"

The reason I got the error is because "C:\Users\cassmi\Desktop\ExtractCode\Qtr_ZZZZ.egp" doesn't physically exist on my machine.  I can paste "C:\Users\cassmi\Desktop\ExtractCode" into Windows Explorer and it routes to my Desktop fine, but then if I look at the path in the address bar, I see it mapped to "C:\Users\cassmi\OneDrive - SAS\Desktop\ExtractCode".  Windows Explorer knows to map "C:\Users\cassmi\Desktop" to my physically mapped Desktop location, but the command window doesn't (since "C:\Users\cassmi\Desktop" is also a physical location, but not the one my Desktop is mapped to).

 

I'm guessing you are running into a different issue, since your command prompt shows "C:\Users\Dreamy\Desktop\ExtractCode" physically exists (so your Desktop is probably not mapped), but worth confirming that the path to the .egp file you are passing in physically exists in the context of the command window (ex. dir "C:\Users\Dreamy\Desktop\ExtractCode\Qtr_ZZZZ.egp").

 

If you confirm it exists, then I'd try a trivial project, such as the one I described earlier (containing a single, simple program).

 

If still no luck, I second Chris' recommendation of turning on EG logging and then inspecting the resultant cscript_log.*.txt logs in the EG log location (ex. %appdata%\SAS\EnterpriseGuide\7.1\Logs) and search it for errors or exceptions.

 

Casey

 


Register today and join us virtually on June 16!
sasglobalforum.com | #SASGF

View now: on-demand content for SAS users

PhilC
Rhodochrosite | Level 12

So as far as I know this directory is not synced to a remote device.  This directory is the location where I've used EG via VBS script countless times, successfully, using the 32-bit EG and Windows 7. 

 

I had recently installed/upgraded to 64-bit EG, to fix a problem that I had with the 32-bit version not being able to import to Excel using the 'Send To' button.  (Which is super useful and worth uninstalling 32 bit EG for.)  So much has changed on my system I've lost track of the last time I used EG with VBS and if I ever did using the new Windows 10 environment.  

 

Anyway uninstalled 64-bit EG reinstalled 32-bit.  No dice.  Same thing (using the 32-bit cscript, too). We're about to submit this to Tech Support.  I've reverted to 64-bit EG to create the log files for the request.

 

Thanks @CaseySmith@Kurt_Bremser@ChrisHemedinger 

 

 

PhilC
Rhodochrosite | Level 12

@CaseySmith @ChrisHemedinger 

 

How much does Java interact with this process?  Would it be an issue if Java wasn't up-to-date?

ChrisHemedinger
Community Manager

Hi @PhilC - no, I don't expect that Java would have any impact on this.  EG does not rely on Java in the process.

Check out SAS Innovate on-demand content! Watch the main stage sessions, keynotes, and over 20 technical breakout sessions!

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 12 replies
  • 2635 views
  • 1 like
  • 4 in conversation