[OS X Emacs] do-applescript?

Joe Davison halting at comcast.net
Sat Nov 17 19:46:59 EST 2007


Using the Applescript:

tell application "iTunes"
	playpause
	
end tell

in a buffer in Emacs.app,  I can select Emacs>>Services>>Script  
Editor>>Run as Applescript  and it will toggle iTunes playing.

Similarly, I can select  Emacs>>Services>>Script Editor>>Make New  
Applescript, and it will pop up in Script Editor.

Replacing "playpause" with "get selection" and selecting  
Emacs>>Services>>Script Editor>>Get Result of AppleScript, the script  
gets replaced with
  {file track id 4809 of user playlist id 4472 of source id 40 of  
application "iTunes"}

So, the service works in that way, at any rate.

If I go to the *scratch* buffer
and try:

(ns-service-Script-Editor-Make-New-AppleScript "tell application  
\"iTunes\"\r	get selection\rend tell\r")

I enter the debugger and see:

Debugger entered--Lisp error: (error "pasteboard type not supported")
   ns-perform-service("Script Editor/Make New AppleScript" nil)
   (let* ((in-string ...) (out-string ...)) (cond (... ... ... ...)))
   ns-service-Script-Editor-Make-New-AppleScript("tell application  
\"iTunes\"
	get selection
end tell
")
   eval((ns-service-Script-Editor-Make-New-AppleScript "tell  
application \"iTunes\"
	get selection
end tell
"))
   eval-last-sexp-1(t)
   eval-last-sexp(t)
   eval-print-last-sexp()
   call-interactively(eval-print-last-sexp)



I've tried a couple of other such things but always get the  
"pasteboard type not supported" error.

joe


On Nov 13, 2007, at 10:04 AM, Peter Dyballa wrote:

>
> Am 13.11.2007 um 07:34 schrieb Adrian Robert:
>
>>> Have you used the right syntax? Interestingly these work for me:
>>
>> Thanks for the encouraging report.  Still no go for me though, I  
>> think
>> something must be hosed up with applescript or the editor app on my
>> machine..
>
> Does it work to select the AppleScript text and to choose "Make New  
> AppleScript"? This should open the Apple Script Editor and would  
> allow you to correct syntax, to run the script, and to see results  
> as well as errors.
>
> --
> Greetings
>
>   Pete
>
> The box said "Use Windows 95 or better," so I got a Macintosh.
>
>
> _____________________________________________________________
> MacOSX-Emacs mailing list
> MacOSX-Emacs at email.esm.psu.edu
> http://email.esm.psu.edu/mailman/listinfo/macosx-emacs
> List Archives: http://dir.gmane.org/gmane.emacs.macintosh.osx




More information about the MacOSX-Emacs mailing list