From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "B. T. Raven" Newsgroups: gmane.emacs.help Subject: Re: Open existing instance of app from Emacs lisp? Date: Sat, 09 Aug 2008 07:42:53 -0500 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1218289251 20433 80.91.229.12 (9 Aug 2008 13:40:51 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 9 Aug 2008 13:40:51 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Aug 09 15:41:42 2008 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1KRohS-0004q0-6Q for geh-help-gnu-emacs@m.gmane.org; Sat, 09 Aug 2008 15:41:42 +0200 Original-Received: from localhost ([127.0.0.1]:38001 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KRogW-0001e9-F7 for geh-help-gnu-emacs@m.gmane.org; Sat, 09 Aug 2008 09:40:44 -0400 Original-Path: news.stanford.edu!headwall.stanford.edu!newshub.sdsu.edu!Xl.tags.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local02.nntp.dca.giganews.com!nntp.sysmatrix.net!news.sysmatrix.net.POSTED!not-for-mail Original-NNTP-Posting-Date: Sat, 09 Aug 2008 07:42:51 -0500 User-Agent: Thunderbird 2.0.0.16 (Windows/20080708) Original-Newsgroups: gnu.emacs.help In-Reply-To: Original-Lines: 38 X-Usenet-Provider: http://www.giganews.com Original-NNTP-Posting-Host: 65.45.140.35 Original-X-Trace: sv3-GY7LX/hhQtz16wGV7nE/XzGT5MCyZE6eeaq8QaxVdBMuplLXUtyDMSviXoxz/Q/y55ztUWFlV9bSzQ9!wRX6Ze+mlYWfMYs8mJ+2RSFUa4IUN6ObOeAoWK1Ri/jorOiMcffU0BDMyr2n+OluGA4shaJPtmcS!8JB6PojPdcho+aRHE+G60TqNSs/Pzg== Original-X-Complaints-To: abuse@sysmatrix.net X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.39 Original-Xref: news.stanford.edu gnu.emacs.help:161004 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:56351 Archived-At: David Wolff wrote: > Hi all, > > I used "w32-shell-execute" to open apps, documents, and folders in a > very nice little menu, eg: > > (w32-shell-execute "open" "C:/WINDOWS/System32/calc.exe") > > Then I discovered that, for applications, this always opens a new > instance instead of switching to an existing copy. Just what I need, 14 > copies of Calculator running. :-) > > So okay, I can use w32-window-exists-p to see if the app is already > running. Now is there a way to activate the app from lisp? > > Thanks -- > > David > > (Remove "xx" to reply.) Apparently someone called XSteve (an Austrian??) has put together "sww.exe" and sww.el that will do what you want. Google on these. I wasn't able to try them because I am missing mfc71.dll and I don't know where to download it safely. If you have this dll you will probably be able to switch between windows apps from within Emacs. The closest I can get to what you want is: (if (not (w32-window-exists-p nil "Calculator")) (w32-shell-execute "open" "C:/Winnt/System32/calc.exe")) and then use Alt-Tab to bring up calculator. By the way, the calc programs (simple and programmable) embedded within Emacs are far superior to the msw Calculator program. Ed