Snow-Leopard 10.6.3 consequences Apple-Script breaks
wws2 new <[email protected]> Sat, 3 Apr 2010 10:31:03 +0100
| Newsgroups | gmane.lisp.mcl.general |
|---|---|
| Message-ID | <[email protected]> |
Updated to Snow-Leopard 10.6.3. The first consequence I notice is that EVAL-APPLE-SCRIPT from Alex Repenning (below) no longer works. Is there a simple fix anyone can see? I do not use Terje's recently posted Library (following) as it seems a lot more than I need, but I would be interested in knowing whether that works in 10.6.3? > From: Terje Norderhaug <[email protected]> > Date: February 5, 2010 12:56:24 AM GMT > To: Discussion list for MCL users <[email protected]> > Subject: [info-mcl] News: AppleEvents library > Reply-To: Discussion list for MCL users <[email protected]> > > > I have uploaded a new AppleEvents library to the MCL repository: > > http://code.google.com/p/mcl/source/browse/#hg/library/AppleEvents > > The library includes updated versions of my original AppleEvents Suites contribution as well as the DefAppleEvents module by Ray Pelletier. Both are upgraded to support Unicode for (R)MCL 5.2. ;;; -*- Mode: LISP; Syntax: Common-lisp; Package: ccl; Base: 10 -*- ;****************************************************************** ;* * ;* PROGRAM E V A L A P P L E S C R I P T * ;* * ;****************************************************************** ;* Author : Alexander Repenning * ;* Copyright : 2003 (c) AgentSheets Inc. * ;* http://www.agentsheets.com * ;* Filename : eval-apple-script.lisp * ;* Last Update : 11/10/01 * ;* Version * ;* 1.0 : 11/05/03 * ;* 1.1 : 02/11/04 finder-file-comment * ;* HW/SW : G4, OS X 10.3, MCL 5 * ;* Abstract : Run Apple Scripts * ;* * ;****************************************************************** (in-package :ccl) (export '(eval-apple-script)) (require "appleevent-toolkit") #| (EVAL-APPLE-SCRIPT "tell application \"Finder\" to do shell script \" ls -al /usr/ \"" ) ;; 3-APR-2010 MCL 5.21 ;; breaks as of Macintosh OSX System Version 10.6.3 Macmini3,1 10.600299999999999 "http://developer.apple.com/mac/library/documentation/Darwin/Reference/ManPages/man3/Mac__OSA.3pm.html" OSADoScript SCRIPTINGCOMPONENT, SOURCEDATA, CONTEXTID, DESIREDTYPE, MODEFLAGS Calling the OSADoScript function is equivalent to calling OSACompile() followed by OSAExecute() and OSADisplay(). After compiling the source data, executing the compiled script using the script context identified by the CONTEXTID parameter, and returning the text equivalent of the resulting script value, OSADoScript disposes of both the compiled script and the resulting script value. Return "undef" if an error was detected. |# (defun EVAL-APPLE-SCRIPT (Script) " in: Script string; out: Result string, Error nil or errorCode; Compile and run an AppleScript." ;; Peter Desain <[email protected]> (let ((gScriptingComponent (#_OpenDefaultComponent #$kOSAComponentType #$kOSAGenericScriptingComponentSubtype))) ; (inspect gScriptingComponent) (with-aedescs (source result err-mess) (%stack-block ((ptr (1+ (length script)))) (%put-cstring ptr script) ; (inspect ptr) (ae-error (#_aecreatedesc #$typechar ptr (length script) source)) (let ((myOSError (#_OSADoScript gScriptingComponent source #$kOSANullScript #$typeChar (logior #$kOSAModeNull #$kOSAModeDisplayForHumans) result))) (case myOSError (#.#$noErr ;; no error: extract result (values ; (break "EVAL-APPLE-SCRIPT") (let ((datahandle (rref result :aedesc.datahandle))) (with-dereferenced-handles ((ptr1 datahandle)) (%str-from-ptr-in-script ptr1 (#_GetHandleSize datahandle)))) nil)) (t ;; error: return error message (values (progn (#_OSAScriptError gScriptingComponent #$kOSAErrorMessage #$typeChar err-mess) (format nil "AppleScript error: ~A, code: ~A" (let ((datahandle (rref err-mess :aedesc.datahandle))) (with-dereferenced-handles ((ptr1 datahandle)) (%str-from-ptr-in-script ptr1 (#_GetHandleSize datahandle)))) myOSError)) myOSError)))))))) _______________________________________________ info-mcl mailing list [email protected] http://clozure.com/mailman/listinfo/info-mcl