[OS X Emacs] Aquamacs and applescript
Daniel Stegmueller
d.stegmueller at gmail.com
Tue May 13 05:01:56 EDT 2008
Hello List,
I have a function using applescript to copy marked parts of a file
into an external application. It worked with (Carbon) Emacs but does
not work with Aquamacs.
Is there an obvious error that I am missing?
Best,
Daniel
Here it is:
(defun ado-send-region-to-Stata ()
(interactive)
(copy-region-as-kill (point) (mark))
(do-applescript "try \r tell application \"Finder\" \r set
theDummyDo to (((path to desktop folder) as text) & \".eraseme.do\")
\r set theContents to the clipboard \r if not (the last character of
theContents = return) then \r set theContents to theContents & return
\r end if \r end tell \r try \r set the open_target_file to open for
access file theDummyDo with write permission \r set eof of the
open_target_file to 0 \r write theContents to the open_target_file
starting at eof \r close access the open_target_file \r on error \r
try \r close access file theDummyDo \r end try \r end try \r tell
application \"StataSE\" \r activate \r open file theDummyDo \r end
tell \r on error error_message number error_number \r return \"Error:
\" & error_number & \". \" & error_message & return \r end try"))
More information about the MacOSX-Emacs
mailing list