home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 …ember: Reference Library / Apple Developer Reference Library (December 1999) (Disk 1).iso / mac / Technical Documentation / Develop / develop Issue 19 / develop Issue 19 code / SimpliFace_V2.sea / SimpliFace_V2 / Sources / ObjModelEvents.cp < prev    next >
MacBinary  |  1994-05-01  |  16.4 KB  |  [TEXT/MPS ]

open in: MacOS 8.1     |     Win98     |     DOS

browse contents    |     view JSON data     |     view as text


This file was processed as: MacBinary (archive/macBinary).

ConfidenceProgramDetectionMatch TypeSupport
10% dexvert MacBinary (archive/macBinary) fallback Supported
1% dexvert MS-DOS Code Page Info (other/dosCodePage) ext Unsupported
1% dexvert Text File (text/txt) fallback Supported
100% file MacBinary II, inited, Sun May 1 22:49:27 1994, modified Sun May 1 22:49:27 1994, creator 'MPS ', type ASCII, 16038 bytes "ObjModelEvents.cp" , at 0x3f26 428 bytes resource default (weak)
99% file data default
74% TrID Macintosh plain text (MacBinary) default
25% TrID MacBinary 2 default (weak)
100% siegfried fmt/1762 MacBinary (II) default
100% lsar MacBinary default


id metadata
keyvalue
macFileType[TEXT]
macFileCreator[MPS ]



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 00 11 4f 62 6a 4d 6f 64 | 65 6c 45 76 65 6e 74 73 |..ObjMod|elEvents|
|00000010| 2e 63 70 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |.cp.....|........|
|00000020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000040| 00 54 45 58 54 4d 50 53 | 20 01 00 00 00 00 00 00 |.TEXTMPS| .......|
|00000050| 00 00 00 00 00 3e a6 00 | 00 01 ac a9 ea 1a b7 a9 |.....>..|........|
|00000060| ea 1a b7 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000070| 00 00 00 00 00 00 00 00 | 00 00 81 81 cb d9 00 00 |........|........|
|00000080| 2f 2a 0d 09 46 69 6c 65 | 3a 09 09 4f 62 6a 4d 6f |/*..File|:..ObjMo|
|00000090| 64 65 6c 45 76 65 6e 74 | 73 2e 63 70 0d 0d 09 43 |delEvent|s.cp...C|
|000000a0| 6f 6e 74 61 69 6e 73 3a | 09 41 70 70 6c 65 20 45 |ontains:|.Apple E|
|000000b0| 76 65 6e 74 20 68 61 6e | 64 6c 65 72 73 20 69 6d |vent han|dlers im|
|000000c0| 70 6c 65 6d 65 6e 74 61 | 74 69 6f 6e 0d 0d 0d 09 |plementa|tion....|
|000000d0| 44 65 76 65 6c 6f 70 65 | 64 20 62 79 3a 0d 0d 09 |Develope|d by:...|
|000000e0| 50 61 75 6c 20 47 20 53 | 6d 69 74 68 20 28 63 6f |Paul G S|mith (co|
|000000f0| 6d 6d 73 74 61 6c 6b 20 | 68 71 20 26 20 46 75 6c |mmstalk |hq & Ful|
|00000100| 6c 20 4d 6f 6f 6e 20 53 | 6f 66 74 77 61 72 65 2c |l Moon S|oftware,|
|00000110| 20 49 6e 63 29 0d 0d 09 | 79 6f 75 20 63 61 6e 20 | Inc)...|you can |
|00000120| 6c 65 61 76 65 20 6d 65 | 73 73 61 67 65 73 20 61 |leave me|ssages a|
|00000130| 74 20 28 55 4b 29 3a 20 | 30 37 32 37 20 38 34 34 |t (UK): |0727 844|
|00000140| 32 33 32 3b 20 28 55 53 | 29 3a 20 34 30 38 20 32 |232; (US|): 408 2|
|00000150| 35 33 20 37 31 39 39 0d | 09 42 55 54 20 49 20 70 |53 7199.|.BUT I p|
|00000160| 72 65 66 65 72 20 74 6f | 20 62 65 20 63 6f 6e 74 |refer to| be cont|
|00000170| 61 63 74 65 64 20 62 79 | 20 65 2d 6d 61 69 6c 0d |acted by| e-mail.|
|00000180| 09 41 70 70 6c 65 4c 69 | 6e 6b 3a 20 09 43 4f 4d |.AppleLi|nk: .COM|
|00000190| 4d 53 54 41 4c 4b 2e 48 | 51 0d 09 49 6e 74 65 72 |MSTALK.H|Q..Inter|
|000001a0| 6e 65 74 3a 20 09 43 4f | 4d 4d 53 54 41 4c 4b 2e |net: .CO|MMSTALK.|
|000001b0| 48 51 40 61 70 70 6c 65 | 6c 69 6e 6b 2e 61 70 70 |HQ@apple|link.app|
|000001c0| 6c 65 2e 63 6f 6d 0d 0d | 09 22 53 69 6d 70 6c 69 |le.com..|."Simpli|
|000001d0| 46 61 63 65 32 22 20 53 | 61 6d 70 6c 65 20 63 6f |Face2" S|ample co|
|000001e0| 64 65 20 74 6f 20 61 63 | 63 6f 6d 70 61 6e 79 20 |de to ac|company |
|000001f0| 64 65 76 65 6c 6f 70 20 | 61 72 74 69 63 6c 65 0d |develop |article.|
|00000200| 09 6f 6e 20 74 65 63 68 | 6e 69 71 75 65 73 20 66 |.on tech|niques f|
|00000210| 6f 72 20 63 6f 6e 74 72 | 6f 6c 6c 69 6e 67 20 73 |or contr|olling s|
|00000220| 63 72 69 70 74 20 69 6e | 68 65 72 69 74 61 6e 63 |cript in|heritanc|
|00000230| 65 2e 0d 09 0d 09 0d 0d | 0d 09 41 70 70 6c 65 20 |e.......|..Apple |
|00000240| 45 76 65 6e 74 20 68 61 | 6e 64 6c 65 72 73 20 66 |Event ha|ndlers f|
|00000250| 6f 72 20 53 69 6d 70 6c | 69 46 61 63 65 32 0d 0d |or Simpl|iFace2..|
|00000260| 2a 2f 0d 0d 23 69 66 6e | 64 65 66 20 5f 5f 53 54 |*/..#ifn|def __ST|
|00000270| 44 49 4f 5f 5f 0d 23 69 | 6e 63 6c 75 64 65 20 3c |DIO__.#i|nclude <|
|00000280| 53 74 64 49 4f 2e 68 3e | 0d 23 65 6e 64 69 66 0d |StdIO.h>|.#endif.|
|00000290| 0d 23 69 66 6e 64 65 66 | 20 5f 5f 4d 45 4e 55 53 |.#ifndef| __MENUS|
|000002a0| 5f 5f 0d 23 69 6e 63 6c | 75 64 65 20 3c 4d 65 6e |__.#incl|ude <Men|
|000002b0| 75 73 2e 68 3e 0d 23 65 | 6e 64 69 66 0d 23 69 66 |us.h>.#e|ndif.#if|
|000002c0| 6e 64 65 66 20 5f 5f 45 | 56 45 4e 54 53 5f 5f 0d |ndef __E|VENTS__.|
|000002d0| 23 69 6e 63 6c 75 64 65 | 20 3c 45 76 65 6e 74 73 |#include| <Events|
|000002e0| 2e 68 3e 0d 23 65 6e 64 | 69 66 0d 23 69 66 6e 64 |.h>.#end|if.#ifnd|
|000002f0| 65 66 20 5f 5f 57 49 4e | 44 4f 57 53 5f 5f 0d 23 |ef __WIN|DOWS__.#|
|00000300| 69 6e 63 6c 75 64 65 20 | 3c 57 69 6e 64 6f 77 73 |include |<Windows|
|00000310| 2e 68 3e 0d 23 65 6e 64 | 69 66 0d 23 69 66 6e 64 |.h>.#end|if.#ifnd|
|00000320| 65 66 20 5f 5f 44 49 41 | 4c 4f 47 53 5f 5f 0d 23 |ef __DIA|LOGS__.#|
|00000330| 69 6e 63 6c 75 64 65 20 | 3c 44 69 61 6c 6f 67 73 |include |<Dialogs|
|00000340| 2e 68 3e 0d 23 65 6e 64 | 69 66 0d 23 69 66 6e 64 |.h>.#end|if.#ifnd|
|00000350| 65 66 20 5f 5f 51 55 49 | 43 4b 44 52 41 57 5f 5f |ef __QUI|CKDRAW__|
|00000360| 0d 23 69 6e 63 6c 75 64 | 65 20 3c 51 75 69 63 6b |.#includ|e <Quick|
|00000370| 64 72 61 77 2e 68 3e 0d | 23 65 6e 64 69 66 0d 23 |draw.h>.|#endif.#|
|00000380| 69 66 6e 64 65 66 20 5f | 5f 52 45 53 4f 55 52 43 |ifndef _|_RESOURC|
|00000390| 45 53 5f 5f 0d 23 69 6e | 63 6c 75 64 65 20 3c 52 |ES__.#in|clude <R|
|000003a0| 65 73 6f 75 72 63 65 73 | 2e 68 3e 0d 23 65 6e 64 |esources|.h>.#end|
|000003b0| 69 66 0d 23 69 66 6e 64 | 65 66 20 5f 5f 4d 45 4d |if.#ifnd|ef __MEM|
|000003c0| 4f 52 59 5f 5f 0d 23 69 | 6e 63 6c 75 64 65 20 3c |ORY__.#i|nclude <|
|000003d0| 4d 65 6d 6f 72 79 2e 68 | 3e 0d 23 65 6e 64 69 66 |Memory.h|>.#endif|
|000003e0| 0d 23 69 66 6e 64 65 66 | 20 5f 5f 46 49 4c 45 53 |.#ifndef| __FILES|
|000003f0| 5f 5f 0d 23 69 6e 63 6c | 75 64 65 20 3c 46 69 6c |__.#incl|ude <Fil|
|00000400| 65 73 2e 68 3e 0d 23 65 | 6e 64 69 66 0d 23 69 66 |es.h>.#e|ndif.#if|
|00000410| 6e 64 65 66 20 5f 5f 53 | 54 41 4e 44 41 52 44 46 |ndef __S|TANDARDF|
|00000420| 49 4c 45 5f 5f 0d 23 69 | 6e 63 6c 75 64 65 20 3c |ILE__.#i|nclude <|
|00000430| 53 74 61 6e 64 61 72 64 | 46 69 6c 65 2e 68 3e 0d |Standard|File.h>.|
|00000440| 23 65 6e 64 69 66 0d 23 | 69 66 6e 64 65 66 20 5f |#endif.#|ifndef _|
|00000450| 5f 53 59 53 45 51 55 5f | 5f 0d 23 69 6e 63 6c 75 |_SYSEQU_|_.#inclu|
|00000460| 64 65 20 3c 53 79 73 45 | 71 75 2e 68 3e 0d 23 65 |de <SysE|qu.h>.#e|
|00000470| 6e 64 69 66 0d 23 69 66 | 6e 64 65 66 20 5f 5f 50 |ndif.#if|ndef __P|
|00000480| 4c 53 54 52 49 4e 47 46 | 55 4e 43 53 5f 5f 0d 23 |LSTRINGF|UNCS__.#|
|00000490| 69 6e 63 6c 75 64 65 20 | 3c 50 4c 53 74 72 69 6e |include |<PLStrin|
|000004a0| 67 46 75 6e 63 73 2e 68 | 3e 0d 23 65 6e 64 69 66 |gFuncs.h|>.#endif|
|000004b0| 0d 0d 23 69 66 6e 64 65 | 66 20 5f 5f 41 45 52 65 |..#ifnde|f __AERe|
|000004c0| 67 69 73 74 72 79 5f 5f | 0d 23 69 6e 63 6c 75 64 |gistry__|.#includ|
|000004d0| 65 20 3c 41 45 52 65 67 | 69 73 74 72 79 2e 68 3e |e <AEReg|istry.h>|
|000004e0| 0d 23 65 6e 64 69 66 0d | 23 69 66 6e 64 65 66 20 |.#endif.|#ifndef |
|000004f0| 5f 5f 41 53 52 45 47 49 | 53 54 52 59 5f 5f 0d 23 |__ASREGI|STRY__.#|
|00000500| 69 6e 63 6c 75 64 65 20 | 3c 41 53 52 65 67 69 73 |include |<ASRegis|
|00000510| 74 72 79 2e 68 3e 0d 23 | 65 6e 64 69 66 0d 23 69 |try.h>.#|endif.#i|
|00000520| 66 6e 64 65 66 20 5f 5f | 41 50 50 4c 45 45 56 45 |fndef __|APPLEEVE|
|00000530| 4e 54 53 5f 5f 0d 23 69 | 6e 63 6c 75 64 65 20 3c |NTS__.#i|nclude <|
|00000540| 41 70 70 6c 65 45 76 65 | 6e 74 73 2e 68 3e 0d 23 |AppleEve|nts.h>.#|
|00000550| 65 6e 64 69 66 0d 23 69 | 66 6e 64 65 66 20 5f 5f |endif.#i|fndef __|
|00000560| 41 45 4f 42 4a 45 43 54 | 53 5f 5f 0d 23 69 6e 63 |AEOBJECT|S__.#inc|
|00000570| 6c 75 64 65 20 3c 41 45 | 4f 62 6a 65 63 74 73 2e |lude <AE|Objects.|
|00000580| 68 3e 0d 23 65 6e 64 69 | 66 0d 23 69 66 6e 64 65 |h>.#endi|f.#ifnde|
|00000590| 66 20 5f 5f 4f 53 41 5f | 5f 0d 23 69 6e 63 6c 75 |f __OSA_|_.#inclu|
|000005a0| 64 65 20 3c 4f 53 41 2e | 68 3e 0d 23 65 6e 64 69 |de <OSA.|h>.#endi|
|000005b0| 66 0d 23 69 66 6e 64 65 | 66 20 5f 5f 41 50 50 4c |f.#ifnde|f __APPL|
|000005c0| 45 53 43 52 49 50 54 5f | 5f 0d 23 69 6e 63 6c 75 |ESCRIPT_|_.#inclu|
|000005d0| 64 65 20 3c 41 70 70 6c | 65 53 63 72 69 70 74 2e |de <Appl|eScript.|
|000005e0| 68 3e 0d 23 65 6e 64 69 | 66 0d 23 69 66 6e 64 65 |h>.#endi|f.#ifnde|
|000005f0| 66 20 5f 5f 41 53 44 45 | 42 55 47 47 49 4e 47 5f |f __ASDE|BUGGING_|
|00000600| 5f 0d 23 69 6e 63 6c 75 | 64 65 20 3c 41 53 44 65 |_.#inclu|de <ASDe|
|00000610| 62 75 67 67 69 6e 67 2e | 68 3e 0d 23 65 6e 64 69 |bugging.|h>.#endi|
|00000620| 66 0d 0d 23 69 66 6e 64 | 65 66 20 5f 5f 41 45 4f |f..#ifnd|ef __AEO|
|00000630| 4d 54 4f 4b 45 4e 53 5f | 5f 0d 23 69 6e 63 6c 75 |MTOKENS_|_.#inclu|
|00000640| 64 65 20 22 4f 62 6a 4d | 6f 64 65 6c 54 6f 6b 65 |de "ObjM|odelToke|
|00000650| 6e 73 2e 68 22 0d 23 65 | 6e 64 69 66 0d 23 69 66 |ns.h".#e|ndif.#if|
|00000660| 6e 64 65 66 20 5f 5f 41 | 45 4f 4d 45 56 45 4e 54 |ndef __A|EOMEVENT|
|00000670| 53 5f 5f 0d 23 69 6e 63 | 6c 75 64 65 20 22 4f 62 |S__.#inc|lude "Ob|
|00000680| 6a 4d 6f 64 65 6c 45 76 | 65 6e 74 73 2e 68 22 0d |jModelEv|ents.h".|
|00000690| 23 65 6e 64 69 66 0d 0d | 23 69 66 6e 64 65 66 20 |#endif..|#ifndef |
|000006a0| 5f 5f 53 43 52 49 50 54 | 4f 42 4a 45 43 54 53 5f |__SCRIPT|OBJECTS_|
|000006b0| 5f 0d 23 69 6e 63 6c 75 | 64 65 20 22 53 63 72 69 |_.#inclu|de "Scri|
|000006c0| 70 74 61 62 6c 65 4f 62 | 6a 65 63 74 73 2e 68 22 |ptableOb|jects.h"|
|000006d0| 0d 23 65 6e 64 69 66 0d | 0d 23 69 66 6e 64 65 66 |.#endif.|.#ifndef|
|000006e0| 20 5f 5f 53 43 52 49 50 | 54 55 54 49 4c 53 5f 5f | __SCRIP|TUTILS__|
|000006f0| 0d 23 69 6e 63 6c 75 64 | 65 20 22 53 63 72 69 70 |.#includ|e "Scrip|
|00000700| 74 55 74 69 6c 73 2e 68 | 22 0d 23 65 6e 64 69 66 |tUtils.h|".#endif|
|00000710| 0d 0d 0d 65 78 74 65 72 | 6e 20 22 43 22 20 7b 0d |...exter|n "C" {.|
|00000720| 23 69 6e 63 6c 75 64 65 | 20 22 41 45 42 75 69 6c |#include| "AEBuil|
|00000730| 64 2e 68 22 0d 23 69 6e | 63 6c 75 64 65 20 22 41 |d.h".#in|clude "A|
|00000740| 45 42 75 69 6c 64 47 6c | 6f 62 61 6c 73 2e 68 22 |EBuildGl|obals.h"|
|00000750| 0d 23 69 6e 63 6c 75 64 | 65 20 22 41 45 50 72 69 |.#includ|e "AEPri|
|00000760| 6e 74 2e 68 22 0d 7d 0d | 23 69 6e 63 6c 75 64 65 |nt.h".}.|#include|
|00000770| 20 22 41 45 42 75 69 6c | 64 45 72 72 4d 73 67 73 | "AEBuil|dErrMsgs|
|00000780| 2e 68 22 0d 0d 0d 23 69 | 6e 63 6c 75 64 65 20 22 |.h"...#i|nclude "|
|00000790| 44 65 62 75 67 54 72 61 | 63 65 2e 68 22 0d 0d 0d |DebugTra|ce.h"...|
|000007a0| 23 70 72 61 67 6d 61 20 | 73 65 67 6d 65 6e 74 20 |#pragma |segment |
|000007b0| 41 45 76 65 6e 74 48 61 | 6e 64 6c 65 72 73 0d 0d |AEventHa|ndlers..|
|000007c0| 0d 76 6f 69 64 09 44 75 | 6d 70 41 70 70 6c 65 45 |.void.Du|mpAppleE|
|000007d0| 76 65 6e 74 28 63 68 61 | 72 20 2a 6d 73 67 2c 20 |vent(cha|r *msg, |
|000007e0| 41 45 44 65 73 63 20 2a | 64 65 73 63 29 0d 7b 0d |AEDesc *|desc).{.|
|000007f0| 09 69 66 20 28 6d 73 67 | 29 0d 09 09 70 72 69 6e |.if (msg|)...prin|
|00000800| 74 66 28 22 25 73 22 2c | 20 6d 73 67 29 3b 0d 09 |tf("%s",| msg);..|
|00000810| 09 0d 09 69 66 20 28 64 | 65 73 63 29 0d 09 7b 0d |...if (d|esc)..{.|
|00000820| 09 09 63 68 61 72 09 62 | 75 66 5b 33 30 30 30 5d |..char.b|uf[3000]|
|00000830| 3b 0d 09 09 69 66 20 28 | 41 45 50 72 69 6e 74 28 |;...if (|AEPrint(|
|00000840| 64 65 73 63 2c 20 62 75 | 66 2c 20 33 30 30 30 29 |desc, bu|f, 3000)|
|00000850| 20 3d 3d 20 30 29 0d 09 | 09 7b 0d 09 09 09 70 72 | == 0)..|.{....pr|
|00000860| 69 6e 74 66 28 62 75 66 | 29 3b 0d 09 09 09 70 72 |intf(buf|);....pr|
|00000870| 69 6e 74 66 28 22 5c 6e | 22 29 3b 0d 09 09 7d 0d |intf("\n|");...}.|
|00000880| 09 7d 0d 7d 0d 0d 4f 53 | 45 72 72 20 47 65 74 43 |.}.}..OS|Err GetC|
|00000890| 75 72 72 65 6e 74 41 70 | 70 46 69 6c 65 53 70 65 |urrentAp|pFileSpe|
|000008a0| 63 28 73 68 6f 72 74 20 | 2a 76 52 65 66 4e 75 6d |c(short |*vRefNum|
|000008b0| 2c 20 6c 6f 6e 67 20 2a | 64 69 72 49 44 2c 20 53 |, long *|dirID, S|
|000008c0| 74 72 69 6e 67 50 74 72 | 20 66 69 6c 65 4e 61 6d |tringPtr| fileNam|
|000008d0| 65 29 0d 7b 0d 09 4f 53 | 45 72 72 09 09 09 09 65 |e).{..OS|Err....e|
|000008e0| 72 72 20 3d 20 30 3b 0d | 09 50 72 6f 63 65 73 73 |rr = 0;.|.Process|
|000008f0| 49 6e 66 6f 52 65 63 09 | 09 70 49 6e 66 6f 3b 0d |InfoRec.|.pInfo;.|
|00000900| 09 50 72 6f 63 65 73 73 | 53 65 72 69 61 6c 4e 75 |.Process|SerialNu|
|00000910| 6d 62 65 72 09 70 4e 75 | 6d 3b 0d 09 46 53 53 70 |mber.pNu|m;..FSSp|
|00000920| 65 63 09 09 09 09 66 53 | 70 65 63 3b 0d 09 0d 09 |ec....fS|pec;....|
|00000930| 65 72 72 20 3d 20 47 65 | 74 43 75 72 72 65 6e 74 |err = Ge|tCurrent|
|00000940| 50 72 6f 63 65 73 73 28 | 26 70 4e 75 6d 29 3b 0d |Process(|&pNum);.|
|00000950| 09 69 66 20 28 65 72 72 | 20 3d 3d 20 6e 6f 45 72 |.if (err| == noEr|
|00000960| 72 29 20 0d 09 7b 0d 09 | 09 70 49 6e 66 6f 2e 70 |r) ..{..|.pInfo.p|
|00000970| 72 6f 63 65 73 73 49 6e | 66 6f 4c 65 6e 67 74 68 |rocessIn|foLength|
|00000980| 20 3d 20 73 69 7a 65 6f | 66 28 70 49 6e 66 6f 29 | = sizeo|f(pInfo)|
|00000990| 3b 0d 09 09 70 49 6e 66 | 6f 2e 70 72 6f 63 65 73 |;...pInf|o.proces|
|000009a0| 73 4e 61 6d 65 20 3d 20 | 4e 55 4c 4c 3b 0d 09 09 |sName = |NULL;...|
|000009b0| 70 49 6e 66 6f 2e 70 72 | 6f 63 65 73 73 41 70 70 |pInfo.pr|ocessApp|
|000009c0| 53 70 65 63 20 3d 20 26 | 66 53 70 65 63 3b 0d 09 |Spec = &|fSpec;..|
|000009d0| 09 65 72 72 20 3d 20 47 | 65 74 50 72 6f 63 65 73 |.err = G|etProces|
|000009e0| 73 49 6e 66 6f 72 6d 61 | 74 69 6f 6e 28 26 70 4e |sInforma|tion(&pN|
|000009f0| 75 6d 2c 20 26 70 49 6e | 66 6f 29 3b 0d 09 7d 0d |um, &pIn|fo);..}.|
|00000a00| 09 69 66 20 28 65 72 72 | 20 3d 3d 20 6e 6f 45 72 |.if (err| == noEr|
|00000a10| 72 29 20 0d 09 7b 0d 09 | 09 2a 76 52 65 66 4e 75 |r) ..{..|.*vRefNu|
|00000a20| 6d 20 3d 20 66 53 70 65 | 63 2e 76 52 65 66 4e 75 |m = fSpe|c.vRefNu|
|00000a30| 6d 3b 0d 09 09 2a 64 69 | 72 49 44 20 3d 20 66 53 |m;...*di|rID = fS|
|00000a40| 70 65 63 2e 70 61 72 49 | 44 3b 0d 09 09 50 4c 73 |pec.parI|D;...PLs|
|00000a50| 74 72 63 70 79 28 28 53 | 74 72 69 6e 67 50 74 72 |trcpy((S|tringPtr|
|00000a60| 29 66 69 6c 65 4e 61 6d | 65 2c 20 66 53 70 65 63 |)fileNam|e, fSpec|
|00000a70| 2e 6e 61 6d 65 29 3b 0d | 09 7d 09 0d 09 0d 09 72 |.name);.|.}.....r|
|00000a80| 65 74 75 72 6e 20 65 72 | 72 3b 0d 7d 0d 0d 0d 76 |eturn er|r;.}...v|
|00000a90| 6f 69 64 20 47 65 74 43 | 75 72 72 41 70 70 4e 61 |oid GetC|urrAppNa|
|00000aa0| 6d 65 28 43 53 74 72 32 | 35 35 26 20 61 70 70 4e |me(CStr2|55& appN|
|00000ab0| 61 6d 65 29 0d 7b 0d 09 | 73 68 6f 72 74 20 09 09 |ame).{..|short ..|
|00000ac0| 09 76 52 65 66 4e 75 6d | 3b 0d 09 6c 6f 6e 67 20 |.vRefNum|;..long |
|00000ad0| 09 09 09 64 69 72 49 44 | 3b 0d 09 53 74 72 32 35 |...dirID|;..Str25|
|00000ae0| 35 09 09 09 66 69 6c 65 | 4e 61 6d 65 3b 0d 09 4f |5...file|Name;..O|
|00000af0| 53 45 72 72 20 09 09 09 | 65 72 72 20 3d 20 47 65 |SErr ...|err = Ge|
|00000b00| 74 43 75 72 72 65 6e 74 | 41 70 70 46 69 6c 65 53 |tCurrent|AppFileS|
|00000b10| 70 65 63 28 26 76 52 65 | 66 4e 75 6d 2c 20 26 64 |pec(&vRe|fNum, &d|
|00000b20| 69 72 49 44 2c 20 28 53 | 74 72 69 6e 67 50 74 72 |irID, (S|tringPtr|
|00000b30| 29 66 69 6c 65 4e 61 6d | 65 29 3b 0d 09 0d 09 69 |)fileNam|e);....i|
|00000b40| 66 20 28 65 72 72 20 3d | 3d 20 6e 6f 45 72 72 29 |f (err =|= noErr)|
|00000b50| 0d 09 09 61 70 70 4e 61 | 6d 65 20 3d 20 66 69 6c |...appNa|me = fil|
|00000b60| 65 4e 61 6d 65 3b 0d 7d | 0d 0d 0d 0d 0d 23 64 65 |eName;.}|.....#de|
|00000b70| 66 69 6e 65 20 6f 70 74 | 69 6f 6e 4b 65 79 43 6f |fine opt|ionKeyCo|
|00000b80| 64 65 20 09 30 78 33 41 | 0d 23 64 65 66 69 6e 65 |de .0x3A|.#define|
|00000b90| 20 73 68 69 66 74 4b 65 | 79 43 6f 64 65 20 09 30 | shiftKe|yCode .0|
|00000ba0| 78 33 38 0d 23 64 65 66 | 69 6e 65 20 63 6d 64 4b |x38.#def|ine cmdK|
|00000bb0| 65 79 43 6f 64 65 20 09 | 09 30 78 33 37 0d 23 64 |eyCode .|.0x37.#d|
|00000bc0| 65 66 69 6e 65 20 63 74 | 72 6c 4b 65 79 43 6f 64 |efine ct|rlKeyCod|
|00000bd0| 65 20 09 30 78 33 42 0d | 0d 73 74 61 74 69 63 20 |e .0x3B.|.static |
|00000be0| 42 6f 6f 6c 65 61 6e 20 | 69 73 4b 65 79 44 6f 77 |Boolean |isKeyDow|
|00000bf0| 6e 28 6c 6f 6e 67 20 6b | 65 79 43 6f 64 65 29 0d |n(long k|eyCode).|
|00000c00| 7b 0d 09 4b 65 79 4d 61 | 70 20 6b 65 79 73 3b 0d |{..KeyMa|p keys;.|
|00000c10| 09 42 79 74 65 20 2a 6b | 65 79 73 42 79 74 65 73 |.Byte *k|eysBytes|
|00000c20| 3b 0d 09 0d 09 47 65 74 | 4b 65 79 73 28 6b 65 79 |;....Get|Keys(key|
|00000c30| 73 29 3b 0d 09 0d 09 6b | 65 79 73 42 79 74 65 73 |s);....k|eysBytes|
|00000c40| 20 3d 20 28 42 79 74 65 | 20 2a 29 6b 65 79 73 3b | = (Byte| *)keys;|
|00000c50| 0d 0d 09 72 65 74 75 72 | 6e 28 28 6b 65 79 73 42 |...retur|n((keysB|
|00000c60| 79 74 65 73 5b 6b 65 79 | 43 6f 64 65 2f 38 5d 20 |ytes[key|Code/8] |
|00000c70| 26 20 28 31 20 3c 3c 20 | 6b 65 79 43 6f 64 65 20 |& (1 << |keyCode |
|00000c80| 25 20 38 29 29 20 21 3d | 20 30 29 3b 0d 7d 0d 0d |% 8)) !=| 0);.}..|
|00000c90| 0d 0d 73 74 61 74 69 63 | 20 70 61 73 63 61 6c 20 |..static| pascal |
|00000ca0| 20 42 6f 6f 6c 65 61 6e | 20 53 74 64 49 64 6c 65 | Boolean| StdIdle|
|00000cb0| 46 75 6e 63 74 69 6f 6e | 20 28 45 76 65 6e 74 52 |Function| (EventR|
|00000cc0| 65 63 6f 72 64 20 2a 74 | 68 65 45 76 65 6e 74 52 |ecord *t|heEventR|
|00000cd0| 65 63 6f 72 64 2c 0d 09 | 09 09 09 09 09 09 09 09 |ecord,..|........|
|00000ce0| 09 6c 6f 6e 67 20 2a 73 | 6c 65 65 70 54 69 6d 65 |.long *s|leepTime|
|00000cf0| 2c 0d 09 09 09 09 09 09 | 09 09 09 09 52 67 6e 48 |,.......|....RgnH|
|00000d00| 61 6e 64 6c 65 20 2a 6d | 6f 75 73 65 52 67 6e 29 |andle *m|ouseRgn)|
|00000d10| 0d 7b 0d 09 72 65 74 75 | 72 6e 09 66 61 6c 73 65 |.{..retu|rn.false|
|00000d20| 3b 0d 7d 0d 0d 0d 73 74 | 61 74 69 63 20 70 61 73 |;.}...st|atic pas|
|00000d30| 63 61 6c 20 4f 53 45 72 | 72 20 47 65 74 41 45 54 |cal OSEr|r GetAET|
|00000d40| 45 41 45 76 74 48 61 6e | 64 6c 65 72 20 20 28 41 |EAEvtHan|dler (A|
|00000d50| 70 70 6c 65 45 76 65 6e | 74 20 2a 74 68 65 45 76 |ppleEven|t *theEv|
|00000d60| 65 6e 74 2c 20 0d 09 09 | 09 09 09 09 09 09 09 09 |ent, ...|........|
|00000d70| 41 70 70 6c 65 45 76 65 | 6e 74 20 2a 74 68 65 52 |AppleEve|nt *theR|
|00000d80| 65 70 6c 79 2c 20 0d 09 | 09 09 09 09 09 09 09 09 |eply, ..|........|
|00000d90| 09 6c 6f 6e 67 20 74 68 | 65 52 65 66 43 6f 6e 29 |.long th|eRefCon)|
|00000da0| 0d 7b 0d 09 4f 53 41 45 | 72 72 6f 72 20 09 09 65 |.{..OSAE|rror ..e|
|00000db0| 72 72 20 3d 20 65 72 72 | 41 45 45 76 65 6e 74 4e |rr = err|AEEventN|
|00000dc0| 6f 74 48 61 6e 64 6c 65 | 64 3b 0d 09 41 45 44 65 |otHandle|d;..AEDe|
|00000dd0| 73 63 09 09 09 64 61 74 | 61 44 65 73 63 2c 20 72 |sc...dat|aDesc, r|
|00000de0| 65 73 75 6c 74 44 65 73 | 63 3b 0d 09 73 68 6f 72 |esultDes|c;..shor|
|00000df0| 74 09 09 09 6c 61 6e 67 | 75 61 67 65 43 6f 64 65 |t...lang|uageCode|
|00000e00| 3b 0d 09 0d 09 49 6e 69 | 74 41 45 44 65 73 63 73 |;....Ini|tAEDescs|
|00000e10| 28 26 64 61 74 61 44 65 | 73 63 2c 20 26 72 65 73 |(&dataDe|sc, &res|
|00000e20| 75 6c 74 44 65 73 63 2c | 20 6b 45 6e 64 4f 66 4c |ultDesc,| kEndOfL|
|00000e30| 69 73 74 29 3b 0d 09 0d | 09 65 72 72 20 3d 20 41 |ist);...|.err = A|
|00000e40| 45 47 65 74 50 61 72 61 | 6d 44 65 73 63 28 74 68 |EGetPara|mDesc(th|
|00000e50| 65 45 76 65 6e 74 2c 20 | 6b 65 79 44 69 72 65 63 |eEvent, |keyDirec|
|00000e60| 74 4f 62 6a 65 63 74 2c | 20 74 79 70 65 41 45 4c |tObject,| typeAEL|
|00000e70| 69 73 74 2c 20 26 64 61 | 74 61 44 65 73 63 29 3b |ist, &da|taDesc);|
|00000e80| 0d 09 69 66 20 28 65 72 | 72 20 3d 3d 20 6e 6f 45 |..if (er|r == noE|
|00000e90| 72 72 29 0d 09 09 65 72 | 72 20 3d 20 47 65 74 49 |rr)...er|r = GetI|
|00000ea0| 6e 74 65 67 65 72 46 72 | 6f 6d 44 65 73 63 72 69 |ntegerFr|omDescri|
|00000eb0| 70 74 6f 72 28 26 64 61 | 74 61 44 65 73 63 2c 20 |ptor(&da|taDesc, |
|00000ec0| 26 6c 61 6e 67 75 61 67 | 65 43 6f 64 65 29 3b 0d |&languag|eCode);.|
|00000ed0| 09 69 66 20 28 65 72 72 | 20 3d 3d 20 6e 6f 45 72 |.if (err| == noEr|
|00000ee0| 72 29 0d 09 09 65 72 72 | 20 3d 20 41 45 43 72 65 |r)...err| = AECre|
|00000ef0| 61 74 65 4c 69 73 74 28 | 4e 55 4c 4c 2c 20 30 2c |ateList(|NULL, 0,|
|00000f00| 20 66 61 6c 73 65 2c 20 | 26 72 65 73 75 6c 74 44 | false, |&resultD|
|00000f10| 65 73 63 29 3b 0d 09 09 | 0d 09 69 66 20 28 65 72 |esc);...|..if (er|
|00000f20| 72 20 3d 3d 20 6e 6f 45 | 72 72 20 26 26 20 67 53 |r == noE|rr && gS|
|00000f30| 69 6d 70 6c 69 46 61 63 | 65 32 29 0d 09 09 65 72 |impliFac|e2)...er|
|00000f40| 72 20 3d 20 67 53 69 6d | 70 6c 69 46 61 63 65 32 |r = gSim|pliFace2|
|00000f50| 2d 3e 43 6f 6c 6c 65 63 | 74 41 45 54 45 73 28 6c |->Collec|tAETEs(l|
|00000f60| 61 6e 67 75 61 67 65 43 | 6f 64 65 2c 20 72 65 73 |anguageC|ode, res|
|00000f70| 75 6c 74 44 65 73 63 29 | 3b 0d 09 09 0d 09 69 66 |ultDesc)|;.....if|
|00000f80| 20 28 65 72 72 20 3d 3d | 20 6e 6f 45 72 72 29 0d | (err ==| noErr).|
|00000f90| 09 09 65 72 72 20 3d 20 | 41 45 50 75 74 50 61 72 |..err = |AEPutPar|
|00000fa0| 61 6d 44 65 73 63 28 74 | 68 65 52 65 70 6c 79 2c |amDesc(t|heReply,|
|00000fb0| 20 6b 65 79 44 69 72 65 | 63 74 4f 62 6a 65 63 74 | keyDire|ctObject|
|00000fc0| 2c 20 26 72 65 73 75 6c | 74 44 65 73 63 29 3b 0d |, &resul|tDesc);.|
|00000fd0| 0d 09 44 69 73 70 6f 73 | 65 41 45 44 65 73 63 73 |..Dispos|eAEDescs|
|00000fe0| 28 26 64 61 74 61 44 65 | 73 63 2c 20 26 72 65 73 |(&dataDe|sc, &res|
|00000ff0| 75 6c 74 44 65 73 63 2c | 20 6b 45 6e 64 4f 66 4c |ultDesc,| kEndOfL|
|00001000| 69 73 74 29 3b 0d 09 0d | 09 72 65 74 75 72 6e 20 |ist);...|.return |
|00001010| 28 4f 53 45 72 72 29 65 | 72 72 3b 0d 7d 0d 0d 0d |(OSErr)e|rr;.}...|
|00001020| 6c 6f 6e 67 20 65 76 65 | 6e 74 48 61 6e 64 6c 65 |long eve|ntHandle|
|00001030| 72 44 65 70 74 68 20 3d | 20 30 3b 0d 0d 73 74 61 |rDepth =| 0;..sta|
|00001040| 74 69 63 20 70 61 73 63 | 61 6c 20 4f 53 45 72 72 |tic pasc|al OSErr|
|00001050| 20 45 78 65 63 75 74 65 | 45 76 65 6e 74 49 6e 43 | Execute|EventInC|
|00001060| 6f 6e 74 65 78 74 20 28 | 41 70 70 6c 65 45 76 65 |ontext (|AppleEve|
|00001070| 6e 74 20 2a 74 68 65 45 | 76 65 6e 74 2c 20 0d 09 |nt *theE|vent, ..|
|00001080| 09 09 09 09 09 09 09 09 | 09 41 70 70 6c 65 45 76 |........|.AppleEv|
|00001090| 65 6e 74 20 2a 74 68 65 | 52 65 70 6c 79 2c 20 0d |ent *the|Reply, .|
|000010a0| 09 09 09 09 09 09 09 09 | 09 09 54 53 63 72 69 70 |........|..TScrip|
|000010b0| 74 61 62 6c 65 4f 62 6a | 65 63 74 2a 20 74 68 65 |tableObj|ect* the|
|000010c0| 53 63 72 69 70 74 61 62 | 6c 65 4f 62 6a 29 0d 7b |Scriptab|leObj).{|
|000010d0| 0d 09 4f 53 41 45 72 72 | 6f 72 09 09 09 65 72 72 |..OSAErr|or...err|
|000010e0| 20 3d 20 65 72 72 41 45 | 45 76 65 6e 74 4e 6f 74 | = errAE|EventNot|
|000010f0| 48 61 6e 64 6c 65 64 3b | 0d 09 4f 53 41 49 44 20 |Handled;|..OSAID |
|00001100| 09 09 09 09 74 68 65 53 | 63 72 69 70 74 49 44 20 |....theS|criptID |
|00001110| 3d 20 6b 4f 53 41 4e 75 | 6c 6c 53 63 72 69 70 74 |= kOSANu|llScript|
|00001120| 3b 0d 09 0d 09 65 76 65 | 6e 74 48 61 6e 64 6c 65 |;....eve|ntHandle|
|00001130| 72 44 65 70 74 68 2b 2b | 3b 0d 2f 2f 09 70 72 69 |rDepth++|;.//.pri|
|00001140| 6e 74 66 28 22 5b 25 6c | 64 5d 20 65 6e 74 65 72 |ntf("[%l|d] enter|
|00001150| 69 6e 67 20 45 78 65 63 | 75 74 65 45 76 65 6e 74 |ing Exec|uteEvent|
|00001160| 49 6e 43 6f 6e 74 65 78 | 74 3a 20 22 2c 20 65 76 |InContex|t: ", ev|
|00001170| 65 6e 74 48 61 6e 64 6c | 65 72 44 65 70 74 68 29 |entHandl|erDepth)|
|00001180| 3b 0d 2f 2f 09 44 75 6d | 70 41 70 70 6c 65 45 76 |;.//.Dum|pAppleEv|
|00001190| 65 6e 74 28 22 22 2c 20 | 74 68 65 45 76 65 6e 74 |ent("", |theEvent|
|000011a0| 29 3b 0d 0d 09 69 66 20 | 28 74 68 65 53 63 72 69 |);...if |(theScri|
|000011b0| 70 74 61 62 6c 65 4f 62 | 6a 29 0d 09 09 74 68 65 |ptableOb|j)...the|
|000011c0| 53 63 72 69 70 74 49 44 | 20 3d 20 74 68 65 53 63 |ScriptID| = theSc|
|000011d0| 72 69 70 74 61 62 6c 65 | 4f 62 6a 2d 3e 47 65 74 |riptable|Obj->Get|
|000011e0| 4f 62 6a 53 63 72 69 70 | 74 28 29 3b 0d 09 65 6c |ObjScrip|t();..el|
|000011f0| 73 65 20 69 66 20 28 67 | 53 63 72 69 70 74 41 64 |se if (g|ScriptAd|
|00001200| 6d 69 6e 69 73 74 72 61 | 74 6f 72 29 0d 09 09 74 |ministra|tor)...t|
|00001210| 68 65 53 63 72 69 70 74 | 49 44 20 3d 20 67 53 63 |heScript|ID = gSc|
|00001220| 72 69 70 74 41 64 6d 69 | 6e 69 73 74 72 61 74 6f |riptAdmi|nistrato|
|00001230| 72 2d 3e 47 65 74 53 68 | 61 72 65 64 53 63 72 69 |r->GetSh|aredScri|
|00001240| 70 74 28 29 3b 0d 09 09 | 0d 09 2f 2f 20 70 61 73 |pt();...|..// pas|
|00001250| 73 20 74 6f 20 73 63 72 | 69 70 74 20 66 6f 72 20 |s to scr|ipt for |
|00001260| 68 61 6e 64 6c 69 6e 67 | 0d 09 69 66 20 28 74 68 |handling|..if (th|
|00001270| 65 53 63 72 69 70 74 49 | 44 20 21 3d 20 6b 4f 53 |eScriptI|D != kOS|
|00001280| 41 4e 75 6c 6c 53 63 72 | 69 70 74 29 0d 09 7b 0d |ANullScr|ipt)..{.|
|00001290| 09 09 41 45 48 61 6e 64 | 6c 65 72 50 72 6f 63 50 |..AEHand|lerProcP|
|000012a0| 74 72 09 09 09 6f 6c 64 | 52 65 73 75 6d 65 50 72 |tr...old|ResumePr|
|000012b0| 6f 63 3b 0d 09 09 6c 6f | 6e 67 09 09 09 09 09 09 |oc;...lo|ng......|
|000012c0| 6f 6c 64 52 65 66 63 6f | 6e 3b 0d 0d 09 09 4f 53 |oldRefco|n;....OS|
|000012d0| 41 47 65 74 52 65 73 75 | 6d 65 44 69 73 70 61 74 |AGetResu|meDispat|
|000012e0| 63 68 50 72 6f 63 28 67 | 53 63 72 69 70 74 69 6e |chProc(g|Scriptin|
|000012f0| 67 43 6f 6d 70 6f 6e 65 | 6e 74 2c 20 26 6f 6c 64 |gCompone|nt, &old|
|00001300| 52 65 73 75 6d 65 50 72 | 6f 63 2c 20 26 6f 6c 64 |ResumePr|oc, &old|
|00001310| 52 65 66 63 6f 6e 29 3b | 0d 23 69 66 64 65 66 20 |Refcon);|.#ifdef |
|00001320| 71 55 73 65 4f 53 41 69 | 6e 68 65 72 69 74 61 6e |qUseOSAi|nheritan|
|00001330| 63 65 0d 09 09 54 53 63 | 72 69 70 74 61 62 6c 65 |ce...TSc|riptable|
|00001340| 4f 62 6a 65 63 74 2a 20 | 70 61 72 65 6e 74 4f 62 |Object* |parentOb|
|00001350| 6a 20 3d 20 4e 55 4c 4c | 3b 0d 09 09 69 66 20 28 |j = NULL|;...if (|
|00001360| 74 68 65 53 63 72 69 70 | 74 61 62 6c 65 4f 62 6a |theScrip|tableObj|
|00001370| 29 0d 09 09 7b 0d 09 09 | 09 70 61 72 65 6e 74 4f |)...{...|.parentO|
|00001380| 62 6a 20 3d 20 74 68 65 | 53 63 72 69 70 74 61 62 |bj = the|Scriptab|
|00001390| 6c 65 4f 62 6a 2d 3e 47 | 65 74 50 61 72 65 6e 74 |leObj->G|etParent|
|000013a0| 4f 62 6a 28 29 3b 0d 09 | 09 09 69 66 20 28 74 68 |Obj();..|..if (th|
|000013b0| 65 53 63 72 69 70 74 61 | 62 6c 65 4f 62 6a 20 3d |eScripta|bleObj =|
|000013c0| 3d 20 70 61 72 65 6e 74 | 4f 62 6a 29 0d 09 09 09 |= parent|Obj)....|
|000013d0| 7b 0d 09 09 09 09 70 72 | 69 6e 74 66 28 22 5b 25 |{.....pr|intf("[%|
|000013e0| 6c 64 5d 20 a5 a5 a5 62 | 69 67 20 70 72 6f 62 6c |ld] ...b|ig probl|
|000013f0| 65 6d 3a 20 72 65 63 75 | 72 73 69 76 65 20 63 6f |em: recu|rsive co|
|00001400| 6e 74 65 78 74 20 63 68 | 61 69 6e 5c 6e 22 2c 20 |ntext ch|ain\n", |
|00001410| 0d 09 09 09 09 09 09 09 | 65 76 65 6e 74 48 61 6e |........|eventHan|
|00001420| 64 6c 65 72 44 65 70 74 | 68 29 3b 0d 09 09 09 09 |dlerDept|h);.....|
|00001430| 72 65 74 75 72 6e 20 65 | 72 72 41 45 45 76 65 6e |return e|rrAEEven|
|00001440| 74 46 61 69 6c 65 64 3b | 09 2f 2f 20 28 73 68 6f |tFailed;|.// (sho|
|00001450| 75 6c 64 20 6e 65 76 65 | 72 20 68 61 70 70 65 6e |uld neve|r happen|
|00001460| 2c 20 62 75 74 2e 2e 2e | 29 20 62 61 72 66 0d 09 |, but...|) barf..|
|00001470| 09 09 7d 0d 09 09 09 65 | 72 72 20 3d 20 4f 53 41 |..}....e|rr = OSA|
|00001480| 53 65 74 52 65 73 75 6d | 65 44 69 73 70 61 74 63 |SetResum|eDispatc|
|00001490| 68 50 72 6f 63 28 67 53 | 63 72 69 70 74 69 6e 67 |hProc(gS|cripting|
|000014a0| 43 6f 6d 70 6f 6e 65 6e | 74 2c 20 0d 09 09 09 09 |Componen|t, .....|
|000014b0| 09 09 09 09 09 09 09 28 | 41 45 48 61 6e 64 6c 65 |.......(|AEHandle|
|000014c0| 72 50 72 6f 63 50 74 72 | 29 26 45 78 65 63 75 74 |rProcPtr|)&Execut|
|000014d0| 65 45 76 65 6e 74 49 6e | 43 6f 6e 74 65 78 74 2c |eEventIn|Context,|
|000014e0| 20 0d 09 09 09 09 09 09 | 09 09 09 09 09 28 6c 6f | .......|.....(lo|
|000014f0| 6e 67 29 70 61 72 65 6e | 74 4f 62 6a 29 3b 0d 09 |ng)paren|tObj);..|
|00001500| 09 7d 0d 09 09 65 6c 73 | 65 0d 09 09 09 65 72 72 |.}...els|e....err|
|00001510| 20 3d 20 4f 53 41 53 65 | 74 52 65 73 75 6d 65 44 | = OSASe|tResumeD|
|00001520| 69 73 70 61 74 63 68 50 | 72 6f 63 28 67 53 63 72 |ispatchP|roc(gScr|
|00001530| 69 70 74 69 6e 67 43 6f | 6d 70 6f 6e 65 6e 74 2c |iptingCo|mponent,|
|00001540| 20 0d 09 09 09 09 09 09 | 09 09 09 09 09 6b 4f 53 | .......|.....kOS|
|00001550| 41 55 73 65 53 74 61 6e | 64 61 72 64 44 69 73 70 |AUseStan|dardDisp|
|00001560| 61 74 63 68 2c 20 6b 4f | 53 41 44 6f 6e 74 55 73 |atch, kO|SADontUs|
|00001570| 65 50 68 61 63 29 3b 0d | 23 65 6c 73 65 0d 09 09 |ePhac);.|#else...|
|00001580| 65 72 72 20 3d 20 4f 53 | 41 53 65 74 52 65 73 75 |err = OS|ASetResu|
|00001590| 6d 65 44 69 73 70 61 74 | 63 68 50 72 6f 63 28 67 |meDispat|chProc(g|
|000015a0| 53 63 72 69 70 74 69 6e | 67 43 6f 6d 70 6f 6e 65 |Scriptin|gCompone|
|000015b0| 6e 74 2c 20 0d 09 09 09 | 09 09 09 09 09 09 09 6b |nt, ....|.......k|
|000015c0| 4f 53 41 55 73 65 53 74 | 61 6e 64 61 72 64 44 69 |OSAUseSt|andardDi|
|000015d0| 73 70 61 74 63 68 2c 20 | 6b 4f 53 41 44 6f 6e 74 |spatch, |kOSADont|
|000015e0| 55 73 65 50 68 61 63 29 | 3b 0d 23 65 6e 64 69 66 |UsePhac)|;.#endif|
|000015f0| 0d 09 09 69 66 20 28 65 | 72 72 20 3d 3d 20 6e 6f |...if (e|rr == no|
|00001600| 45 72 72 29 0d 09 09 7b | 0d 09 09 09 70 72 69 6e |Err)...{|....prin|
|00001610| 74 66 28 22 5b 25 6c 64 | 5d 20 68 61 6e 64 69 6e |tf("[%ld|] handin|
|00001620| 67 20 73 63 72 69 70 74 | 20 69 64 20 28 25 6c 64 |g script| id (%ld|
|00001630| 29 20 74 6f 20 4f 53 41 | 44 6f 45 76 65 6e 74 5c |) to OSA|DoEvent\|
|00001640| 6e 22 2c 20 0d 09 09 09 | 09 09 65 76 65 6e 74 48 |n", ....|..eventH|
|00001650| 61 6e 64 6c 65 72 44 65 | 70 74 68 2c 20 74 68 65 |andlerDe|pth, the|
|00001660| 53 63 72 69 70 74 49 44 | 29 3b 0d 09 09 09 65 72 |ScriptID|);....er|
|00001670| 72 20 3d 20 4f 53 41 44 | 6f 45 76 65 6e 74 28 67 |r = OSAD|oEvent(g|
|00001680| 53 63 72 69 70 74 69 6e | 67 43 6f 6d 70 6f 6e 65 |Scriptin|gCompone|
|00001690| 6e 74 2c 20 74 68 65 45 | 76 65 6e 74 2c 20 74 68 |nt, theE|vent, th|
|000016a0| 65 53 63 72 69 70 74 49 | 44 2c 20 0d 09 09 09 09 |eScriptI|D, .....|
|000016b0| 09 09 09 20 6b 4f 53 41 | 4d 6f 64 65 41 6c 77 61 |... kOSA|ModeAlwa|
|000016c0| 79 73 49 6e 74 65 72 61 | 63 74 2c 20 74 68 65 52 |ysIntera|ct, theR|
|000016d0| 65 70 6c 79 29 3b 0d 23 | 69 66 64 65 66 20 71 55 |eply);.#|ifdef qU|
|000016e0| 73 65 4f 53 41 69 6e 68 | 65 72 69 74 61 6e 63 65 |seOSAinh|eritance|
|000016f0| 0d 09 09 09 69 66 20 28 | 65 72 72 20 3d 3d 20 65 |....if (|err == e|
|00001700| 72 72 41 45 45 76 65 6e | 74 4e 6f 74 48 61 6e 64 |rrAEEven|tNotHand|
|00001710| 6c 65 64 29 0d 09 09 09 | 7b 0d 09 09 09 09 69 66 |led)....|{.....if|
|00001720| 20 28 74 68 65 53 63 72 | 69 70 74 61 62 6c 65 4f | (theScr|iptableO|
|00001730| 62 6a 29 0d 09 09 09 09 | 7b 0d 09 09 09 09 09 70 |bj).....|{......p|
|00001740| 72 69 6e 74 66 28 22 5b | 25 6c 64 5d 20 6e 6f 74 |rintf("[|%ld] not|
|00001750| 20 68 61 6e 64 6c 65 64 | 2c 20 73 6f 20 6d 61 6b | handled|, so mak|
|00001760| 69 6e 67 20 72 65 63 75 | 72 73 69 76 65 20 63 61 |ing recu|rsive ca|
|00001770| 6c 6c 20 74 6f 20 45 78 | 65 63 75 74 65 45 76 65 |ll to Ex|ecuteEve|
|00001780| 6e 74 49 6e 43 6f 6e 74 | 65 78 74 5c 6e 22 2c 20 |ntInCont|ext\n", |
|00001790| 0d 09 09 09 09 09 09 09 | 65 76 65 6e 74 48 61 6e |........|eventHan|
|000017a0| 64 6c 65 72 44 65 70 74 | 68 29 3b 0d 09 09 09 09 |dlerDept|h);.....|
|000017b0| 09 65 72 72 20 3d 20 45 | 78 65 63 75 74 65 45 76 |.err = E|xecuteEv|
|000017c0| 65 6e 74 49 6e 43 6f 6e | 74 65 78 74 28 74 68 65 |entInCon|text(the|
|000017d0| 45 76 65 6e 74 2c 20 74 | 68 65 52 65 70 6c 79 2c |Event, t|heReply,|
|000017e0| 20 70 61 72 65 6e 74 4f | 62 6a 29 3b 0d 09 09 09 | parentO|bj);....|
|000017f0| 09 7d 0d 09 09 09 09 65 | 6c 73 65 09 2f 2f 20 6f |.}.....e|lse.// o|
|00001800| 74 68 65 72 77 69 73 65 | 2c 20 64 69 73 70 61 74 |therwise|, dispat|
|00001810| 63 68 20 64 69 72 65 63 | 74 20 74 6f 20 73 74 61 |ch direc|t to sta|
|00001820| 6e 64 61 72 64 20 68 61 | 6e 64 6c 65 72 0d 09 09 |ndard ha|ndler...|
|00001830| 09 09 09 65 72 72 20 3d | 20 53 74 64 41 45 76 74 |...err =| StdAEvt|
|00001840| 48 61 6e 64 6c 65 72 28 | 74 68 65 45 76 65 6e 74 |Handler(|theEvent|
|00001850| 2c 20 74 68 65 52 65 70 | 6c 79 2c 20 30 29 3b 0d |, theRep|ly, 0);.|
|00001860| 09 09 09 7d 0d 23 65 6e | 64 69 66 0d 09 09 7d 0d |...}.#en|dif...}.|
|00001870| 09 09 4f 53 41 53 65 74 | 52 65 73 75 6d 65 44 69 |..OSASet|ResumeDi|
|00001880| 73 70 61 74 63 68 50 72 | 6f 63 28 67 53 63 72 69 |spatchPr|oc(gScri|
|00001890| 70 74 69 6e 67 43 6f 6d | 70 6f 6e 65 6e 74 2c 20 |ptingCom|ponent, |
|000018a0| 6f 6c 64 52 65 73 75 6d | 65 50 72 6f 63 2c 20 6f |oldResum|eProc, o|
|000018b0| 6c 64 52 65 66 63 6f 6e | 29 3b 0d 09 7d 0d 09 65 |ldRefcon|);..}..e|
|000018c0| 6c 73 65 0d 09 09 70 72 | 69 6e 74 66 28 22 45 78 |lse...pr|intf("Ex|
|000018d0| 65 63 75 74 65 45 76 65 | 6e 74 49 6e 43 6f 6e 74 |ecuteEve|ntInCont|
|000018e0| 65 78 74 20 77 61 73 20 | 68 61 6e 64 65 64 20 61 |ext was |handed a|
|000018f0| 20 6e 75 6c 6c 20 73 63 | 72 69 70 74 20 66 6f 72 | null sc|ript for|
|00001900| 20 65 78 65 63 75 74 69 | 6f 6e 5c 6e 22 29 3b 0d | executi|on\n");.|
|00001910| 0d 09 69 66 20 28 65 72 | 72 29 0d 09 09 70 72 69 |..if (er|r)...pri|
|00001920| 6e 74 66 28 22 5b 25 6c | 64 5d 20 45 78 65 63 75 |ntf("[%l|d] Execu|
|00001930| 74 65 45 76 65 6e 74 49 | 6e 43 6f 6e 74 65 78 74 |teEventI|nContext|
|00001940| 3a 20 65 72 72 20 3d 20 | 25 64 5c 6e 22 2c 20 65 |: err = |%d\n", e|
|00001950| 76 65 6e 74 48 61 6e 64 | 6c 65 72 44 65 70 74 68 |ventHand|lerDepth|
|00001960| 2c 20 65 72 72 29 3b 0d | 09 0d 09 65 76 65 6e 74 |, err);.|...event|
|00001970| 48 61 6e 64 6c 65 72 44 | 65 70 74 68 2d 2d 3b 0d |HandlerD|epth--;.|
|00001980| 09 72 65 74 75 72 6e 09 | 28 4f 53 45 72 72 29 65 |.return.|(OSErr)e|
|00001990| 72 72 3b 0d 7d 0d 0d 0d | 73 74 61 74 69 63 20 70 |rr;.}...|static p|
|000019a0| 61 73 63 61 6c 20 4f 53 | 45 72 72 20 53 74 64 41 |ascal OS|Err StdA|
|000019b0| 45 76 74 50 72 65 48 61 | 6e 64 6c 65 72 20 20 28 |EvtPreHa|ndler (|
|000019c0| 41 70 70 6c 65 45 76 65 | 6e 74 20 2a 74 68 65 45 |AppleEve|nt *theE|
|000019d0| 76 65 6e 74 2c 20 0d 09 | 09 09 09 09 09 09 09 09 |vent, ..|........|
|000019e0| 09 41 70 70 6c 65 45 76 | 65 6e 74 20 2a 74 68 65 |.AppleEv|ent *the|
|000019f0| 52 65 70 6c 79 2c 20 0d | 09 09 09 09 09 09 09 09 |Reply, .|........|
|00001a00| 09 09 6c 6f 6e 67 20 74 | 68 65 52 65 66 43 6f 6e |..long t|heRefCon|
|00001a10| 29 0d 7b 0d 09 4f 53 41 | 45 72 72 6f 72 20 09 09 |).{..OSA|Error ..|
|00001a20| 09 65 72 72 20 3d 20 65 | 72 72 41 45 45 76 65 6e |.err = e|rrAEEven|
|00001a30| 74 4e 6f 74 48 61 6e 64 | 6c 65 64 3b 0d 09 41 45 |tNotHand|led;..AE|
|00001a40| 45 76 65 6e 74 43 6c 61 | 73 73 20 09 09 74 68 65 |EventCla|ss ..the|
|00001a50| 45 76 74 43 6c 61 73 73 | 3b 0d 09 41 45 45 76 65 |EvtClass|;..AEEve|
|00001a60| 6e 74 49 44 20 09 09 09 | 74 68 65 45 76 74 49 44 |ntID ...|theEvtID|
|00001a70| 3b 0d 09 44 65 73 63 54 | 79 70 65 09 09 09 74 68 |;..DescT|ype...th|
|00001a80| 65 54 79 70 65 3b 0d 09 | 53 69 7a 65 09 09 09 09 |eType;..|Size....|
|00001a90| 74 68 65 53 69 7a 65 3b | 0d 09 41 45 44 65 73 63 |theSize;|..AEDesc|
|00001aa0| 09 09 09 09 64 69 72 65 | 63 74 50 61 72 61 6d 2c |....dire|ctParam,|
|00001ab0| 20 74 68 65 54 6f 6b 65 | 6e 44 65 73 63 3b 0d 09 | theToke|nDesc;..|
|00001ac0| 54 53 63 72 69 70 74 61 | 62 6c 65 4f 62 6a 65 63 |TScripta|bleObjec|
|00001ad0| 74 2a 09 74 68 65 53 63 | 72 69 70 74 61 62 6c 65 |t*.theSc|riptable|
|00001ae0| 4f 62 6a 20 3d 20 4e 55 | 4c 4c 3b 0d 09 54 53 63 |Obj = NU|LL;..TSc|
|00001af0| 72 69 70 74 61 62 6c 65 | 4f 62 6a 65 63 74 2a 09 |riptable|Object*.|
|00001b00| 73 61 76 65 64 50 61 72 | 65 6e 74 20 3d 20 4e 55 |savedPar|ent = NU|
|00001b10| 4c 4c 3b 0d 09 6f 62 6a | 4d 6f 64 65 6c 54 6f 6b |LL;..obj|ModelTok|
|00001b20| 65 6e 50 74 72 20 09 74 | 68 65 54 6f 6b 65 6e 20 |enPtr .t|heToken |
|00001b30| 3d 20 6e 69 6c 3b 0d 09 | 42 6f 6f 6c 65 61 6e 09 |= nil;..|Boolean.|
|00001b40| 09 09 09 6d 61 64 65 41 | 70 70 54 6f 6b 65 6e 20 |...madeA|ppToken |
|00001b50| 3d 20 66 61 6c 73 65 3b | 0d 09 44 65 73 63 54 79 |= false;|..DescTy|
|00001b60| 70 65 20 09 09 09 74 68 | 65 54 6f 6b 65 6e 43 6c |pe ...th|eTokenCl|
|00001b70| 61 73 73 3b 0d 09 44 65 | 73 63 54 79 70 65 09 09 |ass;..De|scType..|
|00001b80| 09 64 69 72 50 61 72 61 | 6d 54 79 70 65 3b 0d 09 |.dirPara|mType;..|
|00001b90| 0d 09 74 68 65 54 6f 6b | 65 6e 44 65 73 63 2e 64 |..theTok|enDesc.d|
|00001ba0| 65 73 63 72 69 70 74 6f | 72 54 79 70 65 20 3d 20 |escripto|rType = |
|00001bb0| 74 79 70 65 4e 75 6c 6c | 3b 0d 09 74 68 65 54 6f |typeNull|;..theTo|
|00001bc0| 6b 65 6e 44 65 73 63 2e | 64 61 74 61 48 61 6e 64 |kenDesc.|dataHand|
|00001bd0| 6c 65 20 3d 20 6e 69 6c | 3b 0d 0d 09 2f 2f 20 45 |le = nil|;...// E|
|00001be0| 78 74 72 61 63 74 20 74 | 68 65 20 63 6c 61 73 73 |xtract t|he class|
|00001bf0| 20 61 6e 64 20 49 44 20 | 6f 66 20 74 68 65 20 65 | and ID |of the e|
|00001c00| 76 65 6e 74 20 66 72 6f | 6d 20 74 68 65 20 41 70 |vent fro|m the Ap|
|00001c10| 70 6c 65 45 76 65 6e 74 | 0d 09 41 45 47 65 74 41 |pleEvent|..AEGetA|
|00001c20| 74 74 72 69 62 75 74 65 | 50 74 72 28 74 68 65 45 |ttribute|Ptr(theE|
|00001c30| 76 65 6e 74 2c 20 6b 65 | 79 45 76 65 6e 74 43 6c |vent, ke|yEventCl|
|00001c40| 61 73 73 41 74 74 72 2c | 20 74 79 70 65 54 79 70 |assAttr,| typeTyp|
|00001c50| 65 2c 20 26 74 68 65 54 | 79 70 65 2c 20 28 50 74 |e, &theT|ype, (Pt|
|00001c60| 72 29 20 26 74 68 65 45 | 76 74 43 6c 61 73 73 2c |r) &theE|vtClass,|
|00001c70| 20 73 69 7a 65 6f 66 28 | 74 68 65 45 76 74 43 6c | sizeof(|theEvtCl|
|00001c80| 61 73 73 29 2c 20 26 74 | 68 65 53 69 7a 65 29 3b |ass), &t|heSize);|
|00001c90| 20 0d 09 41 45 47 65 74 | 41 74 74 72 69 62 75 74 | ..AEGet|Attribut|
|00001ca0| 65 50 74 72 28 74 68 65 | 45 76 65 6e 74 2c 20 6b |ePtr(the|Event, k|
|00001cb0| 65 79 45 76 65 6e 74 49 | 44 41 74 74 72 2c 20 74 |eyEventI|DAttr, t|
|00001cc0| 79 70 65 54 79 70 65 2c | 20 26 74 68 65 54 79 70 |ypeType,| &theTyp|
|00001cd0| 65 2c 20 28 50 74 72 29 | 20 26 74 68 65 45 76 74 |e, (Ptr)| &theEvt|
|00001ce0| 49 44 2c 20 73 69 7a 65 | 6f 66 28 74 68 65 45 76 |ID, size|of(theEv|
|00001cf0| 74 49 44 29 2c 20 26 74 | 68 65 53 69 7a 65 29 3b |tID), &t|heSize);|
|00001d00| 20 0d 09 0d 09 44 75 6d | 70 41 70 70 6c 65 45 76 | ....Dum|pAppleEv|
|00001d10| 65 6e 74 28 22 a5 a5 53 | 74 64 41 45 76 74 50 72 |ent("..S|tdAEvtPr|
|00001d20| 65 48 61 6e 64 6c 65 72 | 3a 20 22 2c 20 74 68 65 |eHandler|: ", the|
|00001d30| 45 76 65 6e 74 29 3b 0d | 09 0d 09 69 66 20 28 69 |Event);.|...if (i|
|00001d40| 73 4b 65 79 44 6f 77 6e | 28 63 74 72 6c 4b 65 79 |sKeyDown|(ctrlKey|
|00001d50| 43 6f 64 65 29 20 26 26 | 20 69 73 4b 65 79 44 6f |Code) &&| isKeyDo|
|00001d60| 77 6e 28 63 6d 64 4b 65 | 79 43 6f 64 65 29 29 0d |wn(cmdKe|yCode)).|
|00001d70| 09 09 3b 09 2f 2f 20 6c | 65 74 20 75 73 65 72 20 |..;.// l|et user |
|00001d80| 6f 76 65 72 72 69 64 65 | 20 73 63 72 69 70 74 65 |override| scripte|
|00001d90| 64 20 65 76 65 6e 74 73 | 20 62 79 20 6b 65 79 69 |d events| by keyi|
|00001da0| 6e 67 20 63 6f 6e 74 72 | 6f 6c 2d 63 6f 6d 6d 61 |ng contr|ol-comma|
|00001db0| 6e 64 0d 09 65 6c 73 65 | 20 69 66 20 28 28 74 68 |nd..else| if ((th|
|00001dc0| 65 45 76 74 43 6c 61 73 | 73 20 3d 3d 20 6b 43 6f |eEvtClas|s == kCo|
|00001dd0| 72 65 45 76 65 6e 74 43 | 6c 61 73 73 20 26 26 20 |reEventC|lass && |
|00001de0| 74 68 65 45 76 74 49 44 | 20 21 3d 20 6b 41 45 4f |theEvtID| != kAEO|
|00001df0| 70 65 6e 41 70 70 6c 69 | 63 61 74 69 6f 6e 29 0d |penAppli|cation).|
|00001e00| 09 09 09 7c 7c 20 28 74 | 68 65 45 76 74 43 6c 61 |...|| (t|heEvtCla|
|00001e10| 73 73 20 3d 3d 20 6b 41 | 45 43 6f 72 65 53 75 69 |ss == kA|ECoreSui|
|00001e20| 74 65 20 26 26 20 74 68 | 65 45 76 74 49 44 20 21 |te && th|eEvtID !|
|00001e30| 3d 20 6b 41 45 53 65 74 | 44 61 74 61 20 26 26 20 |= kAESet|Data && |
|00001e40| 74 68 65 45 76 74 49 44 | 20 21 3d 20 6b 41 45 47 |theEvtID| != kAEG|
|00001e50| 65 74 44 61 74 61 29 0d | 09 09 09 7c 7c 20 28 74 |etData).|...|| (t|
|00001e60| 68 65 45 76 74 43 6c 61 | 73 73 20 3d 3d 20 6b 53 |heEvtCla|ss == kS|
|00001e70| 69 67 6e 61 74 75 72 65 | 20 26 26 20 74 68 65 45 |ignature| && theE|
|00001e80| 76 74 49 44 20 3d 3d 20 | 6b 41 45 53 79 73 74 65 |vtID == |kAESyste|
|00001e90| 6d 45 76 65 6e 74 29 0d | 09 09 09 7c 7c 20 28 74 |mEvent).|...|| (t|
|00001ea0| 68 65 45 76 74 43 6c 61 | 73 73 20 3d 3d 20 6b 41 |heEvtCla|ss == kA|
|00001eb0| 53 41 70 70 6c 65 53 63 | 72 69 70 74 53 75 69 74 |SAppleSc|riptSuit|
|00001ec0| 65 20 26 26 20 74 68 65 | 45 76 74 49 44 20 3d 3d |e && the|EvtID ==|
|00001ed0| 20 6b 41 53 53 75 62 72 | 6f 75 74 69 6e 65 45 76 | kASSubr|outineEv|
|00001ee0| 65 6e 74 29 29 0d 09 7b | 09 2f 2f 20 61 62 6f 76 |ent))..{|.// abov|
|00001ef0| 65 20 74 65 73 74 20 69 | 73 20 74 6f 20 6d 61 6b |e test i|s to mak|
|00001f00| 65 20 73 75 72 65 20 77 | 65 20 68 61 6e 64 6c 65 |e sure w|e handle|
|00001f10| 20 61 6c 6c 20 74 68 65 | 20 73 63 72 69 70 74 61 | all the| scripta|
|00001f20| 62 6c 65 20 65 76 65 6e | 74 73 20 0d 09 09 2f 2f |ble even|ts ...//|
|00001f30| 20 61 6e 64 20 74 68 61 | 74 20 77 65 20 73 6b 69 | and tha|t we ski|
|00001f40| 70 20 74 68 65 20 6f 6e | 65 73 20 77 65 20 64 6f |p the on|es we do|
|00001f50| 6e 27 74 20 77 61 6e 74 | 20 74 6f 20 62 65 20 73 |n't want| to be s|
|00001f60| 63 72 69 70 74 61 62 6c | 65 0d 09 09 65 72 72 20 |criptabl|e...err |
|00001f70| 3d 20 41 45 47 65 74 50 | 61 72 61 6d 44 65 73 63 |= AEGetP|aramDesc|
|00001f80| 28 74 68 65 45 76 65 6e | 74 2c 20 6b 65 79 44 69 |(theEven|t, keyDi|
|00001f90| 72 65 63 74 4f 62 6a 65 | 63 74 2c 20 74 79 70 65 |rectObje|ct, type|
|00001fa0| 57 69 6c 64 43 61 72 64 | 2c 20 26 64 69 72 65 63 |WildCard|, &direc|
|00001fb0| 74 50 61 72 61 6d 29 3b | 0d 09 09 69 66 20 28 65 |tParam);|...if (e|
|00001fc0| 72 72 20 3d 3d 20 6e 6f | 45 72 72 29 0d 09 09 7b |rr == no|Err)...{|
|00001fd0| 0d 09 09 09 64 69 72 50 | 61 72 61 6d 54 79 70 65 |....dirP|aramType|
|00001fe0| 20 3d 20 64 69 72 65 63 | 74 50 61 72 61 6d 2e 64 | = direc|tParam.d|
|00001ff0| 65 73 63 72 69 70 74 6f | 72 54 79 70 65 3b 0d 09 |escripto|rType;..|
|00002000| 09 09 69 66 20 28 64 69 | 72 50 61 72 61 6d 54 79 |..if (di|rParamTy|
|00002010| 70 65 20 3d 3d 20 74 79 | 70 65 4f 62 6a 65 63 74 |pe == ty|peObject|
|00002020| 53 70 65 63 69 66 69 65 | 72 29 0d 09 09 09 7b 0d |Specifie|r)....{.|
|00002030| 09 09 09 09 70 72 69 6e | 74 66 28 22 72 65 73 6f |....prin|tf("reso|
|00002040| 6c 76 69 6e 67 20 64 69 | 72 65 63 74 20 70 61 72 |lving di|rect par|
|00002050| 61 6d 65 74 65 72 5c 6e | 22 29 3b 0d 09 09 09 09 |ameter\n|");.....|
|00002060| 65 72 72 20 3d 20 41 45 | 52 65 73 6f 6c 76 65 28 |err = AE|Resolve(|
|00002070| 26 64 69 72 65 63 74 50 | 61 72 61 6d 2c 20 6b 41 |&directP|aram, kA|
|00002080| 45 49 44 6f 4d 69 6e 69 | 6d 75 6d 2c 20 26 74 68 |EIDoMini|mum, &th|
|00002090| 65 54 6f 6b 65 6e 44 65 | 73 63 29 3b 0d 09 09 09 |eTokenDe|sc);....|
|000020a0| 09 41 45 44 69 73 70 6f | 73 65 44 65 73 63 28 26 |.AEDispo|seDesc(&|
|000020b0| 64 69 72 65 63 74 50 61 | 72 61 6d 29 3b 0d 09 09 |directPa|ram);...|
|000020c0| 09 09 69 66 20 28 65 72 | 72 20 3d 3d 20 6e 6f 45 |..if (er|r == noE|
|000020d0| 72 72 29 0d 09 09 09 09 | 09 74 68 65 54 6f 6b 65 |rr).....|.theToke|
|000020e0| 6e 20 3d 20 4f 62 6a 4d | 6f 64 65 6c 54 6f 6b 65 |n = ObjM|odelToke|
|000020f0| 6e 46 72 6f 6d 44 65 73 | 63 28 26 74 68 65 54 6f |nFromDes|c(&theTo|
|00002100| 6b 65 6e 44 65 73 63 29 | 3b 0d 09 09 09 7d 0d 09 |kenDesc)|;....}..|
|00002110| 09 7d 0d 09 09 69 66 20 | 28 21 74 68 65 54 6f 6b |.}...if |(!theTok|
|00002120| 65 6e 20 26 26 20 64 69 | 72 50 61 72 61 6d 54 79 |en && di|rParamTy|
|00002130| 70 65 20 21 3d 20 74 79 | 70 65 4f 62 6a 65 63 74 |pe != ty|peObject|
|00002140| 53 70 65 63 69 66 69 65 | 72 29 0d 09 09 7b 0d 09 |Specifie|r)...{..|
|00002150| 09 09 70 72 69 6e 74 66 | 28 22 6e 6f 20 64 69 72 |..printf|("no dir|
|00002160| 65 63 74 20 70 61 72 61 | 6d 65 74 65 72 20 72 65 |ect para|meter re|
|00002170| 73 6f 6c 76 65 64 3b 20 | 72 65 73 6f 6c 76 69 6e |solved; |resolvin|
|00002180| 67 20 73 75 62 6a 65 63 | 74 20 61 74 74 72 69 62 |g subjec|t attrib|
|00002190| 75 74 65 5c 6e 22 29 3b | 0d 09 09 09 65 72 72 20 |ute\n");|....err |
|000021a0| 3d 20 41 45 47 65 74 41 | 74 74 72 69 62 75 74 65 |= AEGetA|ttribute|
|000021b0| 44 65 73 63 28 74 68 65 | 45 76 65 6e 74 2c 20 6b |Desc(the|Event, k|
|000021c0| 65 79 53 75 62 6a 65 63 | 74 41 74 74 72 2c 20 0d |eySubjec|tAttr, .|
|000021d0| 09 09 09 09 09 09 09 09 | 09 20 74 79 70 65 57 69 |........|. typeWi|
|000021e0| 6c 64 43 61 72 64 2c 20 | 26 64 69 72 65 63 74 50 |ldCard, |&directP|
|000021f0| 61 72 61 6d 29 3b 0d 09 | 09 09 69 66 20 28 65 72 |aram);..|..if (er|
|00002200| 72 20 3d 3d 20 6e 6f 45 | 72 72 29 0d 09 09 09 7b |r == noE|rr)....{|
|00002210| 0d 09 09 09 09 64 69 72 | 50 61 72 61 6d 54 79 70 |.....dir|ParamTyp|
|00002220| 65 20 3d 20 64 69 72 65 | 63 74 50 61 72 61 6d 2e |e = dire|ctParam.|
|00002230| 64 65 73 63 72 69 70 74 | 6f 72 54 79 70 65 3b 0d |descript|orType;.|
|00002240| 09 09 09 09 65 72 72 20 | 3d 20 41 45 52 65 73 6f |....err |= AEReso|
|00002250| 6c 76 65 28 26 64 69 72 | 65 63 74 50 61 72 61 6d |lve(&dir|ectParam|
|00002260| 2c 20 6b 41 45 49 44 6f | 4d 69 6e 69 6d 75 6d 2c |, kAEIDo|Minimum,|
|00002270| 20 26 74 68 65 54 6f 6b | 65 6e 44 65 73 63 29 3b | &theTok|enDesc);|
|00002280| 0d 09 09 09 09 41 45 44 | 69 73 70 6f 73 65 44 65 |.....AED|isposeDe|
|00002290| 73 63 28 26 64 69 72 65 | 63 74 50 61 72 61 6d 29 |sc(&dire|ctParam)|
|000022a0| 3b 0d 09 09 09 09 69 66 | 20 28 65 72 72 20 3d 3d |;.....if| (err ==|
|000022b0| 20 6e 6f 45 72 72 29 0d | 09 09 09 09 09 74 68 65 | noErr).|.....the|
|000022c0| 54 6f 6b 65 6e 20 3d 20 | 4f 62 6a 4d 6f 64 65 6c |Token = |ObjModel|
|000022d0| 54 6f 6b 65 6e 46 72 6f | 6d 44 65 73 63 28 26 74 |TokenFro|mDesc(&t|
|000022e0| 68 65 54 6f 6b 65 6e 44 | 65 73 63 29 3b 0d 09 09 |heTokenD|esc);...|
|000022f0| 09 7d 0d 09 09 7d 0d 09 | 09 69 66 20 28 65 72 72 |.}...}..|.if (err|
|00002300| 20 3d 3d 20 65 72 72 41 | 45 4e 6f 53 75 63 68 4f | == errA|ENoSuchO|
|00002310| 62 6a 65 63 74 29 09 2f | 2f 20 a5 a5 a5 20 48 49 |bject)./|/ ... HI|
|00002320| 44 45 20 4f 42 4a 45 43 | 54 20 4e 4f 54 20 46 4f |DE OBJEC|T NOT FO|
|00002330| 55 4e 44 20 45 52 52 4f | 52 53 20 a5 a5 a5 0d 09 |UND ERRO|RS .....|
|00002340| 09 7b 09 09 09 09 09 09 | 09 09 2f 2f 20 2e 2e 2e |.{......|..// ...|
|00002350| 20 69 6e 20 65 76 65 6e | 74 20 70 72 65 2d 68 61 | in even|t pre-ha|
|00002360| 6e 64 6c 65 72 20 6f 6e | 6c 79 2e 2e 2e 0d 09 09 |ndler on|ly......|
|00002370| 09 65 72 72 20 3d 20 65 | 72 72 41 45 45 76 65 6e |.err = e|rrAEEven|
|00002380| 74 4e 6f 74 48 61 6e 64 | 6c 65 64 3b 09 2f 2f 20 |tNotHand|led;.// |
|00002390| 28 6c 65 74 20 74 68 65 | 20 72 65 61 6c 20 65 76 |(let the| real ev|
|000023a0| 65 6e 74 20 68 61 6e 64 | 6c 65 72 20 66 69 6e 64 |ent hand|ler find|
|000023b0| 20 6f 62 6a 29 0d 09 09 | 7d 0d 0d 09 09 69 66 20 | obj)...|}....if |
|000023c0| 28 21 74 68 65 54 6f 6b | 65 6e 29 0d 09 09 7b 0d |(!theTok|en)...{.|
|000023d0| 09 09 09 69 66 20 28 64 | 69 72 50 61 72 61 6d 54 |...if (d|irParamT|
|000023e0| 79 70 65 20 21 3d 20 74 | 79 70 65 4f 62 6a 65 63 |ype != t|ypeObjec|
|000023f0| 74 53 70 65 63 69 66 69 | 65 72 29 0d 09 09 09 7b |tSpecifi|er)....{|
|00002400| 0d 09 09 09 09 70 72 69 | 6e 74 66 28 22 6e 6f 20 |.....pri|ntf("no |
|00002410| 73 75 62 6a 65 63 74 20 | 61 74 74 72 69 62 75 74 |subject |attribut|
|00002420| 65 20 72 65 73 6f 6c 76 | 65 64 3b 20 6d 61 6b 69 |e resolv|ed; maki|
|00002430| 6e 67 20 61 70 70 20 74 | 6f 6b 65 6e 5c 6e 22 29 |ng app t|oken\n")|
|00002440| 3b 0d 09 09 09 09 65 72 | 72 20 3d 20 4d 61 6b 65 |;.....er|r = Make|
|00002450| 41 70 70 54 6f 6b 65 6e | 28 28 54 4f 62 6a 4d 6f |AppToken|((TObjMo|
|00002460| 64 65 6c 54 6f 6b 65 6e | 2a 2a 29 26 74 68 65 54 |delToken|**)&theT|
|00002470| 6f 6b 65 6e 29 3b 0d 09 | 09 09 09 6d 61 64 65 41 |oken);..|...madeA|
|00002480| 70 70 54 6f 6b 65 6e 20 | 3d 20 28 65 72 72 20 3d |ppToken |= (err =|
|00002490| 3d 20 6e 6f 45 72 72 29 | 3b 0d 09 09 09 7d 0d 09 |= noErr)|;....}..|
|000024a0| 09 09 65 6c 73 65 0d 09 | 09 09 09 70 72 69 6e 74 |..else..|...print|
|000024b0| 66 28 22 66 61 69 6c 65 | 64 20 74 6f 20 72 65 73 |f("faile|d to res|
|000024c0| 6f 6c 76 65 20 6f 62 6a | 65 63 74 20 73 70 65 63 |olve obj|ect spec|
|000024d0| 69 66 69 65 72 3a 20 6f | 62 6a 65 63 74 20 64 6f |ifier: o|bject do|
|000024e0| 65 73 6e 27 74 20 65 78 | 69 73 74 5c 6e 22 29 3b |esn't ex|ist\n");|
|000024f0| 0d 09 09 7d 0d 09 0d 09 | 09 69 66 20 28 65 72 72 |...}....|.if (err|
|00002500| 20 3d 3d 20 6e 6f 45 72 | 72 20 26 26 20 74 68 65 | == noEr|r && the|
|00002510| 54 6f 6b 65 6e 29 0d 09 | 09 09 65 72 72 20 3d 20 |Token)..|..err = |
|00002520| 67 53 63 72 69 70 74 41 | 64 6d 69 6e 69 73 74 72 |gScriptA|dministr|
|00002530| 61 74 6f 72 2d 3e 47 65 | 74 41 74 74 61 63 68 65 |ator->Ge|tAttache|
|00002540| 64 53 63 72 69 70 74 28 | 74 68 65 54 6f 6b 65 6e |dScript(|theToken|
|00002550| 2d 3e 47 65 74 54 6f 6b | 65 6e 4f 62 6a 28 29 2c |->GetTok|enObj(),|
|00002560| 20 0d 09 09 09 09 09 09 | 09 09 09 09 09 09 09 09 | .......|........|
|00002570| 09 74 68 65 53 63 72 69 | 70 74 61 62 6c 65 4f 62 |.theScri|ptableOb|
|00002580| 6a 2c 0d 09 09 09 09 09 | 09 09 09 09 09 09 09 09 |j,......|........|
|00002590| 09 09 73 61 76 65 64 50 | 61 72 65 6e 74 29 3b 0d |..savedP|arent);.|
|000025a0| 09 09 69 66 20 28 65 72 | 72 20 3d 3d 20 6e 6f 45 |..if (er|r == noE|
|000025b0| 72 72 29 0d 09 09 7b 09 | 2f 2f 20 70 61 73 73 20 |rr)...{.|// pass |
|000025c0| 74 6f 20 73 63 72 69 70 | 74 20 66 6f 72 20 68 61 |to scrip|t for ha|
|000025d0| 6e 64 6c 69 6e 67 0d 09 | 09 09 69 66 20 28 74 68 |ndling..|..if (th|
|000025e0| 65 53 63 72 69 70 74 61 | 62 6c 65 4f 62 6a 29 0d |eScripta|bleObj).|
|000025f0| 09 09 09 09 65 72 72 20 | 3d 20 45 78 65 63 75 74 |....err |= Execut|
|00002600| 65 45 76 65 6e 74 49 6e | 43 6f 6e 74 65 78 74 28 |eEventIn|Context(|
|00002610| 74 68 65 45 76 65 6e 74 | 2c 20 74 68 65 52 65 70 |theEvent|, theRep|
|00002620| 6c 79 2c 20 74 68 65 53 | 63 72 69 70 74 61 62 6c |ly, theS|criptabl|
|00002630| 65 4f 62 6a 29 3b 0d 09 | 09 09 65 6c 73 65 0d 09 |eObj);..|..else..|
|00002640| 09 09 7b 0d 09 09 09 09 | 70 72 69 6e 74 66 28 22 |..{.....|printf("|
|00002650| 2d 3e 47 65 74 41 74 74 | 61 63 68 65 64 53 63 72 |->GetAtt|achedScr|
|00002660| 69 70 74 20 64 69 64 20 | 6e 6f 74 20 72 65 74 75 |ipt did |not retu|
|00002670| 72 6e 20 61 20 73 63 72 | 69 70 74 61 62 6c 65 20 |rn a scr|iptable |
|00002680| 6f 62 6a 65 63 74 5c 6e | 22 29 3b 0d 09 09 09 09 |object\n|");.....|
|00002690| 65 72 72 20 3d 20 65 72 | 72 41 45 45 76 65 6e 74 |err = er|rAEEvent|
|000026a0| 4e 6f 74 48 61 6e 64 6c | 65 64 3b 0d 09 09 09 7d |NotHandl|ed;....}|
|000026b0| 0d 09 09 09 69 66 20 28 | 74 68 65 54 6f 6b 65 6e |....if (|theToken|
|000026c0| 29 0d 09 09 09 09 67 53 | 63 72 69 70 74 41 64 6d |).....gS|criptAdm|
|000026d0| 69 6e 69 73 74 72 61 74 | 6f 72 2d 3e 52 65 6c 65 |inistrat|or->Rele|
|000026e0| 61 73 65 41 74 74 61 63 | 68 65 64 53 63 72 69 70 |aseAttac|hedScrip|
|000026f0| 74 28 74 68 65 54 6f 6b | 65 6e 2d 3e 47 65 74 54 |t(theTok|en->GetT|
|00002700| 6f 6b 65 6e 4f 62 6a 28 | 29 2c 0d 09 09 09 09 09 |okenObj(|),......|
|00002710| 09 09 09 09 09 09 09 09 | 09 09 73 61 76 65 64 50 |........|..savedP|
|00002720| 61 72 65 6e 74 29 3b 0d | 09 09 7d 0d 09 09 2f 2f |arent);.|..}...//|
|00002730| 20 74 68 69 73 20 77 69 | 6c 6c 20 64 69 73 70 6f | this wi|ll dispo|
|00002740| 73 65 20 6f 66 20 74 68 | 65 20 74 6f 6b 65 6e 20 |se of th|e token |
|00002750| 61 73 20 77 65 6c 6c 20 | 61 73 20 74 68 65 20 64 |as well |as the d|
|00002760| 65 73 63 72 69 70 74 6f | 72 2c 20 73 6f 0d 09 09 |escripto|r, so...|
|00002770| 41 45 44 69 73 70 6f 73 | 65 54 6f 6b 65 6e 28 26 |AEDispos|eToken(&|
|00002780| 74 68 65 54 6f 6b 65 6e | 44 65 73 63 29 3b 20 2f |theToken|Desc); /|
|00002790| 2f 20 44 4f 20 4e 4f 54 | 20 43 41 4c 4c 20 75 6e |/ DO NOT| CALL un|
|000027a0| 74 69 6c 20 64 6f 6e 65 | 20 77 69 74 68 20 27 74 |til done| with 't|
|000027b0| 68 65 54 6f 6b 65 6e 27 | 0d 09 09 69 66 20 28 6d |heToken'|...if (m|
|000027c0| 61 64 65 41 70 70 54 6f | 6b 65 6e 29 0d 09 09 09 |adeAppTo|ken)....|
|000027d0| 64 65 6c 65 74 65 20 74 | 68 65 54 6f 6b 65 6e 3b |delete t|heToken;|
|000027e0| 20 2f 2f 20 74 68 69 73 | 20 77 69 6c 6c 20 6f 6e | // this| will on|
|000027f0| 6c 79 20 62 65 20 65 78 | 65 63 75 74 65 64 20 69 |ly be ex|ecuted i|
|00002800| 66 20 74 6f 6b 65 6e 20 | 77 61 73 20 6d 61 64 65 |f token |was made|
|00002810| 20 69 6e 20 74 68 69 73 | 20 66 75 6e 63 74 69 6f | in this| functio|
|00002820| 6e 0d 09 7d 0d 09 0d 09 | 69 66 20 28 65 72 72 20 |n..}....|if (err |
|00002830| 3d 3d 20 65 72 72 41 45 | 45 76 65 6e 74 4e 6f 74 |== errAE|EventNot|
|00002840| 48 61 6e 64 6c 65 64 29 | 0d 09 09 70 72 69 6e 74 |Handled)|...print|
|00002850| 66 28 22 53 74 64 41 45 | 76 74 50 72 65 48 61 6e |f("StdAE|vtPreHan|
|00002860| 64 6c 65 72 3a 20 41 70 | 70 6c 65 20 45 76 65 6e |dler: Ap|ple Even|
|00002870| 74 20 6e 6f 74 20 68 61 | 6e 64 6c 65 64 20 69 6e |t not ha|ndled in|
|00002880| 20 70 72 65 2d 68 61 6e | 64 6c 65 72 5c 6e 22 29 | pre-han|dler\n")|
|00002890| 3b 0d 09 65 6c 73 65 20 | 69 66 20 28 65 72 72 29 |;..else |if (err)|
|000028a0| 0d 09 09 70 72 69 6e 74 | 66 28 22 53 74 64 41 45 |...print|f("StdAE|
|000028b0| 76 74 50 72 65 48 61 6e | 64 6c 65 72 3a 20 65 72 |vtPreHan|dler: er|
|000028c0| 72 20 3d 20 25 64 5c 6e | 22 2c 20 65 72 72 29 3b |r = %d\n|", err);|
|000028d0| 0d 09 0d 09 72 65 74 75 | 72 6e 20 28 4f 53 45 72 |....retu|rn (OSEr|
|000028e0| 72 29 65 72 72 3b 0d 7d | 0d 0d 0d 73 74 61 74 69 |r)err;.}|...stati|
|000028f0| 63 20 70 61 73 63 61 6c | 20 4f 53 45 72 72 20 52 |c pascal| OSErr R|
|00002900| 71 64 41 45 76 74 48 61 | 6e 64 6c 65 72 20 28 41 |qdAEvtHa|ndler (A|
|00002910| 70 70 6c 65 45 76 65 6e | 74 20 2a 74 68 65 45 76 |ppleEven|t *theEv|
|00002920| 65 6e 74 2c 20 0d 09 09 | 09 09 09 09 09 09 09 09 |ent, ...|........|
|00002930| 41 70 70 6c 65 45 76 65 | 6e 74 20 2a 74 68 65 52 |AppleEve|nt *theR|
|00002940| 65 70 6c 79 2c 20 0d 09 | 09 09 09 09 09 09 09 09 |eply, ..|........|
|00002950| 09 6c 6f 6e 67 20 74 68 | 65 52 65 66 43 6f 6e 29 |.long th|eRefCon)|
|00002960| 0d 7b 0d 09 4f 53 45 72 | 72 09 09 09 65 72 72 20 |.{..OSEr|r...err |
|00002970| 3d 20 65 72 72 41 45 45 | 76 65 6e 74 4e 6f 74 48 |= errAEE|ventNotH|
|00002980| 61 6e 64 6c 65 64 3b 0d | 09 41 45 45 76 65 6e 74 |andled;.|.AEEvent|
|00002990| 43 6c 61 73 73 20 09 74 | 68 65 45 76 74 43 6c 61 |Class .t|heEvtCla|
|000029a0| 73 73 3b 0d 09 41 45 45 | 76 65 6e 74 49 44 20 09 |ss;..AEE|ventID .|
|000029b0| 09 74 68 65 45 76 74 49 | 44 3b 0d 09 44 65 73 63 |.theEvtI|D;..Desc|
|000029c0| 54 79 70 65 09 09 74 68 | 65 54 79 70 65 3b 0d 09 |Type..th|eType;..|
|000029d0| 53 69 7a 65 09 09 09 74 | 68 65 53 69 7a 65 3b 0d |Size...t|heSize;.|
|000029e0| 0d 09 2f 2f 20 45 78 74 | 72 61 63 74 20 74 68 65 |..// Ext|ract the|
|000029f0| 20 63 6c 61 73 73 20 61 | 6e 64 20 49 44 20 6f 66 | class a|nd ID of|
|00002a00| 20 74 68 65 20 65 76 65 | 6e 74 20 66 72 6f 6d 20 | the eve|nt from |
|00002a10| 74 68 65 20 41 70 70 6c | 65 45 76 65 6e 74 0d 09 |the Appl|eEvent..|
|00002a20| 41 45 47 65 74 41 74 74 | 72 69 62 75 74 65 50 74 |AEGetAtt|ributePt|
|00002a30| 72 28 74 68 65 45 76 65 | 6e 74 2c 20 6b 65 79 45 |r(theEve|nt, keyE|
|00002a40| 76 65 6e 74 43 6c 61 73 | 73 41 74 74 72 2c 20 74 |ventClas|sAttr, t|
|00002a50| 79 70 65 54 79 70 65 2c | 20 26 74 68 65 54 79 70 |ypeType,| &theTyp|
|00002a60| 65 2c 20 28 50 74 72 29 | 20 26 74 68 65 45 76 74 |e, (Ptr)| &theEvt|
|00002a70| 43 6c 61 73 73 2c 20 73 | 69 7a 65 6f 66 28 74 68 |Class, s|izeof(th|
|00002a80| 65 45 76 74 43 6c 61 73 | 73 29 2c 20 26 74 68 65 |eEvtClas|s), &the|
|00002a90| 53 69 7a 65 29 3b 20 0d | 09 41 45 47 65 74 41 74 |Size); .|.AEGetAt|
|00002aa0| 74 72 69 62 75 74 65 50 | 74 72 28 74 68 65 45 76 |tributeP|tr(theEv|
|00002ab0| 65 6e 74 2c 20 6b 65 79 | 45 76 65 6e 74 49 44 41 |ent, key|EventIDA|
|00002ac0| 74 74 72 2c 20 74 79 70 | 65 54 79 70 65 2c 20 26 |ttr, typ|eType, &|
|00002ad0| 74 68 65 54 79 70 65 2c | 20 28 50 74 72 29 20 26 |theType,| (Ptr) &|
|00002ae0| 74 68 65 45 76 74 49 44 | 2c 20 73 69 7a 65 6f 66 |theEvtID|, sizeof|
|00002af0| 28 74 68 65 45 76 74 49 | 44 29 2c 20 26 74 68 65 |(theEvtI|D), &the|
|00002b00| 53 69 7a 65 29 3b 20 0d | 0d 09 70 72 69 6e 74 66 |Size); .|..printf|
|00002b10| 28 22 a5 52 71 64 41 45 | 76 74 48 61 6e 64 6c 65 |(".RqdAE|vtHandle|
|00002b20| 72 3a 20 63 6c 61 73 73 | 3d 25 2e 34 73 2c 20 69 |r: class|=%.4s, i|
|00002b30| 64 3d 25 2e 34 73 5c 6e | 22 2c 20 26 74 68 65 45 |d=%.4s\n|", &theE|
|00002b40| 76 74 43 6c 61 73 73 2c | 20 26 74 68 65 45 76 74 |vtClass,| &theEvt|
|00002b50| 49 44 29 3b 0d 0d 09 69 | 66 20 28 74 68 65 45 76 |ID);...i|f (theEv|
|00002b60| 74 43 6c 61 73 73 20 3d | 3d 20 6b 43 6f 72 65 45 |tClass =|= kCoreE|
|00002b70| 76 65 6e 74 43 6c 61 73 | 73 29 0d 09 7b 0d 09 09 |ventClas|s)..{...|
|00002b80| 69 66 20 28 74 68 65 45 | 76 74 49 44 20 3d 3d 20 |if (theE|vtID == |
|00002b90| 6b 41 45 4f 70 65 6e 41 | 70 70 6c 69 63 61 74 69 |kAEOpenA|pplicati|
|00002ba0| 6f 6e 29 0d 09 09 7b 0d | 09 09 09 69 66 20 28 69 |on)...{.|...if (i|
|00002bb0| 73 4b 65 79 44 6f 77 6e | 28 63 74 72 6c 4b 65 79 |sKeyDown|(ctrlKey|
|00002bc0| 43 6f 64 65 29 20 26 26 | 20 69 73 4b 65 79 44 6f |Code) &&| isKeyDo|
|00002bd0| 77 6e 28 63 6d 64 4b 65 | 79 43 6f 64 65 29 29 0d |wn(cmdKe|yCode)).|
|00002be0| 09 09 09 09 3b 0d 09 09 | 09 65 6c 73 65 0d 09 09 |....;...|.else...|
|00002bf0| 09 7b 0d 09 09 09 09 69 | 66 20 28 67 53 63 72 69 |.{.....i|f (gScri|
|00002c00| 70 74 41 64 6d 69 6e 69 | 73 74 72 61 74 6f 72 29 |ptAdmini|strator)|
|00002c10| 0d 09 09 09 09 09 67 53 | 63 72 69 70 74 41 64 6d |......gS|criptAdm|
|00002c20| 69 6e 69 73 74 72 61 74 | 6f 72 2d 3e 52 75 6e 53 |inistrat|or->RunS|
|00002c30| 74 61 72 74 75 70 53 63 | 72 69 70 74 28 29 3b 0d |tartupSc|ript();.|
|00002c40| 09 09 09 09 65 72 72 20 | 3d 20 30 3b 0d 09 09 09 |....err |= 0;....|
|00002c50| 7d 0d 09 09 7d 0d 09 09 | 65 6c 73 65 20 69 66 20 |}...}...|else if |
|00002c60| 28 74 68 65 45 76 74 49 | 44 20 3d 3d 20 6b 41 45 |(theEvtI|D == kAE|
|00002c70| 51 75 69 74 41 70 70 6c | 69 63 61 74 69 6f 6e 29 |QuitAppl|ication)|
|00002c80| 0d 09 09 7b 0d 09 09 09 | 65 72 72 20 3d 20 30 3b |...{....|err = 0;|
|00002c90| 0d 09 09 09 67 53 69 6d | 70 6c 69 46 61 63 65 32 |....gSim|pliFace2|
|00002ca0| 2d 3e 54 65 72 6d 69 6e | 61 74 65 28 29 3b 09 2f |->Termin|ate();./|
|00002cb0| 2f 20 71 75 69 74 20 61 | 66 74 65 72 20 6e 65 78 |/ quit a|fter nex|
|00002cc0| 74 20 74 69 6d 65 20 61 | 72 6f 75 6e 64 20 65 76 |t time a|round ev|
|00002cd0| 65 6e 74 20 6c 6f 6f 70 | 0d 09 09 7d 0d 09 7d 0d |ent loop|...}..}.|
|00002ce0| 09 0d 09 70 72 69 6e 74 | 66 28 22 52 71 64 41 45 |...print|f("RqdAE|
|00002cf0| 76 74 48 61 6e 64 6c 65 | 72 3a 20 65 72 72 20 3d |vtHandle|r: err =|
|00002d00| 20 25 64 5c 6e 22 2c 20 | 65 72 72 29 3b 0d 0d 09 | %d\n", |err);...|
|00002d10| 72 65 74 75 72 6e 09 65 | 72 72 3b 0d 7d 0d 0d 0d |return.e|rr;.}...|
|00002d20| 73 74 61 74 69 63 20 70 | 61 73 63 61 6c 20 4f 53 |static p|ascal OS|
|00002d30| 45 72 72 20 44 6f 53 63 | 72 69 70 74 41 45 76 74 |Err DoSc|riptAEvt|
|00002d40| 48 61 6e 64 6c 65 72 20 | 28 41 70 70 6c 65 45 76 |Handler |(AppleEv|
|00002d50| 65 6e 74 20 2a 74 68 65 | 45 76 65 6e 74 2c 20 0d |ent *the|Event, .|
|00002d60| 09 09 09 09 09 09 09 09 | 09 09 41 70 70 6c 65 45 |........|..AppleE|
|00002d70| 76 65 6e 74 20 2a 74 68 | 65 52 65 70 6c 79 2c 20 |vent *th|eReply, |
|00002d80| 0d 09 09 09 09 09 09 09 | 09 09 09 6c 6f 6e 67 20 |........|...long |
|00002d90| 74 68 65 52 65 66 43 6f | 6e 29 0d 7b 0d 09 4f 53 |theRefCo|n).{..OS|
|00002da0| 41 45 72 72 6f 72 09 09 | 65 72 72 20 3d 20 65 72 |AError..|err = er|
|00002db0| 72 41 45 45 76 65 6e 74 | 4e 6f 74 48 61 6e 64 6c |rAEEvent|NotHandl|
|00002dc0| 65 64 3b 0d 09 41 45 45 | 76 65 6e 74 43 6c 61 73 |ed;..AEE|ventClas|
|00002dd0| 73 20 09 74 68 65 45 76 | 74 43 6c 61 73 73 3b 0d |s .theEv|tClass;.|
|00002de0| 09 41 45 45 76 65 6e 74 | 49 44 20 09 09 74 68 65 |.AEEvent|ID ..the|
|00002df0| 45 76 74 49 44 3b 0d 09 | 44 65 73 63 54 79 70 65 |EvtID;..|DescType|
|00002e00| 09 09 74 68 65 54 79 70 | 65 3b 0d 09 53 69 7a 65 |..theTyp|e;..Size|
|00002e10| 09 09 09 74 68 65 53 69 | 7a 65 3b 0d 0d 09 2f 2f |...theSi|ze;...//|
|00002e20| 20 45 78 74 72 61 63 74 | 20 74 68 65 20 63 6c 61 | Extract| the cla|
|00002e30| 73 73 20 61 6e 64 20 49 | 44 20 6f 66 20 74 68 65 |ss and I|D of the|
|00002e40| 20 65 76 65 6e 74 20 66 | 72 6f 6d 20 74 68 65 20 | event f|rom the |
|00002e50| 41 70 70 6c 65 45 76 65 | 6e 74 0d 09 41 45 47 65 |AppleEve|nt..AEGe|
|00002e60| 74 41 74 74 72 69 62 75 | 74 65 50 74 72 28 74 68 |tAttribu|tePtr(th|
|00002e70| 65 45 76 65 6e 74 2c 20 | 6b 65 79 45 76 65 6e 74 |eEvent, |keyEvent|
|00002e80| 43 6c 61 73 73 41 74 74 | 72 2c 20 74 79 70 65 54 |ClassAtt|r, typeT|
|00002e90| 79 70 65 2c 20 26 74 68 | 65 54 79 70 65 2c 20 28 |ype, &th|eType, (|
|00002ea0| 50 74 72 29 20 26 74 68 | 65 45 76 74 43 6c 61 73 |Ptr) &th|eEvtClas|
|00002eb0| 73 2c 20 73 69 7a 65 6f | 66 28 74 68 65 45 76 74 |s, sizeo|f(theEvt|
|00002ec0| 43 6c 61 73 73 29 2c 20 | 26 74 68 65 53 69 7a 65 |Class), |&theSize|
|00002ed0| 29 3b 20 0d 09 41 45 47 | 65 74 41 74 74 72 69 62 |); ..AEG|etAttrib|
|00002ee0| 75 74 65 50 74 72 28 74 | 68 65 45 76 65 6e 74 2c |utePtr(t|heEvent,|
|00002ef0| 20 6b 65 79 45 76 65 6e | 74 49 44 41 74 74 72 2c | keyEven|tIDAttr,|
|00002f00| 20 74 79 70 65 54 79 70 | 65 2c 20 26 74 68 65 54 | typeTyp|e, &theT|
|00002f10| 79 70 65 2c 20 28 50 74 | 72 29 20 26 74 68 65 45 |ype, (Pt|r) &theE|
|00002f20| 76 74 49 44 2c 20 73 69 | 7a 65 6f 66 28 74 68 65 |vtID, si|zeof(the|
|00002f30| 45 76 74 49 44 29 2c 20 | 26 74 68 65 53 69 7a 65 |EvtID), |&theSize|
|00002f40| 29 3b 20 0d 0d 09 70 72 | 69 6e 74 66 28 22 a5 44 |); ...pr|intf(".D|
|00002f50| 6f 53 63 72 69 70 74 41 | 45 76 74 48 61 6e 64 6c |oScriptA|EvtHandl|
|00002f60| 65 72 3a 20 63 6c 61 73 | 73 3d 25 2e 34 73 2c 20 |er: clas|s=%.4s, |
|00002f70| 69 64 3d 25 2e 34 73 5c | 6e 22 2c 20 26 74 68 65 |id=%.4s\|n", &the|
|00002f80| 45 76 74 43 6c 61 73 73 | 2c 20 26 74 68 65 45 76 |EvtClass|, &theEv|
|00002f90| 74 49 44 29 3b 0d 0d 09 | 69 66 20 28 67 53 63 72 |tID);...|if (gScr|
|00002fa0| 69 70 74 41 64 6d 69 6e | 69 73 74 72 61 74 6f 72 |iptAdmin|istrator|
|00002fb0| 29 0d 09 7b 0d 09 09 41 | 45 44 65 73 63 09 09 09 |)..{...A|EDesc...|
|00002fc0| 73 6f 75 72 63 65 44 65 | 73 63 2c 20 72 65 73 75 |sourceDe|sc, resu|
|00002fd0| 6c 74 44 65 73 63 3b 0d | 0d 09 09 49 6e 69 74 41 |ltDesc;.|...InitA|
|00002fe0| 45 44 65 73 63 73 28 26 | 73 6f 75 72 63 65 44 65 |EDescs(&|sourceDe|
|00002ff0| 73 63 2c 20 26 72 65 73 | 75 6c 74 44 65 73 63 2c |sc, &res|ultDesc,|
|00003000| 20 6b 45 6e 64 4f 66 4c | 69 73 74 29 3b 0d 09 09 | kEndOfL|ist);...|
|00003010| 0d 09 09 65 72 72 20 3d | 20 41 45 47 65 74 50 61 |...err =| AEGetPa|
|00003020| 72 61 6d 44 65 73 63 28 | 74 68 65 45 76 65 6e 74 |ramDesc(|theEvent|
|00003030| 2c 20 6b 65 79 44 69 72 | 65 63 74 4f 62 6a 65 63 |, keyDir|ectObjec|
|00003040| 74 2c 20 74 79 70 65 43 | 68 61 72 2c 20 26 73 6f |t, typeC|har, &so|
|00003050| 75 72 63 65 44 65 73 63 | 29 3b 0d 09 09 69 66 20 |urceDesc|);...if |
|00003060| 28 65 72 72 20 3d 3d 20 | 6e 6f 45 72 72 29 0d 09 |(err == |noErr)..|
|00003070| 09 09 65 72 72 20 3d 20 | 67 53 63 72 69 70 74 41 |..err = |gScriptA|
|00003080| 64 6d 69 6e 69 73 74 72 | 61 74 6f 72 2d 3e 44 6f |dministr|ator->Do|
|00003090| 53 63 72 69 70 74 28 26 | 73 6f 75 72 63 65 44 65 |Script(&|sourceDe|
|000030a0| 73 63 2c 20 26 72 65 73 | 75 6c 74 44 65 73 63 29 |sc, &res|ultDesc)|
|000030b0| 3b 0d 09 09 69 66 20 28 | 65 72 72 20 3d 3d 20 6e |;...if (|err == n|
|000030c0| 6f 45 72 72 29 0d 09 09 | 09 65 72 72 20 3d 20 41 |oErr)...|.err = A|
|000030d0| 45 50 75 74 50 61 72 61 | 6d 44 65 73 63 28 74 68 |EPutPara|mDesc(th|
|000030e0| 65 52 65 70 6c 79 2c 20 | 6b 65 79 44 69 72 65 63 |eReply, |keyDirec|
|000030f0| 74 4f 62 6a 65 63 74 2c | 20 26 72 65 73 75 6c 74 |tObject,| &result|
|00003100| 44 65 73 63 29 3b 0d 0d | 09 09 44 69 73 70 6f 73 |Desc);..|..Dispos|
|00003110| 65 41 45 44 65 73 63 73 | 28 26 73 6f 75 72 63 65 |eAEDescs|(&source|
|00003120| 44 65 73 63 2c 20 26 72 | 65 73 75 6c 74 44 65 73 |Desc, &r|esultDes|
|00003130| 63 2c 20 6b 45 6e 64 4f | 66 4c 69 73 74 29 3b 0d |c, kEndO|fList);.|
|00003140| 09 7d 0d 09 0d 09 70 72 | 69 6e 74 66 28 22 44 6f |.}....pr|intf("Do|
|00003150| 53 63 72 69 70 74 41 45 | 76 74 48 61 6e 64 6c 65 |ScriptAE|vtHandle|
|00003160| 72 3a 20 65 72 72 20 3d | 20 25 6c 64 5c 6e 22 2c |r: err =| %ld\n",|
|00003170| 20 65 72 72 29 3b 0d 0d | 09 72 65 74 75 72 6e 09 | err);..|.return.|
|00003180| 65 72 72 3b 0d 7d 0d 0d | 0d 73 74 61 74 69 63 20 |err;.}..|.static |
|00003190| 70 61 73 63 61 6c 20 4f | 53 45 72 72 20 53 74 64 |pascal O|SErr Std|
|000031a0| 41 45 76 74 48 61 6e 64 | 6c 65 72 09 20 20 20 28 |AEvtHand|ler. (|
|000031b0| 41 70 70 6c 65 45 76 65 | 6e 74 20 2a 74 68 65 45 |AppleEve|nt *theE|
|000031c0| 76 65 6e 74 2c 20 0d 09 | 09 09 09 09 09 09 09 09 |vent, ..|........|
|000031d0| 09 41 70 70 6c 65 45 76 | 65 6e 74 20 2a 74 68 65 |.AppleEv|ent *the|
|000031e0| 52 65 70 6c 79 2c 20 0d | 09 09 09 09 09 09 09 09 |Reply, .|........|
|000031f0| 09 09 6c 6f 6e 67 20 74 | 68 65 52 65 66 43 6f 6e |..long t|heRefCon|
|00003200| 29 0d 7b 0d 09 4f 53 41 | 45 72 72 6f 72 20 09 09 |).{..OSA|Error ..|
|00003210| 09 65 72 72 20 3d 20 65 | 72 72 41 45 45 76 65 6e |.err = e|rrAEEven|
|00003220| 74 4e 6f 74 48 61 6e 64 | 6c 65 64 3b 0d 09 41 45 |tNotHand|led;..AE|
|00003230| 45 76 65 6e 74 43 6c 61 | 73 73 20 09 09 74 68 65 |EventCla|ss ..the|
|00003240| 45 76 74 43 6c 61 73 73 | 3b 0d 09 41 45 45 76 65 |EvtClass|;..AEEve|
|00003250| 6e 74 49 44 20 09 09 09 | 74 68 65 45 76 74 49 44 |ntID ...|theEvtID|
|00003260| 3b 0d 09 44 65 73 63 54 | 79 70 65 09 09 09 74 68 |;..DescT|ype...th|
|00003270| 65 54 79 70 65 3b 0d 09 | 53 69 7a 65 09 09 09 09 |eType;..|Size....|
|00003280| 74 68 65 53 69 7a 65 3b | 0d 09 41 45 44 65 73 63 |theSize;|..AEDesc|
|00003290| 09 09 09 09 64 69 72 65 | 63 74 50 61 72 61 6d 2c |....dire|ctParam,|
|000032a0| 20 74 68 65 54 6f 6b 65 | 6e 44 65 73 63 3b 0d 09 | theToke|nDesc;..|
|000032b0| 54 4f 62 6a 4d 6f 64 65 | 6c 54 6f 6b 65 6e 20 09 |TObjMode|lToken .|
|000032c0| 09 2a 74 68 65 54 6f 6b | 65 6e 20 3d 20 6e 69 6c |.*theTok|en = nil|
|000032d0| 3b 0d 09 42 6f 6f 6c 65 | 61 6e 09 09 09 09 6d 61 |;..Boole|an....ma|
|000032e0| 64 65 41 70 70 54 6f 6b | 65 6e 20 3d 20 66 61 6c |deAppTok|en = fal|
|000032f0| 73 65 3b 0d 09 0d 09 74 | 68 65 54 6f 6b 65 6e 44 |se;....t|heTokenD|
|00003300| 65 73 63 2e 64 65 73 63 | 72 69 70 74 6f 72 54 79 |esc.desc|riptorTy|
|00003310| 70 65 20 3d 20 74 79 70 | 65 4e 75 6c 6c 3b 0d 09 |pe = typ|eNull;..|
|00003320| 74 68 65 54 6f 6b 65 6e | 44 65 73 63 2e 64 61 74 |theToken|Desc.dat|
|00003330| 61 48 61 6e 64 6c 65 20 | 3d 20 6e 69 6c 3b 0d 0d |aHandle |= nil;..|
|00003340| 09 2f 2f 20 45 78 74 72 | 61 63 74 20 74 68 65 20 |.// Extr|act the |
|00003350| 63 6c 61 73 73 20 61 6e | 64 20 49 44 20 6f 66 20 |class an|d ID of |
|00003360| 74 68 65 20 65 76 65 6e | 74 20 66 72 6f 6d 20 74 |the even|t from t|
|00003370| 68 65 20 41 70 70 6c 65 | 45 76 65 6e 74 0d 09 41 |he Apple|Event..A|
|00003380| 45 47 65 74 41 74 74 72 | 69 62 75 74 65 50 74 72 |EGetAttr|ibutePtr|
|00003390| 28 74 68 65 45 76 65 6e | 74 2c 20 6b 65 79 45 76 |(theEven|t, keyEv|
|000033a0| 65 6e 74 43 6c 61 73 73 | 41 74 74 72 2c 20 74 79 |entClass|Attr, ty|
|000033b0| 70 65 54 79 70 65 2c 20 | 26 74 68 65 54 79 70 65 |peType, |&theType|
|000033c0| 2c 20 28 50 74 72 29 20 | 26 74 68 65 45 76 74 43 |, (Ptr) |&theEvtC|
|000033d0| 6c 61 73 73 2c 20 73 69 | 7a 65 6f 66 28 74 68 65 |lass, si|zeof(the|
|000033e0| 45 76 74 43 6c 61 73 73 | 29 2c 20 26 74 68 65 53 |EvtClass|), &theS|
|000033f0| 69 7a 65 29 3b 20 0d 09 | 41 45 47 65 74 41 74 74 |ize); ..|AEGetAtt|
|00003400| 72 69 62 75 74 65 50 74 | 72 28 74 68 65 45 76 65 |ributePt|r(theEve|
|00003410| 6e 74 2c 20 6b 65 79 45 | 76 65 6e 74 49 44 41 74 |nt, keyE|ventIDAt|
|00003420| 74 72 2c 20 74 79 70 65 | 54 79 70 65 2c 20 26 74 |tr, type|Type, &t|
|00003430| 68 65 54 79 70 65 2c 20 | 28 50 74 72 29 20 26 74 |heType, |(Ptr) &t|
|00003440| 68 65 45 76 74 49 44 2c | 20 73 69 7a 65 6f 66 28 |heEvtID,| sizeof(|
|00003450| 74 68 65 45 76 74 49 44 | 29 2c 20 26 74 68 65 53 |theEvtID|), &theS|
|00003460| 69 7a 65 29 3b 20 0d 0d | 09 70 72 69 6e 74 66 28 |ize); ..|.printf(|
|00003470| 22 a5 53 74 64 41 45 76 | 74 48 61 6e 64 6c 65 72 |".StdAEv|tHandler|
|00003480| 3a 20 63 6c 61 73 73 3d | 25 2e 34 73 2c 20 69 64 |: class=|%.4s, id|
|00003490| 3d 25 2e 34 73 5c 6e 22 | 2c 20 26 74 68 65 45 76 |=%.4s\n"|, &theEv|
|000034a0| 74 43 6c 61 73 73 2c 20 | 26 74 68 65 45 76 74 49 |tClass, |&theEvtI|
|000034b0| 44 29 3b 0d 0d 09 69 66 | 20 28 74 68 65 45 76 74 |D);...if| (theEvt|
|000034c0| 43 6c 61 73 73 20 3d 3d | 20 6b 41 53 41 70 70 6c |Class ==| kASAppl|
|000034d0| 65 53 63 72 69 70 74 53 | 75 69 74 65 20 26 26 20 |eScriptS|uite && |
|000034e0| 74 68 65 45 76 74 49 44 | 20 3d 3d 20 6b 41 45 43 |theEvtID| == kAEC|
|000034f0| 72 65 61 74 65 45 6c 65 | 6d 65 6e 74 29 0d 09 09 |reateEle|ment)...|
|00003500| 72 65 74 75 72 6e 20 47 | 65 74 41 45 54 45 41 45 |return G|etAETEAE|
|00003510| 76 74 48 61 6e 64 6c 65 | 72 28 74 68 65 45 76 65 |vtHandle|r(theEve|
|00003520| 6e 74 2c 20 74 68 65 52 | 65 70 6c 79 2c 20 74 68 |nt, theR|eply, th|
|00003530| 65 52 65 66 43 6f 6e 29 | 3b 0d 09 65 6c 73 65 20 |eRefCon)|;..else |
|00003540| 69 66 20 28 74 68 65 45 | 76 74 43 6c 61 73 73 20 |if (theE|vtClass |
|00003550| 3d 3d 20 6b 41 45 4d 69 | 73 63 53 74 61 6e 64 61 |== kAEMi|scStanda|
|00003560| 72 64 73 20 26 26 20 74 | 68 65 45 76 74 49 44 20 |rds && t|heEvtID |
|00003570| 3d 3d 20 6b 41 45 44 6f | 53 63 72 69 70 74 29 0d |== kAEDo|Script).|
|00003580| 09 09 72 65 74 75 72 6e | 20 44 6f 53 63 72 69 70 |..return| DoScrip|
|00003590| 74 41 45 76 74 48 61 6e | 64 6c 65 72 28 74 68 65 |tAEvtHan|dler(the|
|000035a0| 45 76 65 6e 74 2c 20 74 | 68 65 52 65 70 6c 79 2c |Event, t|heReply,|
|000035b0| 20 74 68 65 52 65 66 43 | 6f 6e 29 3b 0d 09 65 6c | theRefC|on);..el|
|000035c0| 73 65 20 69 66 20 28 74 | 68 65 45 76 74 43 6c 61 |se if (t|heEvtCla|
|000035d0| 73 73 20 3d 3d 20 6b 43 | 6f 72 65 45 76 65 6e 74 |ss == kC|oreEvent|
|000035e0| 43 6c 61 73 73 20 26 26 | 20 74 68 65 45 76 74 49 |Class &&| theEvtI|
|000035f0| 44 20 21 3d 20 6b 41 45 | 4f 70 65 6e 29 0d 09 09 |D != kAE|Open)...|
|00003600| 72 65 74 75 72 6e 20 52 | 71 64 41 45 76 74 48 61 |return R|qdAEvtHa|
|00003610| 6e 64 6c 65 72 28 74 68 | 65 45 76 65 6e 74 2c 20 |ndler(th|eEvent, |
|00003620| 74 68 65 52 65 70 6c 79 | 2c 20 74 68 65 52 65 66 |theReply|, theRef|
|00003630| 43 6f 6e 29 3b 0d 09 65 | 6c 73 65 20 69 66 20 28 |Con);..e|lse if (|
|00003640| 74 68 65 45 76 74 43 6c | 61 73 73 20 3d 3d 20 6b |theEvtCl|ass == k|
|00003650| 41 45 43 6f 72 65 53 75 | 69 74 65 20 26 26 20 74 |AECoreSu|ite && t|
|00003660| 68 65 45 76 74 49 44 20 | 3d 3d 20 6b 41 45 43 72 |heEvtID |== kAECr|
|00003670| 65 61 74 65 45 6c 65 6d | 65 6e 74 29 0d 09 7b 0d |eateElem|ent)..{.|
|00003680| 09 09 65 72 72 20 3d 20 | 4d 61 6b 65 41 70 70 54 |..err = |MakeAppT|
|00003690| 6f 6b 65 6e 28 26 74 68 | 65 54 6f 6b 65 6e 29 3b |oken(&th|eToken);|
|000036a0| 0d 09 09 6d 61 64 65 41 | 70 70 54 6f 6b 65 6e 20 |...madeA|ppToken |
|000036b0| 3d 20 28 65 72 72 20 3d | 3d 20 6e 6f 45 72 72 29 |= (err =|= noErr)|
|000036c0| 3b 0d 09 7d 0d 09 65 6c | 73 65 0d 09 7b 0d 09 09 |;..}..el|se..{...|
|000036d0| 65 72 72 20 3d 20 41 45 | 47 65 74 50 61 72 61 6d |err = AE|GetParam|
|000036e0| 44 65 73 63 28 74 68 65 | 45 76 65 6e 74 2c 20 6b |Desc(the|Event, k|
|000036f0| 65 79 44 69 72 65 63 74 | 4f 62 6a 65 63 74 2c 20 |eyDirect|Object, |
|00003700| 74 79 70 65 57 69 6c 64 | 43 61 72 64 2c 20 26 64 |typeWild|Card, &d|
|00003710| 69 72 65 63 74 50 61 72 | 61 6d 29 3b 0d 09 09 69 |irectPar|am);...i|
|00003720| 66 20 28 65 72 72 20 3d | 3d 20 6e 6f 45 72 72 29 |f (err =|= noErr)|
|00003730| 0d 09 09 7b 0d 09 09 09 | 69 66 20 28 74 68 65 45 |...{....|if (theE|
|00003740| 76 74 43 6c 61 73 73 20 | 3d 3d 20 6b 43 6f 72 65 |vtClass |== kCore|
|00003750| 45 76 65 6e 74 43 6c 61 | 73 73 20 0d 09 09 09 09 |EventCla|ss .....|
|00003760| 20 26 26 20 74 68 65 45 | 76 74 49 44 20 3d 3d 20 | && theE|vtID == |
|00003770| 6b 41 45 4f 70 65 6e 44 | 6f 63 75 6d 65 6e 74 73 |kAEOpenD|ocuments|
|00003780| 0d 09 09 09 09 20 26 26 | 20 28 64 69 72 65 63 74 |..... &&| (direct|
|00003790| 50 61 72 61 6d 2e 64 65 | 73 63 72 69 70 74 6f 72 |Param.de|scriptor|
|000037a0| 54 79 70 65 20 3d 3d 20 | 74 79 70 65 41 45 4c 69 |Type == |typeAELi|
|000037b0| 73 74 29 29 0d 09 09 09 | 7b 0d 09 09 09 09 2f 2f |st))....|{.....//|
|000037c0| 20 6f 70 65 6e 20 64 6f | 63 75 6d 65 6e 74 73 20 | open do|cuments |
|000037d0| 68 65 72 65 0d 09 09 09 | 09 65 72 72 20 3d 20 65 |here....|.err = e|
|000037e0| 72 72 41 45 45 76 65 6e | 74 4e 6f 74 48 61 6e 64 |rrAEEven|tNotHand|
|000037f0| 6c 65 64 3b 0d 09 09 09 | 7d 0d 09 09 09 65 6c 73 |led;....|}....els|
|00003800| 65 20 0d 09 09 09 7b 0d | 09 09 09 09 65 72 72 20 |e ....{.|....err |
|00003810| 3d 20 41 45 52 65 73 6f | 6c 76 65 28 26 64 69 72 |= AEReso|lve(&dir|
|00003820| 65 63 74 50 61 72 61 6d | 2c 20 6b 41 45 49 44 6f |ectParam|, kAEIDo|
|00003830| 4d 69 6e 69 6d 75 6d 2c | 20 26 74 68 65 54 6f 6b |Minimum,| &theTok|
|00003840| 65 6e 44 65 73 63 29 3b | 0d 09 09 0d 09 09 09 09 |enDesc);|........|
|00003850| 69 66 20 28 65 72 72 20 | 3d 3d 20 6e 6f 45 72 72 |if (err |== noErr|
|00003860| 29 0d 09 09 09 09 09 74 | 68 65 54 6f 6b 65 6e 20 |)......t|heToken |
|00003870| 3d 20 28 54 4f 62 6a 4d | 6f 64 65 6c 54 6f 6b 65 |= (TObjM|odelToke|
|00003880| 6e 2a 29 4f 62 6a 4d 6f | 64 65 6c 54 6f 6b 65 6e |n*)ObjMo|delToken|
|00003890| 46 72 6f 6d 44 65 73 63 | 28 26 74 68 65 54 6f 6b |FromDesc|(&theTok|
|000038a0| 65 6e 44 65 73 63 29 3b | 0d 09 09 09 7d 0d 09 09 |enDesc);|....}...|
|000038b0| 09 41 45 44 69 73 70 6f | 73 65 44 65 73 63 28 26 |.AEDispo|seDesc(&|
|000038c0| 64 69 72 65 63 74 50 61 | 72 61 6d 29 3b 0d 09 09 |directPa|ram);...|
|000038d0| 7d 0d 09 09 0d 09 09 69 | 66 20 28 65 72 72 29 0d |}......i|f (err).|
|000038e0| 09 09 7b 0d 09 09 09 65 | 72 72 20 3d 20 4d 61 6b |..{....e|rr = Mak|
|000038f0| 65 41 70 70 54 6f 6b 65 | 6e 28 26 74 68 65 54 6f |eAppToke|n(&theTo|
|00003900| 6b 65 6e 29 3b 0d 09 09 | 09 6d 61 64 65 41 70 70 |ken);...|.madeApp|
|00003910| 54 6f 6b 65 6e 20 3d 20 | 28 65 72 72 20 3d 3d 20 |Token = |(err == |
|00003920| 6e 6f 45 72 72 29 3b 0d | 09 09 7d 0d 09 7d 0d 09 |noErr);.|..}..}..|
|00003930| 69 66 20 28 74 68 65 54 | 6f 6b 65 6e 29 0d 09 7b |if (theT|oken)..{|
|00003940| 0d 09 09 65 72 72 20 3d | 20 74 68 65 54 6f 6b 65 |...err =| theToke|
|00003950| 6e 2d 3e 44 69 73 70 61 | 74 63 68 41 70 70 6c 65 |n->Dispa|tchApple|
|00003960| 45 76 65 6e 74 28 74 68 | 65 45 76 65 6e 74 2c 20 |Event(th|eEvent, |
|00003970| 74 68 65 52 65 70 6c 79 | 2c 20 74 68 65 45 76 74 |theReply|, theEvt|
|00003980| 43 6c 61 73 73 2c 20 74 | 68 65 45 76 74 49 44 29 |Class, t|heEvtID)|
|00003990| 3b 0d 09 7d 0d 09 2f 2f | 20 74 68 69 73 20 77 69 |;..}..//| this wi|
|000039a0| 6c 6c 20 64 69 73 70 6f | 73 65 20 6f 66 20 74 68 |ll dispo|se of th|
|000039b0| 65 20 74 6f 6b 65 6e 20 | 61 73 20 77 65 6c 6c 20 |e token |as well |
|000039c0| 61 73 20 74 68 65 20 64 | 65 73 63 72 69 70 74 6f |as the d|escripto|
|000039d0| 72 2c 20 73 6f 0d 09 41 | 45 44 69 73 70 6f 73 65 |r, so..A|EDispose|
|000039e0| 54 6f 6b 65 6e 28 26 74 | 68 65 54 6f 6b 65 6e 44 |Token(&t|heTokenD|
|000039f0| 65 73 63 29 3b 20 2f 2f | 20 44 4f 20 4e 4f 54 20 |esc); //| DO NOT |
|00003a00| 43 41 4c 4c 20 75 6e 74 | 69 6c 20 64 6f 6e 65 20 |CALL unt|il done |
|00003a10| 77 69 74 68 20 27 74 68 | 65 54 6f 6b 65 6e 27 0d |with 'th|eToken'.|
|00003a20| 09 69 66 20 28 6d 61 64 | 65 41 70 70 54 6f 6b 65 |.if (mad|eAppToke|
|00003a30| 6e 29 0d 09 09 64 65 6c | 65 74 65 20 74 68 65 54 |n)...del|ete theT|
|00003a40| 6f 6b 65 6e 3b 20 2f 2f | 20 74 68 69 73 20 77 69 |oken; //| this wi|
|00003a50| 6c 6c 20 6f 6e 6c 79 20 | 62 65 20 65 78 65 63 75 |ll only |be execu|
|00003a60| 74 65 64 20 69 66 20 74 | 6f 6b 65 6e 20 77 61 73 |ted if t|oken was|
|00003a70| 20 6d 61 64 65 20 69 6e | 20 74 68 69 73 20 66 75 | made in| this fu|
|00003a80| 6e 63 74 69 6f 6e 0d 09 | 0d 09 70 72 69 6e 74 66 |nction..|..printf|
|00003a90| 28 22 53 74 64 41 45 76 | 74 48 61 6e 64 6c 65 72 |("StdAEv|tHandler|
|00003aa0| 3a 20 65 72 72 20 3d 20 | 25 6c 64 5c 6e 22 2c 20 |: err = |%ld\n", |
|00003ab0| 65 72 72 29 3b 0d 09 0d | 09 72 65 74 75 72 6e 20 |err);...|.return |
|00003ac0| 28 4f 53 45 72 72 29 65 | 72 72 3b 0d 7d 0d 0d 0d |(OSErr)e|rr;.}...|
|00003ad0| 0d 2f 2f 20 69 6e 73 74 | 61 6c 6c 61 74 69 6f 6e |.// inst|allation|
|00003ae0| 0d 0d 70 61 73 63 61 6c | 20 4f 53 45 72 72 20 49 |..pascal| OSErr I|
|00003af0| 6e 73 74 61 6c 6c 45 76 | 65 6e 74 48 61 6e 64 6c |nstallEv|entHandl|
|00003b00| 65 72 73 28 76 6f 69 64 | 29 0d 7b 0d 09 4f 53 45 |ers(void|).{..OSE|
|00003b10| 72 72 20 65 72 72 20 3d | 20 30 3b 0d 09 0d 09 65 |rr err =| 0;....e|
|00003b20| 72 72 20 3d 20 41 45 49 | 6e 73 74 61 6c 6c 53 70 |rr = AEI|nstallSp|
|00003b30| 65 63 69 61 6c 48 61 6e | 64 6c 65 72 28 6b 65 79 |ecialHan|dler(key|
|00003b40| 50 72 65 44 69 73 70 61 | 74 63 68 2c 20 28 45 76 |PreDispa|tch, (Ev|
|00003b50| 65 6e 74 48 61 6e 64 6c | 65 72 50 72 6f 63 50 74 |entHandl|erProcPt|
|00003b60| 72 29 26 53 74 64 41 45 | 76 74 50 72 65 48 61 6e |r)&StdAE|vtPreHan|
|00003b70| 64 6c 65 72 2c 20 66 61 | 6c 73 65 29 3b 0d 0d 09 |dler, fa|lse);...|
|00003b80| 69 66 20 28 65 72 72 20 | 3d 3d 20 6e 6f 45 72 72 |if (err |== noErr|
|00003b90| 29 20 0d 09 09 65 72 72 | 20 3d 20 41 45 49 6e 73 |) ...err| = AEIns|
|00003ba0| 74 61 6c 6c 45 76 65 6e | 74 48 61 6e 64 6c 65 72 |tallEven|tHandler|
|00003bb0| 28 74 79 70 65 57 69 6c | 64 43 61 72 64 2c 20 74 |(typeWil|dCard, t|
|00003bc0| 79 70 65 57 69 6c 64 43 | 61 72 64 2c 0d 09 09 09 |ypeWildC|ard,....|
|00003bd0| 09 09 09 09 09 09 28 45 | 76 65 6e 74 48 61 6e 64 |......(E|ventHand|
|00003be0| 6c 65 72 50 72 6f 63 50 | 74 72 29 26 53 74 64 41 |lerProcP|tr)&StdA|
|00003bf0| 45 76 74 48 61 6e 64 6c | 65 72 2c 20 30 2c 20 66 |EvtHandl|er, 0, f|
|00003c00| 61 6c 73 65 29 3b 0d 2f | 2a 2d 2d 2d 2d 2d 2d 2d |alse);./|*-------|
|00003c10| 2d 0d 09 69 66 20 28 65 | 72 72 20 3d 3d 20 6e 6f |-..if (e|rr == no|
|00003c20| 45 72 72 29 20 65 72 72 | 20 3d 20 41 45 49 6e 73 |Err) err| = AEIns|
|00003c30| 74 61 6c 6c 45 76 65 6e | 74 48 61 6e 64 6c 65 72 |tallEven|tHandler|
|00003c40| 28 6b 41 53 41 70 70 6c | 65 53 63 72 69 70 74 53 |(kASAppl|eScriptS|
|00003c50| 75 69 74 65 2c 20 6b 47 | 65 74 41 45 54 45 2c 20 |uite, kG|etAETE, |
|00003c60| 28 45 76 65 6e 74 48 61 | 6e 64 6c 65 72 50 72 6f |(EventHa|ndlerPro|
|00003c70| 63 50 74 72 29 26 47 65 | 74 41 45 54 45 41 45 76 |cPtr)&Ge|tAETEAEv|
|00003c80| 74 48 61 6e 64 6c 65 72 | 2c 20 28 6c 6f 6e 67 29 |tHandler|, (long)|
|00003c90| 6b 47 65 74 41 45 55 54 | 2c 20 66 61 6c 73 65 29 |kGetAEUT|, false)|
|00003ca0| 3b 0d 0d 09 69 66 20 28 | 65 72 72 20 3d 3d 20 6e |;...if (|err == n|
|00003cb0| 6f 45 72 72 29 20 65 72 | 72 20 3d 20 41 45 49 6e |oErr) er|r = AEIn|
|00003cc0| 73 74 61 6c 6c 45 76 65 | 6e 74 48 61 6e 64 6c 65 |stallEve|ntHandle|
|00003cd0| 72 28 6b 43 6f 72 65 45 | 76 65 6e 74 43 6c 61 73 |r(kCoreE|ventClas|
|00003ce0| 73 2c 20 74 79 70 65 57 | 69 6c 64 43 61 72 64 2c |s, typeW|ildCard,|
|00003cf0| 20 28 45 76 65 6e 74 48 | 61 6e 64 6c 65 72 50 72 | (EventH|andlerPr|
|00003d00| 6f 63 50 74 72 29 26 52 | 71 64 41 45 76 74 48 61 |ocPtr)&R|qdAEvtHa|
|00003d10| 6e 64 6c 65 72 2c 20 30 | 2c 20 66 61 6c 73 65 29 |ndler, 0|, false)|
|00003d20| 3b 0d 09 0d 09 69 66 20 | 28 65 72 72 20 3d 3d 20 |;....if |(err == |
|00003d30| 6e 6f 45 72 72 29 20 65 | 72 72 20 3d 20 41 45 49 |noErr) e|rr = AEI|
|00003d40| 6e 73 74 61 6c 6c 45 76 | 65 6e 74 48 61 6e 64 6c |nstallEv|entHandl|
|00003d50| 65 72 28 6b 41 45 43 6f | 72 65 53 75 69 74 65 2c |er(kAECo|reSuite,|
|00003d60| 20 74 79 70 65 57 69 6c | 64 43 61 72 64 2c 20 28 | typeWil|dCard, (|
|00003d70| 45 76 65 6e 74 48 61 6e | 64 6c 65 72 50 72 6f 63 |EventHan|dlerProc|
|00003d80| 50 74 72 29 26 53 74 64 | 41 45 76 74 48 61 6e 64 |Ptr)&Std|AEvtHand|
|00003d90| 6c 65 72 2c 20 30 2c 20 | 66 61 6c 73 65 29 3b 0d |ler, 0, |false);.|
|00003da0| 09 69 66 20 28 65 72 72 | 20 3d 3d 20 6e 6f 45 72 |.if (err| == noEr|
|00003db0| 72 29 20 65 72 72 20 3d | 20 41 45 49 6e 73 74 61 |r) err =| AEInsta|
|00003dc0| 6c 6c 45 76 65 6e 74 48 | 61 6e 64 6c 65 72 28 6b |llEventH|andler(k|
|00003dd0| 43 6f 72 65 45 76 65 6e | 74 43 6c 61 73 73 2c 20 |CoreEven|tClass, |
|00003de0| 6b 41 45 4f 70 65 6e 2c | 20 28 45 76 65 6e 74 48 |kAEOpen,| (EventH|
|00003df0| 61 6e 64 6c 65 72 50 72 | 6f 63 50 74 72 29 26 53 |andlerPr|ocPtr)&S|
|00003e00| 74 64 41 45 76 74 48 61 | 6e 64 6c 65 72 2c 20 28 |tdAEvtHa|ndler, (|
|00003e10| 6c 6f 6e 67 29 6b 41 45 | 4f 70 65 6e 2c 20 66 61 |long)kAE|Open, fa|
|00003e20| 6c 73 65 29 3b 0d 0d 09 | 69 66 20 28 65 72 72 20 |lse);...|if (err |
|00003e30| 3d 3d 20 6e 6f 45 72 72 | 29 20 65 72 72 20 3d 20 |== noErr|) err = |
|00003e40| 41 45 49 6e 73 74 61 6c | 6c 45 76 65 6e 74 48 61 |AEInstal|lEventHa|
|00003e50| 6e 64 6c 65 72 28 6b 41 | 45 4d 69 73 63 53 74 61 |ndler(kA|EMiscSta|
|00003e60| 6e 64 61 72 64 73 2c 20 | 6b 41 45 44 6f 53 63 72 |ndards, |kAEDoScr|
|00003e70| 69 70 74 2c 20 28 45 76 | 65 6e 74 48 61 6e 64 6c |ipt, (Ev|entHandl|
|00003e80| 65 72 50 72 6f 63 50 74 | 72 29 26 44 6f 53 63 72 |erProcPt|r)&DoScr|
|00003e90| 69 70 74 41 45 76 74 48 | 61 6e 64 6c 65 72 2c 20 |iptAEvtH|andler, |
|00003ea0| 28 6c 6f 6e 67 29 6b 41 | 45 44 6f 53 63 72 69 70 |(long)kA|EDoScrip|
|00003eb0| 74 2c 20 66 61 6c 73 65 | 29 3b 0d 2d 2d 2d 2d 2d |t, false|);.-----|
|00003ec0| 2d 2d 2d 2d 2a 2f 0d 09 | 72 65 74 75 72 6e 20 65 |----*/..|return e|
|00003ed0| 72 72 3b 0d 7d 0d 0d 70 | 61 73 63 61 6c 20 4f 53 |rr;.}..p|ascal OS|
|00003ee0| 45 72 72 20 44 65 49 6e | 73 74 61 6c 6c 45 76 65 |Err DeIn|stallEve|
|00003ef0| 6e 74 48 61 6e 64 6c 65 | 72 73 28 76 6f 69 64 29 |ntHandle|rs(void)|
|00003f00| 0d 7b 0d 09 4f 53 45 72 | 72 20 65 72 72 20 3d 20 |.{..OSEr|r err = |
|00003f10| 30 3b 0d 09 0d 09 72 65 | 74 75 72 6e 20 65 72 72 |0;....re|turn err|
|00003f20| 3b 0d 7d 0d 0d 0d 00 00 | 00 00 00 00 00 00 00 00 |;.}.....|........|
|00003f30| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003f40| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003f50| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003f60| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003f70| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003f80| 00 00 01 00 00 00 01 6e | 00 00 00 6e 00 00 00 3e |.......n|...n...>|
|00003f90| 35 0d 2c 37 6c 06 f2 37 | 6c 11 00 4a 20 fe 67 15 |5.,7l..7|l..J .g.|
|00003fa0| 12 04 10 15 0e 03 18 3c | 1c 2e 00 13 3b 05 24 01 |.......<|....;.$.|
|00003fb0| 11 4f 62 6a 4d 6f 64 65 | 6c 45 76 65 6e 74 73 2e |.ObjMode|lEvents.|
|00003fc0| 63 70 02 00 00 00 54 45 | 58 54 4d 50 53 20 01 00 |cp....TE|XTMPS ..|
|00003fd0| 00 00 54 45 58 54 4d 50 | 53 20 01 00 ff ff ff ff |..TEXTMP|S ......|
|00003fe0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003ff0| 00 00 a8 38 b9 69 00 00 | 3e a6 00 00 01 ac 58 07 |...8.i..|>.....X.|
|00004000| 63 28 40 03 01 4a 28 00 | 27 67 64 0a 1f 6f aa 19 |c(@..J(.|'gd..o..|
|00004010| 0a 39 aa 1a 07 21 1f 33 | c7 99 39 d2 80 e2 81 3d |.9...!.3|..9....=|
|00004020| 41 1f 07 21 f1 53 33 99 | 0b d2 80 e2 81 3d 41 53 |A..!.S3.|.....=AS|
|00004030| fc 07 21 15 33 99 3d d2 | 80 e2 81 67 3d 41 15 40 |..!.3.=.|...g=A.@|
|00004040| aa 07 28 5f ad 78 2a d2 | 0a 1f aa 0d 2a aa 0a 70 |..(_.x*.|....*..p|
|00004050| 31 3c a8 89 b9 ad 66 12 | 16 07 3c 72 04 3f 01 02 |1<....f.|..<r.?..|
|00004060| 5f 00 d8 16 a8 9d ad 20 | 67 80 12 f3 04 10 0b 0e |_...... |g.......|
|00004070| 03 08 3c 2e 1c 3b a5 01 | 42 ae 0b 7e 01 60 2a 2a |..<..;..|B..~.`**|
|00004080| 00 00 00 48 00 09 4d 6f | 6e 61 63 6f 00 64 29 0d |...H..Mo|naco.d).|
|00004090| 7b 0d 09 4f 53 45 72 72 | 20 65 72 72 20 3d 20 30 |{..OSErr| err = 0|
|000040a0| 3b 0d 0d 2f 2f 09 00 06 | 00 04 00 5f 00 1a 02 00 |;..//...|..._....|
|000040b0| 02 33 00 5f 00 1a 02 00 | 02 33 a9 e9 e2 77 00 00 |.3._....|.3...w..|
|000040c0| 39 15 00 00 3a 07 00 00 | 27 c9 01 00 00 00 00 1e |9...:...|'.......|
|000040d0| 00 5f 00 1a 02 00 02 33 | 00 5f 00 1a 02 00 02 33 |._.....3|._.....3|
|000040e0| 00 00 27 c9 00 00 00 00 | 00 00 00 00 00 00 00 00 |..'.....|........|
|000040f0| 01 00 00 00 01 6e 00 00 | 00 6e 00 00 00 3e 00 df |.....n..|.n...>..|
|00004100| 59 78 1f 38 00 00 00 1c | 00 3e 00 00 4d 50 53 52 |Yx.8....|.>..MPSR|
|00004110| 00 01 00 0a 03 ed ff ff | 00 00 00 00 00 00 00 00 |........|........|
|00004120| 03 f0 ff ff 00 00 00 4c | 00 e1 b0 0c 00 00 00 00 |.......L|........|
|00004130| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004140| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004150| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004160| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004170| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
+--------+-------------------------+-------------------------+--------+--------+