- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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 :
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Are you able to open the project file from EG?
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Good question. yes.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Or do you have the project open in a desktop EG instance?
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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
Or do you have the project open in a desktop EG instance?
The file I'm trying to open is the version that I saved, then copied, renamed and moved to another directory. I have the original version open.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Then I have to admit I'm out of options. Maybe @ChrisHemedinger or @CaseySmith can help.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
How much does Java interact with this process? Would it be an issue if Java wasn't up-to-date?
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi @PhilC - no, I don't expect that Java would have any impact on this. EG does not rely on Java in the process.