[OS X Emacs] do-applescript?

Peter Dyballa Peter_Dyballa at Web.DE
Mon Nov 12 13:37:54 EST 2007


Am 12.11.2007 um 07:37 schrieb Adrian Robert:

> I just noticed on my machine there is the function
> ns-service-Script-Editor-Run-as-AppleScript (from auto service
> exposure to lisp).  However this seems not to work, no matter which
> app I call the service from.  (Maybe the script menu needs to be
> enabled or something?)  Probably worth a try at least.

Have you used the right syntax? Interestingly these work for me:

	do shell script "echo $PATH"
	
	tell application "Camino" to open location "http://emacs- 
app.sourceforge.net"
	tell application "OmniWeb" to open location "http://emacs- 
app.sourceforge.net"

The first line only works with Emacs -> Services -> Script Editor ->  
Get Result of AppleScript. The the selected region is substituted  
with the value of $PATH.

The other two lines open the URL in Camino or OmniWeb when called via  
Emacs -> Services -> Script Editor -> Run as AppleScript.

To test the syntax you can use osascript -e 'AppleScript' in *shell* ...

Using the functions

	ns-service-Script-Editor-Get-Result-of-AppleScript
	ns-service-Script-Editor-Make-New-AppleScript
	ns-service-Script-Editor-Run-as-AppleScript

directly also works. 'do shell script "echo $PATH"' does not produce  
output in Emacs.app, because the script's output is not sent to a  
buffer or file. When I select only the URLs I can apply successfully

	ns-service-Open-URL-in-Camino
	ns-service-Open-URL-in-OmniWeb

ns-submit-bug-report and ns-toggle-toolbar work, ns-service- 
Summarize, ns-service-Statistics..., ns-service-Look-Up-in- 
Dictionary, ns-service-Mail-Send-Selection, ns-service-Insert-Long- 
Date-&-Time ...

Mac OS X 10.4.10, PowerPC, GNU Emacs 23.0.0.1 (powerpc-apple- 
darwin8.10.0, *Step 9.0-rc2a) of 2007-10-02 on Latsche.local

--
Greetings

   Pete

   It's not the valleys in life I dread so much as the dips.
                     -- Garfield





More information about the MacOSX-Emacs mailing list