Open SAS program in new instance

醉酒当歌 提交于 2019-12-13 16:22:22

问题


I'm trying to figure out a way to open SAS programs in new instances of the Enhanced Editor by default on click.

The question has been asked before but no luck.

This paper describes the way a program is opened with the Enhanced Editor. The full command is :

"C:\PROGRA~1\SASHome\SASFOU~1\9.3\core\sasexe\SASOACT.EXE" action=Open
datatype=SASFile filename="%1" progid=SAS.Application.903 

The author explains that:

The sasoact.exe program is used to launch an OLE automation session of SAS. Automation is a mechanism through which one Windows application can control another application programmatically. When you double-click a SAS file type, sasoact.exe checks to see if an existing OLE automation session of SAS is running. If not, it then invokes an OLE automation session of SAS. Once there is an active SAS automation server session, any further calls from sasoact.exe are handled by the existing SAS session instead of in a new SAS session.

I guess having only one OLE session is usefull in some way or another but it's really annoying when you have to manually open a new EE instance every time you want to run multiple jobs. Not to mention that sasoact targets the first session initiated and if a job is already running on that session well your program is not going to open.

Is there a way to directly request a new instance of the OLE session or perhaps "trick" sasoact.exe into not seeing the opened sessions ?

[EDIT] Well too bad it's been closed as duplicate because the answer is substantially different than the other question's. Also it might help others who do not want to run their programs from a batch file. Here is the registry key that works:

"C:\Program Files\SAS\SASFoundation\9.2(32-bit)\sas.exe" -initstmt "dm 'whost;include ''%1'' ';"  

I added it in HKEY_CLASSES_ROOT\SAS.Program.701\shell\Open New\command so now I have a neat little extra option in my drop-down menu that effectively opens programs in new sessions on click:


回答1:


A similar thread showing the use of a batch file to open a SAS program in a new session is available here.

If you want to open a .sas program in a new session by simply clicking the program here is how to do it:

You have to add an entry to the registry. Be careful when messing around with registry files, always back up your entries.

Open the registry editor (WIN+R > regedit).
In the directory HKEY_CLASSES_ROOT\SAS.Program.701\shell\ create a sub-directory with a meaningful name(right-click on shell > New > Key). I named mine "Open New". In this new sub-directory create another sub named command. You should now have a path that looks like:
HKEY_CLASSES_ROOT\SAS.Program.701\shell\Open New\command
In here, right-click on the file on the registry file on the right > Modify and add the following in the Value data field (change the path of sas.exe if needed)

"C:\Program Files\SAS\SASFoundation\9.2(32-bit)\sas.exe" -NOTUTORIALDLG -initstmt "dm 'whost;include ''%1'' ';"

Close the editor. You should now have the new option specified in the drop-down menu of the right-click on a .sas program:

This option will open your program with the Enhanced Editor in a new SAS session.

Now if you want it to work for double-clicking I suppose you'd have to replace the value in the Open sub-directory with the one from above. I haven't done it and I don't recommend it, the extra option in the drop-down is enough for me.



来源:https://stackoverflow.com/questions/24898146/open-sas-program-in-new-instance

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!