1 {
2      File:       OpenScripting/OSA.h
3 
4      Contains:   Open Scripting Architecture Client Interfaces.
5 
6      Version:    OSA-148~28
7 
8      Copyright:  � 1992-2008 by Apple Inc., all rights reserved
9 
10      Bugs?:      For bug reports, consult the following page on
11                  the World Wide Web:
12 
13                      http://bugs.freepascal.org
14 
15 }
16 
17 {  Pascal Translation Updated: Gorazd Krosl <gorazd_1957@yahoo.ca>, October 2009 }
18 {  Pascal Translation Updated:  Jonas Maebe, <jonas@freepascal.org>, October 2012 }
19 {
20     Modified for use with Free Pascal
21     Version 308
22     Please report any bugs to <gpc@microbizz.nl>
23 }
24 
25 {$ifc not defined MACOSALLINCLUDE or not MACOSALLINCLUDE}
26 {$mode macpas}
27 {$modeswitch cblocks}
28 {$packenum 1}
29 {$macro on}
30 {$inline on}
31 {$calling mwpascal}
32 
33 unit OSA;
34 interface
35 {$setc UNIVERSAL_INTERFACES_VERSION := $0400}
36 {$setc GAP_INTERFACES_VERSION := $0308}
37 
38 {$ifc not defined USE_CFSTR_CONSTANT_MACROS}
39     {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
40 {$endc}
41 
42 {$ifc defined CPUPOWERPC and defined CPUI386}
43 	{$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
44 {$endc}
45 {$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
46 	{$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
47 {$endc}
48 
49 {$ifc not defined __ppc__ and defined CPUPOWERPC32}
50 	{$setc __ppc__ := 1}
51 {$elsec}
52 	{$setc __ppc__ := 0}
53 {$endc}
54 {$ifc not defined __ppc64__ and defined CPUPOWERPC64}
55 	{$setc __ppc64__ := 1}
56 {$elsec}
57 	{$setc __ppc64__ := 0}
58 {$endc}
59 {$ifc not defined __i386__ and defined CPUI386}
60 	{$setc __i386__ := 1}
61 {$elsec}
62 	{$setc __i386__ := 0}
63 {$endc}
64 {$ifc not defined __x86_64__ and defined CPUX86_64}
65 	{$setc __x86_64__ := 1}
66 {$elsec}
67 	{$setc __x86_64__ := 0}
68 {$endc}
69 {$ifc not defined __arm__ and defined CPUARM}
70 	{$setc __arm__ := 1}
71 {$elsec}
72 	{$setc __arm__ := 0}
73 {$endc}
74 {$ifc not defined __arm64__ and defined CPUAARCH64}
75   {$setc __arm64__ := 1}
76 {$elsec}
77   {$setc __arm64__ := 0}
78 {$endc}
79 
80 {$ifc defined cpu64}
81   {$setc __LP64__ := 1}
82 {$elsec}
83   {$setc __LP64__ := 0}
84 {$endc}
85 
86 
87 {$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
88 	{$error Conflicting definitions for __ppc__ and __i386__}
89 {$endc}
90 
91 {$ifc defined __ppc__ and __ppc__}
92 	{$setc TARGET_CPU_PPC := TRUE}
93 	{$setc TARGET_CPU_PPC64 := FALSE}
94 	{$setc TARGET_CPU_X86 := FALSE}
95 	{$setc TARGET_CPU_X86_64 := FALSE}
96 	{$setc TARGET_CPU_ARM := FALSE}
97 	{$setc TARGET_CPU_ARM64 := FALSE}
98 	{$setc TARGET_OS_MAC := TRUE}
99 	{$setc TARGET_OS_IPHONE := FALSE}
100 	{$setc TARGET_IPHONE_SIMULATOR := FALSE}
101 	{$setc TARGET_OS_EMBEDDED := FALSE}
102 {$elifc defined __ppc64__ and __ppc64__}
103 	{$setc TARGET_CPU_PPC := FALSE}
104 	{$setc TARGET_CPU_PPC64 := TRUE}
105 	{$setc TARGET_CPU_X86 := FALSE}
106 	{$setc TARGET_CPU_X86_64 := FALSE}
107 	{$setc TARGET_CPU_ARM := FALSE}
108 	{$setc TARGET_CPU_ARM64 := FALSE}
109 	{$setc TARGET_OS_MAC := TRUE}
110 	{$setc TARGET_OS_IPHONE := FALSE}
111 	{$setc TARGET_IPHONE_SIMULATOR := FALSE}
112 	{$setc TARGET_OS_EMBEDDED := FALSE}
113 {$elifc defined __i386__ and __i386__}
114 	{$setc TARGET_CPU_PPC := FALSE}
115 	{$setc TARGET_CPU_PPC64 := FALSE}
116 	{$setc TARGET_CPU_X86 := TRUE}
117 	{$setc TARGET_CPU_X86_64 := FALSE}
118 	{$setc TARGET_CPU_ARM := FALSE}
119 	{$setc TARGET_CPU_ARM64 := FALSE}
120 {$ifc defined iphonesim}
121  	{$setc TARGET_OS_MAC := FALSE}
122 	{$setc TARGET_OS_IPHONE := TRUE}
123 	{$setc TARGET_IPHONE_SIMULATOR := TRUE}
124 {$elsec}
125 	{$setc TARGET_OS_MAC := TRUE}
126 	{$setc TARGET_OS_IPHONE := FALSE}
127 	{$setc TARGET_IPHONE_SIMULATOR := FALSE}
128 {$endc}
129 	{$setc TARGET_OS_EMBEDDED := FALSE}
130 {$elifc defined __x86_64__ and __x86_64__}
131 	{$setc TARGET_CPU_PPC := FALSE}
132 	{$setc TARGET_CPU_PPC64 := FALSE}
133 	{$setc TARGET_CPU_X86 := FALSE}
134 	{$setc TARGET_CPU_X86_64 := TRUE}
135 	{$setc TARGET_CPU_ARM := FALSE}
136 	{$setc TARGET_CPU_ARM64 := FALSE}
137 {$ifc defined iphonesim}
138  	{$setc TARGET_OS_MAC := FALSE}
139 	{$setc TARGET_OS_IPHONE := TRUE}
140 	{$setc TARGET_IPHONE_SIMULATOR := TRUE}
141 {$elsec}
142 	{$setc TARGET_OS_MAC := TRUE}
143 	{$setc TARGET_OS_IPHONE := FALSE}
144 	{$setc TARGET_IPHONE_SIMULATOR := FALSE}
145 {$endc}
146 	{$setc TARGET_OS_EMBEDDED := FALSE}
147 {$elifc defined __arm__ and __arm__}
148 	{$setc TARGET_CPU_PPC := FALSE}
149 	{$setc TARGET_CPU_PPC64 := FALSE}
150 	{$setc TARGET_CPU_X86 := FALSE}
151 	{$setc TARGET_CPU_X86_64 := FALSE}
152 	{$setc TARGET_CPU_ARM := TRUE}
153 	{$setc TARGET_CPU_ARM64 := FALSE}
154 	{$setc TARGET_OS_MAC := FALSE}
155 	{$setc TARGET_OS_IPHONE := TRUE}
156 	{$setc TARGET_IPHONE_SIMULATOR := FALSE}
157 	{$setc TARGET_OS_EMBEDDED := TRUE}
158 {$elifc defined __arm64__ and __arm64__}
159 	{$setc TARGET_CPU_PPC := FALSE}
160 	{$setc TARGET_CPU_PPC64 := FALSE}
161 	{$setc TARGET_CPU_X86 := FALSE}
162 	{$setc TARGET_CPU_X86_64 := FALSE}
163 	{$setc TARGET_CPU_ARM := FALSE}
164 	{$setc TARGET_CPU_ARM64 := TRUE}
165 {$ifc defined ios}
166 	{$setc TARGET_OS_MAC := FALSE}
167 	{$setc TARGET_OS_IPHONE := TRUE}
168 	{$setc TARGET_OS_EMBEDDED := TRUE}
169 {$elsec}
170 	{$setc TARGET_OS_MAC := TRUE}
171 	{$setc TARGET_OS_IPHONE := FALSE}
172 	{$setc TARGET_OS_EMBEDDED := FALSE}
173 {$endc}
174 	{$setc TARGET_IPHONE_SIMULATOR := FALSE}
175 {$elsec}
176 	{$error __ppc__ nor __ppc64__ nor __i386__ nor __x86_64__ nor __arm__ nor __arm64__ is defined.}
177 {$endc}
178 
179 {$ifc defined __LP64__ and __LP64__ }
180   {$setc TARGET_CPU_64 := TRUE}
181 {$elsec}
182   {$setc TARGET_CPU_64 := FALSE}
183 {$endc}
184 
185 {$ifc defined FPC_BIG_ENDIAN}
186 	{$setc TARGET_RT_BIG_ENDIAN := TRUE}
187 	{$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
188 {$elifc defined FPC_LITTLE_ENDIAN}
189 	{$setc TARGET_RT_BIG_ENDIAN := FALSE}
190 	{$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
191 {$elsec}
192 	{$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
193 {$endc}
194 {$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
195 {$setc CALL_NOT_IN_CARBON := FALSE}
196 {$setc OLDROUTINENAMES := FALSE}
197 {$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
198 {$setc OPAQUE_UPP_TYPES := TRUE}
199 {$setc OTCARBONAPPLICATION := TRUE}
200 {$setc OTKERNEL := FALSE}
201 {$setc PM_USE_SESSION_APIS := TRUE}
202 {$setc TARGET_API_MAC_CARBON := TRUE}
203 {$setc TARGET_API_MAC_OS8 := FALSE}
204 {$setc TARGET_API_MAC_OSX := TRUE}
205 {$setc TARGET_CARBON := TRUE}
206 {$setc TARGET_CPU_68K := FALSE}
207 {$setc TARGET_CPU_MIPS := FALSE}
208 {$setc TARGET_CPU_SPARC := FALSE}
209 {$setc TARGET_OS_UNIX := FALSE}
210 {$setc TARGET_OS_WIN32 := FALSE}
211 {$setc TARGET_RT_MAC_68881 := FALSE}
212 {$setc TARGET_RT_MAC_CFM := FALSE}
213 {$setc TARGET_RT_MAC_MACHO := TRUE}
214 {$setc TYPED_FUNCTION_POINTERS := TRUE}
215 {$setc TYPE_BOOL := FALSE}
216 {$setc TYPE_EXTENDED := FALSE}
217 {$setc TYPE_LONGLONG := TRUE}
218 uses MacTypes,AEDataModel,MacErrors,AppleEvents,AEObjects,AEInteraction,Components,Files,CFBase,CFURL,CFAttributedString;
219 {$endc} {not MACOSALLINCLUDE}
220 
221 
222 {$ifc TARGET_OS_MAC}
223 
224 {$ALIGN POWER}
225 
226 
227 {*************************************************************************
228     Types and Constants
229 *************************************************************************}
230 
231 {    The componenent manager type code for components that
232         support the OSA interface defined here. }
233 { 0x6f736120 }
234 const
235 	kOSAComponentType = FourCharCode('osa ');
236 
237 { 0x73637074 }
238 const
239 	kOSAGenericScriptingComponentSubtype = FourCharCode('scpt');
240 
241 {  Type of script document files.  }
242 { 0x6f736173 }
243 const
244 	kOSAFileType = FourCharCode('osas');
245 
246 {
247         Suite and event code of the RecordedText event.
248         (See OSAStartRecording, below.)
249     }
250 { 0x61736372 }
251 const
252 	kOSASuite = FourCharCode('ascr');
253 
254 { 0x72656364 }
255 const
256 	kOSARecordedText = FourCharCode('recd');
257 
258 { Selector returns boolean }
259 { 0x6d6f6469 }
260 const
261 	kOSAScriptIsModified = FourCharCode('modi');
262 
263 { Selector returns boolean }
264 { 0x63736372 }
265 const
266 	kOSAScriptIsTypeCompiledScript = FourCharCode('cscr');
267 
268 { Selector returns boolean }
269 { 0x76616c75 }
270 const
271 	kOSAScriptIsTypeScriptValue = FourCharCode('valu');
272 
273 { Selector returns boolean }
274 { 0x636e7478 }
275 const
276 	kOSAScriptIsTypeScriptContext = FourCharCode('cntx');
277 
278 { Selector returns a DescType which may be passed to OSACoerceToDesc }
279 { 0x62657374 }
280 const
281 	kOSAScriptBestType = FourCharCode('best');
282 
283 {
284         This selector is used to determine whether a script has source
285         associated with it that when given to OSAGetSource, the call will not
286         fail.  The selector returns a boolean.
287     }
288 { 0x67737263 }
289 const
290 	kOSACanGetSource = FourCharCode('gsrc');
291 
292 
293 const
294 	typeOSADialectInfo = FourCharCode('difo'); {  0x6469666f   }
295 	keyOSADialectName = FourCharCode('dnam'); {  0x646e616d   }
296 	keyOSADialectCode = FourCharCode('dcod'); {  0x64636f64   }
297 	keyOSADialectLangCode = FourCharCode('dlcd'); {  0x646c6364   }
298 	keyOSADialectScriptCode = FourCharCode('dscd'); {  0x64736364   }
299 
300 type
301 	OSAError = ComponentResult;
302 { Under the Open Scripting Architecture all error results are longs }
303 type
304 	OSAID = UInt32;
305 {
306         OSAIDs allow transparent manipulation of scripts associated with
307         various scripting systems.
308     }
309 const
310 	kOSANullScript = 0;
311 
312 { No -script constant. }
313 const
314 	kOSANullMode = 0;    { sounds better }
315 	kOSAModeNull = 0;     { tastes consistent }
316 
317 {
318         Some routines take flags that control their execution.  This constant
319         declares default mode settings are used.
320     }
321 type
theAEEventClassnull322 	OSACreateAppleEventProcPtr = function( theAEEventClass: AEEventClass; theAEEventID: AEEventID; const (*var*) target: AEAddressDesc; returnID: SInt16; transactionID: SInt32; var result: AppleEvent; refCon: SRefCon ): OSErr;
constnull323 	OSASendProcPtr = function( const (*var*) theAppleEvent: AppleEvent; var reply: AppleEvent; sendMode: AESendMode; sendPriority: AESendPriority; timeOutInTicks: SInt32; idleProc: AEIdleUPP; filterProc: AEFilterUPP; refCon: SRefCon ): OSErr;
324 	OSACreateAppleEventUPP = OSACreateAppleEventProcPtr;
325 	OSASendUPP = OSASendProcPtr;
326 
327 {
328  *  NewOSACreateAppleEventUPP()
329  *
330  *  Availability:
331  *    Mac OS X:         in version 10.0 and later in Carbon.framework
332  *    CarbonLib:        in CarbonLib 1.0 and later
333  *    Non-Carbon CFM:   available as macro/inline
334  }
NewOSACreateAppleEventUPPnull335 function NewOSACreateAppleEventUPP( userRoutine: OSACreateAppleEventProcPtr ): OSACreateAppleEventUPP; external name '_NewOSACreateAppleEventUPP';
336 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
337 
338 {
339  *  NewOSASendUPP()
340  *
341  *  Availability:
342  *    Mac OS X:         in version 10.0 and later in Carbon.framework
343  *    CarbonLib:        in CarbonLib 1.0 and later
344  *    Non-Carbon CFM:   available as macro/inline
345  }
NewOSASendUPPnull346 function NewOSASendUPP( userRoutine: OSASendProcPtr ): OSASendUPP; external name '_NewOSASendUPP';
347 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
348 
349 {
350  *  DisposeOSACreateAppleEventUPP()
351  *
352  *  Availability:
353  *    Mac OS X:         in version 10.0 and later in Carbon.framework
354  *    CarbonLib:        in CarbonLib 1.0 and later
355  *    Non-Carbon CFM:   available as macro/inline
356  }
357 procedure DisposeOSACreateAppleEventUPP( userUPP: OSACreateAppleEventUPP ); external name '_DisposeOSACreateAppleEventUPP';
358 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
359 
360 {
361  *  DisposeOSASendUPP()
362  *
363  *  Availability:
364  *    Mac OS X:         in version 10.0 and later in Carbon.framework
365  *    CarbonLib:        in CarbonLib 1.0 and later
366  *    Non-Carbon CFM:   available as macro/inline
367  }
368 procedure DisposeOSASendUPP( userUPP: OSASendUPP ); external name '_DisposeOSASendUPP';
369 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
370 
371 {
372  *  InvokeOSACreateAppleEventUPP()
373  *
374  *  Availability:
375  *    Mac OS X:         in version 10.0 and later in Carbon.framework
376  *    CarbonLib:        in CarbonLib 1.0 and later
377  *    Non-Carbon CFM:   available as macro/inline
378  }
InvokeOSACreateAppleEventUPPnull379 function InvokeOSACreateAppleEventUPP( theAEEventClass: AEEventClass; theAEEventID: AEEventID; const (*var*) target: AEAddressDesc; returnID: SInt16; transactionID: SInt32; var result: AppleEvent; refCon: SRefCon; userUPP: OSACreateAppleEventUPP ): OSErr; external name '_InvokeOSACreateAppleEventUPP';
380 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
381 
382 {
383  *  InvokeOSASendUPP()
384  *
385  *  Availability:
386  *    Mac OS X:         in version 10.0 and later in Carbon.framework
387  *    CarbonLib:        in CarbonLib 1.0 and later
388  *    Non-Carbon CFM:   available as macro/inline
389  }
InvokeOSASendUPPnull390 function InvokeOSASendUPP( const (*var*) theAppleEvent: AppleEvent; var reply: AppleEvent; sendMode: AESendMode; sendPriority: AESendPriority; timeOutInTicks: SInt32; idleProc: AEIdleUPP; filterProc: AEFilterUPP; refCon: SRefCon; userUPP: OSASendUPP ): OSErr; external name '_InvokeOSASendUPP';
391 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
392 
393 
394 {*************************************************************************
395     OSA Interface Descriptions
396 **************************************************************************
397     The OSA Interface is broken down into a required interface, and several
398     optional interfaces to support additional functionality.  A given scripting
399     component may choose to support only some of the optional interfaces in
400     addition to the basic interface.  The OSA Component Flags may be used to
401     query the Component Manager to find a scripting component with a particular
402     capability, or determine if a particular scripting component supports a
403     particular capability.
404 *************************************************************************}
405 { OSA Component Flags: }
406 const
407 	kOSASupportsCompiling = $0002;
408 	kOSASupportsGetSource = $0004;
409 	kOSASupportsAECoercion = $0008;
410 	kOSASupportsAESending = $0010;
411 	kOSASupportsRecording = $0020;
412 	kOSASupportsConvenience = $0040;
413 	kOSASupportsDialects = $0080;
414 	kOSASupportsEventHandling = $0100;
415 
416 { Component Selectors: }
417 const
418 	kOSASelectLoad = $0001;
419 	kOSASelectStore = $0002;
420 	kOSASelectExecute = $0003;
421 	kOSASelectDisplay = $0004;
422 	kOSASelectScriptError = $0005;
423 	kOSASelectDispose = $0006;
424 	kOSASelectSetScriptInfo = $0007;
425 	kOSASelectGetScriptInfo = $0008;
426 	kOSASelectSetActiveProc = $0009;
427 	kOSASelectGetActiveProc = $000A;
428 	kOSASelectCopyDisplayString = $000B;
429 
430 { Compiling: }
431 const
432 	kOSASelectScriptingComponentName = $0102;
433 	kOSASelectCompile = $0103;
434 	kOSASelectCopyID = $0104;
435 	kOSASelectCopyScript = $0105;
436 
437 { GetSource: }
438 const
439 	kOSASelectGetSource = $0201;
440 	kOSASelectCopySourceString = $0202;
441 
442 { AECoercion: }
443 const
444 	kOSASelectCoerceFromDesc = $0301;
445 	kOSASelectCoerceToDesc = $0302;
446 
447 { AESending: }
448 const
449 	kOSASelectSetSendProc = $0401;
450 	kOSASelectGetSendProc = $0402;
451 	kOSASelectSetCreateProc = $0403;
452 	kOSASelectGetCreateProc = $0404;
453 	kOSASelectSetDefaultTarget = $0405;
454 
455 { Recording: }
456 const
457 	kOSASelectStartRecording = $0501;
458 	kOSASelectStopRecording = $0502;
459 
460 { Convenience: }
461 const
462 	kOSASelectLoadExecute = $0601;
463 	kOSASelectCompileExecute = $0602;
464 	kOSASelectDoScript = $0603;
465 
466 { Dialects: }
467 const
468 	kOSASelectSetCurrentDialect = $0701;
469 	kOSASelectGetCurrentDialect = $0702;
470 	kOSASelectAvailableDialects = $0703;
471 	kOSASelectGetDialectInfo = $0704;
472 	kOSASelectAvailableDialectCodeList = $0705;
473 
474 { Event Handling: }
475 const
476 	kOSASelectSetResumeDispatchProc = $0801;
477 	kOSASelectGetResumeDispatchProc = $0802;
478 	kOSASelectExecuteEvent = $0803;
479 	kOSASelectDoEvent = $0804;
480 	kOSASelectMakeContext = $0805;
481 
482 
483 { scripting component specific selectors are added beginning with this value  }
484 const
485 	kOSASelectComponentSpecificStart = $1001;
486 
487 
488 {        Mode Flags:
489 
490     Warning: These should not conflict with the AESend mode flags in
491     AppleEvents.h, because we may want to use them as OSA mode flags too.
492 }
493 
494 {
495         This mode flag may be passed to OSALoad, OSAStore or OSACompile to
496         instruct the scripting component to not retain the "source" of an
497         expression.  This will cause the OSAGetSource call to return the error
498         errOSASourceNotAvailable if used.  However, some scripting components
499         may not retain the source anyway.  This is mainly used when either space
500         efficiency is desired, or a script is to be "locked" so that its
501         implementation may not be viewed.
502     }
503 const
504 	kOSAModePreventGetSource = $00000001;
505 
506 {
507         These mode flags may be passed to OSACompile, OSAExecute, OSALoadExecute
508         OSACompileExecute, OSADoScript, OSAExecuteEvent, or OSADoEvent to
509         indicate whether or not the script may interact with the user, switch
510         layer or reconnect if necessary.  Any AppleEvents will be sent with the
511         corresponding AESend mode supplied.
512     }
513 const
514 	kOSAModeNeverInteract = kAENeverInteract;
515 	kOSAModeCanInteract = kAECanInteract;
516 	kOSAModeAlwaysInteract = kAEAlwaysInteract;
517 	kOSAModeDontReconnect = kAEDontReconnect;
518 
519 {
520         This mode flag may be passed to OSACompile, OSAExecute, OSALoadExecute
521         OSACompileExecute, OSADoScript, OSAExecuteEvent, or OSADoEvent to
522         indicate whether or not AppleEvents should be sent with the
523         kAECanSwitchLayer mode flag sent or not. NOTE: This flag is exactly the
524         opposite sense of the AppleEvent flag kAECanSwitchLayer.  This is to
525         provide a more convenient default, i.e. not supplying any mode
526         (kOSAModeNull) means to send events with kAECanSwitchLayer.  Supplying
527         the kOSAModeCantSwitchLayer mode flag will cause AESend to be called
528         without kAECanSwitchLayer.
529     }
530 const
531 	kOSAModeCantSwitchLayer = $00000040;
532 
533 {
534         This mode flag may be passed to OSACompile, OSAExecute, OSALoadExecute
535         OSACompileExecute, OSADoScript, OSAExecuteEvent, or OSADoEvent to
536         indicate whether or not AppleEvents should be sent with the kAEDontRecord
537         mode flag sent or not. NOTE: This flag is exactly the opposite sense of
538         the AppleEvent flag kAEDontRecord.  This is to provide a more convenient
539         default, i.e. not supplying any mode (kOSAModeNull) means to send events
540         with kAEDontRecord.  Supplying the kOSAModeDoRecord mode flag will
541         cause AESend to be called without kAEDontRecord.
542     }
543 const
544 	kOSAModeDoRecord = $00001000;
545 
546 {
547         This is a mode flag for OSACompile that indicates that a context should
548         be created as the result of compilation. All handler definitions are
549         inserted into the new context, and variables are initialized by
550         evaluating their initial values in a null context (i.e. they must be
551         constant expressions).
552     }
553 const
554 	kOSAModeCompileIntoContext = $00000002;
555 
556 {
557         This is a mode flag for OSACompile that indicates that the previous
558         script ID (input to OSACompile) should be augmented with any new
559         definitions in the sourceData rather than replaced with a new script.
560         This means that the previous script ID must designate a context.
561         The presence of this flag causes the kOSAModeCompileIntoContext flag
562         to be implicitly used, causing any new definitions to be initialized
563         in a null context.
564     }
565 const
566 	kOSAModeAugmentContext = $00000004;
567 
568 {
569         This mode flag may be passed to OSADisplay or OSADoScript to indicate
570         that output only need be human-readable, not re-compilable by OSACompile.
571         If used, output may be arbitrarily "beautified", e.g. quotes may be left
572         off of string values, long lists may have elipses, etc.
573     }
574 const
575 	kOSAModeDisplayForHumans = $00000008;
576 
577 {
578         This mode flag may be passed to OSAStore in the case where the scriptID
579         is a context.  This causes the context to be saved, but not the context's
580         parent context.  When the stored context is loaded back in, the parent
581         will be kOSANullScript.
582     }
583 const
584 	kOSAModeDontStoreParent = $00010000;
585 
586 {
587         This mode flag may be passed to OSAExecuteEvent to cause the event to
588         be dispatched to the direct object of the event. The direct object (or
589         subject attribute if the direct object is a non-object specifier) will
590         be resolved, and the resulting script object will be the recipient of
591         the message. The context argument to OSAExecuteEvent will serve as the
592         root of the lookup/resolution process.
593     }
594 const
595 	kOSAModeDispatchToDirectObject = $00020000;
596 
597 {
598         This mode flag may be passed to OSAExecuteEvent to indicate that
599         components do not have to get the data of object specifier arguments.
600     }
601 const
602 	kOSAModeDontGetDataForArguments = $00040000;
603 
604 {
605         This mode flag may be passed to OSACoerceToDesc to indicate that
606         the resulting descriptor should be fully qualified (i.e. should
607         include the root application reference).
608     }
609 const
610 	kOSAModeFullyQualifyDescriptors = $00080000;
611 
612 {*************************************************************************
613     OSA Basic Scripting Interface
614 **************************************************************************
615     Scripting components must at least support the Basic Scripting interface.
616 *************************************************************************}
617 {        Loading and Storing Scripts:
618 
619     These routines allow scripts to be loaded and stored in their internal
620     (possibly compiled, non-text) representation.
621 }
622 
623 { Resource type for scripts }
624 const
625 	kOSAScriptResourceType = kOSAGenericScriptingComponentSubtype;
626 
627 {
628         Default type given to OSAStore which creates "generic" loadable script
629         data descriptors.
630     }
631 const
632 	typeOSAGenericStorage = kOSAScriptResourceType;
633 
634 {
635  *  OSALoad()
636  *
637  *  Availability:
638  *    Mac OS X:         in version 10.0 and later in Carbon.framework
639  *    CarbonLib:        in CarbonLib 1.0 and later
640  *    Non-Carbon CFM:   in AppleScriptLib 1.1 and later
641  }
OSALoadnull642 function OSALoad( scriptingComponent: ComponentInstance; const (*var*) scriptData: AEDesc; modeFlags: SInt32; var resultingScriptID: OSAID ): OSAError; external name '_OSALoad';
643 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
644 
645 
646 {
647         OSAComponentFunctionInline(kOSASelectLoad, 12);
648 
649         Errors:
650             badComponentInstance        invalid scripting component instance
651             errOSASystemError
652             errOSABadStorageType:       scriptData not for this scripting component
653             errOSACorruptData:          data seems to be corrupt
654             errOSADataFormatObsolete    script data format is no longer supported
655             errOSADataFormatTooNew      script data format is from a newer version
656 
657         ModeFlags:
658             kOSAModePreventGetSource
659     }
660 {
661  *  OSAStore()
662  *
663  *  Availability:
664  *    Mac OS X:         in version 10.0 and later in Carbon.framework
665  *    CarbonLib:        in CarbonLib 1.0 and later
666  *    Non-Carbon CFM:   in AppleScriptLib 1.1 and later
667  }
OSAStorenull668 function OSAStore( scriptingComponent: ComponentInstance; scriptID: OSAID; desiredType: DescType; modeFlags: SInt32; var resultingScriptData: AEDesc ): OSAError; external name '_OSAStore';
669 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
670 
671 
672 {
673         OSAComponentFunctionInline(kOSASelectStore, 16);
674 
675         Errors:
676             badComponentInstance    invalid scripting component instance
677             errOSASystemError
678             errOSAInvalidID
679             errOSABadStorageType:   desiredType not for this scripting component
680 
681         ModeFlags:
682             kOSAModePreventGetSource
683             kOSAModeDontStoreParent
684     }
685 { Executing Scripts: }
686 {
687  *  OSAExecute()
688  *
689  *  Availability:
690  *    Mac OS X:         in version 10.0 and later in Carbon.framework
691  *    CarbonLib:        in CarbonLib 1.0 and later
692  *    Non-Carbon CFM:   in AppleScriptLib 1.1 and later
693  }
OSAExecutenull694 function OSAExecute( scriptingComponent: ComponentInstance; compiledScriptID: OSAID; contextID: OSAID; modeFlags: SInt32; var resultingScriptValueID: OSAID ): OSAError; external name '_OSAExecute';
695 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
696 
697 
698 {
699         OSAComponentFunctionInline(kOSASelectExecute, 16);
700         This call runs a script.  The contextID represents the environment
701         with which global variables in the script are resolved.  The constant
702         kOSANullScript may be used for the contextID if the application wishes
703         to not deal with context directly (a default one is associated with each
704         scripting component instance).  The resultingScriptValueID is the
705         result of evaluation, and contains a value which may be displayed using
706         the OSAGetSource call.  The modeFlags convey scripting component
707         specific information.
708 
709         Errors:
710             badComponentInstance    invalid scripting component instance
711             errOSASystemError
712             errOSAInvalidID
713             errOSAScriptError:      the executing script got an error
714 
715         ModeFlags:
716             kOSAModeNeverInteract
717             kOSAModeCanInteract
718             kOSAModeAlwaysInteract
719             kOSAModeCantSwitchLayer
720             kOSAModeDontReconnect
721             kOSAModeDoRecord
722     }
723 { Displaying results: }
724 {
725  *  OSADisplay()
726  *
727  *  Availability:
728  *    Mac OS X:         in version 10.0 and later in Carbon.framework
729  *    CarbonLib:        in CarbonLib 1.0 and later
730  *    Non-Carbon CFM:   in AppleScriptLib 1.1 and later
731  }
OSADisplaynull732 function OSADisplay( scriptingComponent: ComponentInstance; scriptValueID: OSAID; desiredType: DescType; modeFlags: SInt32; var resultingText: AEDesc ): OSAError; external name '_OSADisplay';
733 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
734 
735 
736 {
737         OSAComponentFunctionInline(kOSASelectDisplay, 16);
738         This call is used to convert results (script value IDs) into displayable
739         text. The desiredType should be at least typeChar, and modeFlags are
740         scripting system specific flags to control the formatting of the
741         resulting text. This call differs from OSAGetSource in that (1) it
742         always produces at least typeChar, (2) is only works on script values,
743         (3) it may display it's output in non-compilable form (e.g. without
744         string quotes, elipses inserted in long and/or circular lists, etc.) and
745         (4) it is required by the basic scripting interface.
746 
747         Errors:
748             badComponentInstance    invalid scripting component instance
749             errOSASystemError
750             errOSAInvalidID
751             errAECoercionFail:      desiredType not supported by scripting component
752 
753         ModeFlags:
754             kOSAModeDisplayForHumans
755     }
756 {
757     @function   OSACopyDisplayString
758 
759     @discussion Similar to OSADisplay, but returns the text as a CFAttributedStringRef.
760 }
761 {
762  *  OSACopyDisplayString()
763  *
764  *  Availability:
765  *    Mac OS X:         in version 10.5 and later in Carbon.framework
766  *    CarbonLib:        not available
767  *    Non-Carbon CFM:   not available
768  }
OSACopyDisplayStringnull769 function OSACopyDisplayString( scriptingComponent: ComponentInstance; scriptID: OSAID; modeFlags: SInt32; var result: CFAttributedStringRef ): OSAError; external name '_OSACopyDisplayString';
770 (* AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER *)
771 
772 
773 { Getting Error Information: }
774 {
775  *  OSAScriptError()
776  *
777  *  Availability:
778  *    Mac OS X:         in version 10.0 and later in Carbon.framework
779  *    CarbonLib:        in CarbonLib 1.0 and later
780  *    Non-Carbon CFM:   in AppleScriptLib 1.1 and later
781  }
OSAScriptErrornull782 function OSAScriptError( scriptingComponent: ComponentInstance; selector: OSType; desiredType: DescType; var resultingErrorDescription: AEDesc ): OSAError; external name '_OSAScriptError';
783 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
784 
785 
786 {
787         OSAComponentFunctionInline(kOSASelectScriptError, 12);
788         Whenever script execution returns errOSAExecutionError, this routine
789         may be used to get information about that error.  The selector describes
790         the type of information desired about the error (various selectors are
791         listed below).  The desiredType indicates the data type of the result
792         desired for that selector.
793 
794         Errors:
795             badComponentInstance    invalid scripting component instance
796             errOSASystemError
797             errOSABadSelector:      selector not supported by scripting component
798             errAECoercionFail:      desiredType not supported by scripting component
799     }
800 { OSAScriptError selectors: }
801 {
802         This selector is used to determine the error number of a script error.
803         These error numbers may be either system error numbers, or error numbers
804         that are scripting component specific.
805         Required desiredTypes:
806             typeSInt32
807     }
808 const
809 	kOSAErrorNumber = keyErrorNumber;
810 
811 {
812         This selector is used to determine the full error message associated
813         with the error number.  It should include the name of the application
814         which caused the error, as well as the specific error that occurred.
815         This selector is sufficient for simple error reporting (but see
816         kOSAErrorBriefMessage, below).
817         Required desiredTypes:
818             typeChar                    error message string
819     }
820 const
821 	kOSAErrorMessage = keyErrorString;
822 
823 {
824         This selector is used to determine a brief error message associated with
825         the error number.  This message and should not mention the name of the
826         application which caused the error, any partial results or offending
827         object (see kOSAErrorApp, kOSAErrorPartialResult and
828         kOSAErrorOffendingObject, below).
829         Required desiredTypes:
830             typeChar                    brief error message string
831     }
832 {  0x65727262  }
833 const
834 	kOSAErrorBriefMessage = FourCharCode('errb');
835 
836 {
837         This selector is used to determine which application actually got the
838         error (if it was the result of an AESend), or the current application
839         if ....
840         Required desiredTypes:
841             typeProcessSerialNumber     PSN of the errant application
842             typeChar                    name of the errant application
843     }
844 {  0x65726170  }
845 const
846 	kOSAErrorApp = FourCharCode('erap');
847 
848 {
849         This selector is used to determine any partial result returned by an
850         operation. If an AESend call failed, but a partial result was returned,
851         then the partial result may be returned as an AEDesc.
852         Required desiredTypes:
853             typeBest                    AEDesc of any partial result
854     }
855 {  0x70746c72   }
856 const
857 	kOSAErrorPartialResult = FourCharCode('ptlr');
858 
859 {
860         This selector is used to determine any object which caused the error
861         that may have been indicated by an application.  The result is an
862         AEDesc.
863         Required desiredTypes:
864             typeBest                    AEDesc of any offending object
865     }
866 {  0x65726f62   }
867 const
868 	kOSAErrorOffendingObject = FourCharCode('erob');
869 
870 {
871         This selector is used to determine the type expected by a coercion
872         operation if a type error occurred.
873     }
874 {  0x65727274   }
875 const
876 	kOSAErrorExpectedType = FourCharCode('errt');
877 
878 {
879         This selector is used to determine the source text range (start and
880         end positions) of where the error occurred.
881         Required desiredTypes:
882             typeOSAErrorRange
883     }
884 {  0x65726e67  }
885 const
886 	kOSAErrorRange = FourCharCode('erng');
887 
888 {
889         An AERecord type containing keyOSASourceStart and keyOSASourceEnd fields
890         of type short.
891     }
892 {  0x65726e67   }
893 const
894 	typeOSAErrorRange = FourCharCode('erng');
895 
896 { Field of a typeOSAErrorRange record of typeSInt16 }
897 {  0x73726373    }
898 const
899 	keyOSASourceStart = FourCharCode('srcs');
900 
901 { Field of a typeOSAErrorRange record of typeSInt16 }
902 {  0x73726365   }
903 const
904 	keyOSASourceEnd = FourCharCode('srce');
905 
906 { Disposing Script IDs: }
907 {
908  *  OSADispose()
909  *
910  *  Availability:
911  *    Mac OS X:         in version 10.0 and later in Carbon.framework
912  *    CarbonLib:        in CarbonLib 1.0 and later
913  *    Non-Carbon CFM:   in AppleScriptLib 1.1 and later
914  }
OSADisposenull915 function OSADispose( scriptingComponent: ComponentInstance; scriptID: OSAID ): OSAError; external name '_OSADispose';
916 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
917 
918 
919 {
920         OSAComponentFunctionInline(kOSASelectDispose, 4);
921         Disposes a script or context.
922 
923         Errors:
924             badComponentInstance    invalid scripting component instance
925             errOSASystemError
926             errOSAInvalidID
927     }
928 { Getting and Setting Script Information: }
929 {
930  *  OSASetScriptInfo()
931  *
932  *  Availability:
933  *    Mac OS X:         in version 10.0 and later in Carbon.framework
934  *    CarbonLib:        in CarbonLib 1.0 and later
935  *    Non-Carbon CFM:   in AppleScriptLib 1.1 and later
936  }
OSASetScriptInfonull937 function OSASetScriptInfo( scriptingComponent: ComponentInstance; scriptID: OSAID; selector: OSType; value: SIGNEDLONG ): OSAError; external name '_OSASetScriptInfo';
938 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
939 
940 
941 {
942         OSAComponentFunctionInline(kOSASelectSetScriptInfo, 12);
943 
944         Errors:
945             badComponentInstance    invalid scripting component instance
946             errOSASystemError
947             errOSAInvalidID
948             errOSABadSelector:      selector not supported by scripting component
949                                     or selector not for this scriptID
950     }
951 {
952  *  OSAGetScriptInfo()
953  *
954  *  Availability:
955  *    Mac OS X:         in version 10.0 and later in Carbon.framework
956  *    CarbonLib:        in CarbonLib 1.0 and later
957  *    Non-Carbon CFM:   in AppleScriptLib 1.1 and later
958  }
OSAGetScriptInfonull959 function OSAGetScriptInfo( scriptingComponent: ComponentInstance; scriptID: OSAID; selector: OSType; var result: SIGNEDLONG ): OSAError; external name '_OSAGetScriptInfo';
960 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
961 
962 
963 {
964         OSAComponentFunctionInline(kOSASelectGetScriptInfo, 12);
965 
966         Errors:
967             badComponentInstance    invalid scripting component instance
968             errOSASystemError
969             errOSAInvalidID
970             errOSABadSelector:      selector not supported by scripting component
971                                     or selector not for this scriptID
972     }
973 { Manipulating the ActiveProc:
974 
975     Scripting systems will supply default values for these procedures if they
976     are not set by the client:
977 }
978 type
refConnull979 	OSAActiveProcPtr = function( refCon: SRefCon ): OSErr;
980 	OSAActiveUPP = OSAActiveProcPtr;
981 
982 {
983  *  NewOSAActiveUPP()
984  *
985  *  Availability:
986  *    Mac OS X:         in version 10.0 and later in Carbon.framework
987  *    CarbonLib:        in CarbonLib 1.0 and later
988  *    Non-Carbon CFM:   available as macro/inline
989  }
NewOSAActiveUPPnull990 function NewOSAActiveUPP( userRoutine: OSAActiveProcPtr ): OSAActiveUPP; external name '_NewOSAActiveUPP';
991 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
992 
993 {
994  *  DisposeOSAActiveUPP()
995  *
996  *  Availability:
997  *    Mac OS X:         in version 10.0 and later in Carbon.framework
998  *    CarbonLib:        in CarbonLib 1.0 and later
999  *    Non-Carbon CFM:   available as macro/inline
1000  }
1001 procedure DisposeOSAActiveUPP( userUPP: OSAActiveUPP ); external name '_DisposeOSAActiveUPP';
1002 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
1003 
1004 {
1005  *  InvokeOSAActiveUPP()
1006  *
1007  *  Availability:
1008  *    Mac OS X:         in version 10.0 and later in Carbon.framework
1009  *    CarbonLib:        in CarbonLib 1.0 and later
1010  *    Non-Carbon CFM:   available as macro/inline
1011  }
InvokeOSAActiveUPPnull1012 function InvokeOSAActiveUPP( refCon: SRefCon; userUPP: OSAActiveUPP ): OSErr; external name '_InvokeOSAActiveUPP';
1013 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
1014 
1015 
1016 {
1017  *  OSASetActiveProc()
1018  *
1019  *  Availability:
1020  *    Mac OS X:         in version 10.0 and later in Carbon.framework
1021  *    CarbonLib:        in CarbonLib 1.0 and later
1022  *    Non-Carbon CFM:   in AppleScriptLib 1.1 and later
1023  }
OSASetActiveProcnull1024 function OSASetActiveProc( scriptingComponent: ComponentInstance; activeProc: OSAActiveUPP; refCon: SRefCon ): OSAError; external name '_OSASetActiveProc';
1025 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
1026 
1027 
1028 {
1029         OSAComponentFunctionInline(kOSASelectSetActiveProc, 8);
1030         If activeProc is nil, the default activeProc is used.
1031 
1032         Errors:
1033             badComponentInstance    invalid scripting component instance
1034             errOSASystemError
1035     }
1036 {
1037  *  OSAGetActiveProc()
1038  *
1039  *  Availability:
1040  *    Mac OS X:         in version 10.0 and later in Carbon.framework
1041  *    CarbonLib:        in CarbonLib 1.0 and later
1042  *    Non-Carbon CFM:   in AppleScriptLib 1.1 and later
1043  }
OSAGetActiveProcnull1044 function OSAGetActiveProc( scriptingComponent: ComponentInstance; var activeProc: OSAActiveUPP; var refCon: SRefCon ): OSAError; external name '_OSAGetActiveProc';
1045 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
1046 
1047 
1048 {
1049         OSAComponentFunctionInline(kOSASelectGetActiveProc, 8);
1050 
1051         Errors:
1052             badComponentInstance    invalid scripting component instance
1053             errOSASystemError
1054     }
1055 {*************************************************************************
1056     OSA Optional Compiling Interface
1057 **************************************************************************
1058     Scripting components that support the Compiling interface have the
1059     kOSASupportsCompiling bit set in it's ComponentDescription.
1060 *************************************************************************}
1061 {
1062  *  OSAScriptingComponentName()
1063  *
1064  *  Availability:
1065  *    Mac OS X:         in version 10.0 and later in Carbon.framework
1066  *    CarbonLib:        in CarbonLib 1.0 and later
1067  *    Non-Carbon CFM:   in AppleScriptLib 1.1 and later
1068  }
OSAScriptingComponentNamenull1069 function OSAScriptingComponentName( scriptingComponent: ComponentInstance; var resultingScriptingComponentName: AEDesc ): OSAError; external name '_OSAScriptingComponentName';
1070 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
1071 
1072 
1073 {
1074         OSAComponentFunctionInline(kOSASelectScriptingComponentName, 4);
1075         Given a scripting component, this routine returns the name of that
1076         scripting component in a type that is coercable to text (typeChar).
1077         The generic scripting component returns the name of the default
1078         scripting component.  This name should be sufficient to convey to the
1079         user the kind of script (syntax) he is expected to write.
1080 
1081         Errors:
1082             badComponentInstance    invalid scripting component instance
1083             errOSASystemError
1084     }
1085 {
1086  *  OSACompile()
1087  *
1088  *  Availability:
1089  *    Mac OS X:         in version 10.0 and later in Carbon.framework
1090  *    CarbonLib:        in CarbonLib 1.0 and later
1091  *    Non-Carbon CFM:   in AppleScriptLib 1.1 and later
1092  }
OSACompilenull1093 function OSACompile( scriptingComponent: ComponentInstance; const (*var*) sourceData: AEDesc; modeFlags: SInt32; var previousAndResultingScriptID: OSAID ): OSAError; external name '_OSACompile';
1094 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
1095 
1096 
1097 {
1098         OSAComponentFunctionInline(kOSASelectCompile, 12);
1099         Coerces input desc (possibly text) into a script's internal format.
1100         Once compiled, the script is ready to run.  The modeFlags convey
1101         scripting component specific information.  The previous script ID
1102         (result parameter) is made to refer to the newly compiled script,
1103         unless it was originally kOSANullScript.  In this case a new script
1104         ID is created and used.
1105 
1106         Errors:
1107             badComponentInstance    invalid scripting component instance
1108             errOSASystemError
1109             errAECoercionFail:      sourceData is not compilable
1110             errOSAScriptError:      sourceData was a bad script (syntax error)
1111             errOSAInvalidID:        previousAndResultingCompiledScriptID was not
1112                                     valid on input
1113 
1114         ModeFlags:
1115             kOSAModePreventGetSource
1116             kOSAModeCompileIntoContext
1117             kOSAModeAugmentContext
1118             kOSAModeNeverInteract
1119             kOSAModeCanInteract
1120             kOSAModeAlwaysInteract
1121             kOSAModeCantSwitchLayer
1122             kOSAModeDontReconnect
1123             kOSAModeDoRecord
1124     }
1125 {
1126  *  OSACopyID()
1127  *
1128  *  Availability:
1129  *    Mac OS X:         in version 10.0 and later in Carbon.framework
1130  *    CarbonLib:        in CarbonLib 1.0 and later
1131  *    Non-Carbon CFM:   in AppleScriptLib 1.1 and later
1132  }
OSACopyIDnull1133 function OSACopyID( scriptingComponent: ComponentInstance; fromID: OSAID; var toID: OSAID ): OSAError; external name '_OSACopyID';
1134 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
1135 
1136 
1137 {
1138         OSAComponentFunctionInline(kOSASelectCopyID, 8);
1139         If toID is a reference to kOSANullScript then it is updated to have a
1140         new scriptID value.  This call can be used to perform undo or revert
1141         operations on scripts.
1142 
1143         Errors:
1144             badComponentInstance    invalid scripting component instance
1145             errOSASystemError
1146             errOSAInvalidID
1147     }
1148 {
1149  *  OSACopyScript()
1150  *
1151  *  Availability:
1152  *    Mac OS X:         in version 10.6 and later in Carbon.framework
1153  *    CarbonLib:        not available
1154  *    Non-Carbon CFM:   in AppleScriptLib 1.5 and later
1155  }
OSACopyScriptnull1156 function OSACopyScript( scriptingComponent: ComponentInstance; fromID: OSAID; var toID: OSAID ): OSAError; external name '_OSACopyScript';
1157 (* AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER *)
1158 
1159 
1160 {
1161         OSAComponentFunctionInline(kOSASelectCopyScript, 8);
1162         Creates a duplicate copy of the script with the given OSAID and returns
1163         a new OSAID for it.  Can be used by script editors or debuggers.
1164 
1165         Errors:
1166             badComponentInstance    invalid scripting component instance
1167             errOSASystemError
1168             errOSAInvalidID
1169     }
1170 {*************************************************************************
1171     OSA Optional GetSource Interface
1172 **************************************************************************
1173     Scripting components that support the GetSource interface have the
1174     kOSASupportsGetSource bit set in their ComponentDescription.
1175 *************************************************************************}
1176 {
1177  *  OSAGetSource()
1178  *
1179  *  Availability:
1180  *    Mac OS X:         in version 10.0 and later in Carbon.framework
1181  *    CarbonLib:        in CarbonLib 1.0 and later
1182  *    Non-Carbon CFM:   in AppleScriptLib 1.1 and later
1183  }
OSAGetSourcenull1184 function OSAGetSource( scriptingComponent: ComponentInstance; scriptID: OSAID; desiredType: DescType; var resultingSourceData: AEDesc ): OSAError; external name '_OSAGetSource';
1185 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
1186 
1187 
1188 {
1189         OSAComponentFunctionInline(kOSASelectGetSource, 12);
1190         This routine causes a compiled script to be output in a form (possibly
1191         text) such that it is suitable to be passed back to OSACompile.
1192 
1193         Errors:
1194             badComponentInstance    invalid scripting component instance
1195             errOSASystemError
1196             errOSAInvalidID
1197             errOSASourceNotAvailable    can't get source for this scriptID
1198     }
1199 {
1200     @function   OSACopySourceString
1201 
1202     @discussion Similar to OSAGetSource, but returns the text as a CFAttributedStringRef.
1203 }
1204 {
1205  *  OSACopySourceString()
1206  *
1207  *  Availability:
1208  *    Mac OS X:         in version 10.5 and later in Carbon.framework
1209  *    CarbonLib:        not available
1210  *    Non-Carbon CFM:   not available
1211  }
OSACopySourceStringnull1212 function OSACopySourceString( scriptingComponent: ComponentInstance; scriptID: OSAID; modeFlags: SInt32; var result: CFAttributedStringRef ): OSAError; external name '_OSACopySourceString';
1213 (* AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER *)
1214 
1215 
1216 {*************************************************************************
1217     OSA Optional AECoercion Interface
1218 **************************************************************************
1219     Scripting components that support the AECoercion interface have the
1220     kOSASupportsAECoercion bit set in their ComponentDescription.
1221 *************************************************************************}
1222 {
1223  *  OSACoerceFromDesc()
1224  *
1225  *  Availability:
1226  *    Mac OS X:         in version 10.0 and later in Carbon.framework
1227  *    CarbonLib:        in CarbonLib 1.0 and later
1228  *    Non-Carbon CFM:   in AppleScriptLib 1.1 and later
1229  }
OSACoerceFromDescnull1230 function OSACoerceFromDesc( scriptingComponent: ComponentInstance; const (*var*) scriptData: AEDesc; modeFlags: SInt32; var resultingScriptID: OSAID ): OSAError; external name '_OSACoerceFromDesc';
1231 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
1232 
1233 
1234 {
1235         OSAComponentFunctionInline(kOSASelectCoerceFromDesc, 12);
1236         This routine causes script data to be coerced into a script value.
1237         If the scriptData is an AppleEvent, then the resultingScriptID is a
1238         compiled script ID (mode flags for OSACompile may be used in this case).
1239         Other scriptData descriptors create script value IDs.
1240 
1241         Errors:
1242             badComponentInstance    invalid scripting component instance
1243             errOSASystemError
1244 
1245         ModeFlags:
1246             kOSAModePreventGetSource
1247             kOSAModeCompileIntoContext
1248             kOSAModeNeverInteract
1249             kOSAModeCanInteract
1250             kOSAModeAlwaysInteract
1251             kOSAModeCantSwitchLayer
1252             kOSAModeDontReconnect
1253             kOSAModeDoRecord
1254     }
1255 {
1256  *  OSACoerceToDesc()
1257  *
1258  *  Availability:
1259  *    Mac OS X:         in version 10.0 and later in Carbon.framework
1260  *    CarbonLib:        in CarbonLib 1.0 and later
1261  *    Non-Carbon CFM:   in AppleScriptLib 1.1 and later
1262  }
OSACoerceToDescnull1263 function OSACoerceToDesc( scriptingComponent: ComponentInstance; scriptID: OSAID; desiredType: DescType; modeFlags: SInt32; var result: AEDesc ): OSAError; external name '_OSACoerceToDesc';
1264 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
1265 
1266 
1267 {
1268         OSAComponentFunctionInline(kOSASelectCoerceToDesc, 16);
1269         This routine causes a script value to be coerced into any desired form.
1270         If the scriptID denotes a compiled script, then it may be coerced to
1271         typeAppleEvent.
1272 
1273         Errors:
1274             badComponentInstance    invalid scripting component instance
1275             errOSASystemError
1276             errOSAInvalidID
1277     }
1278 {*************************************************************************
1279     OSA Optional AESending Interface
1280 **************************************************************************
1281     Scripting components that support the AESending interface have the
1282     kOSASupportsAESending bit set in their ComponentDescription.
1283 *************************************************************************}
1284 {
1285     Scripting systems will supply default values for these procedures if they
1286     are not set by the client:
1287 }
1288 {
1289  *  OSASetSendProc()
1290  *
1291  *  Availability:
1292  *    Mac OS X:         in version 10.0 and later in Carbon.framework
1293  *    CarbonLib:        in CarbonLib 1.0 and later
1294  *    Non-Carbon CFM:   in AppleScriptLib 1.1 and later
1295  }
OSASetSendProcnull1296 function OSASetSendProc( scriptingComponent: ComponentInstance; sendProc: OSASendUPP; refCon: SRefCon ): OSAError; external name '_OSASetSendProc';
1297 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
1298 
1299 
1300 {
1301         OSAComponentFunctionInline(kOSASelectSetSendProc, 8);
1302         If sendProc is nil, the default sendProc is used.
1303 
1304         Errors:
1305             badComponentInstance    invalid scripting component instance
1306             errOSASystemError
1307     }
1308 {
1309  *  OSAGetSendProc()
1310  *
1311  *  Availability:
1312  *    Mac OS X:         in version 10.0 and later in Carbon.framework
1313  *    CarbonLib:        in CarbonLib 1.0 and later
1314  *    Non-Carbon CFM:   in AppleScriptLib 1.1 and later
1315  }
OSAGetSendProcnull1316 function OSAGetSendProc( scriptingComponent: ComponentInstance; var sendProc: OSASendUPP; var refCon: SRefCon ): OSAError; external name '_OSAGetSendProc';
1317 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
1318 
1319 
1320 {
1321         OSAComponentFunctionInline(kOSASelectGetSendProc, 8);
1322 
1323         Errors:
1324             badComponentInstance    invalid scripting component instance
1325             errOSASystemError
1326     }
1327 {
1328  *  OSASetCreateProc()
1329  *
1330  *  Availability:
1331  *    Mac OS X:         in version 10.0 and later in Carbon.framework
1332  *    CarbonLib:        in CarbonLib 1.0 and later
1333  *    Non-Carbon CFM:   in AppleScriptLib 1.1 and later
1334  }
OSASetCreateProcnull1335 function OSASetCreateProc( scriptingComponent: ComponentInstance; createProc: OSACreateAppleEventUPP; refCon: SRefCon ): OSAError; external name '_OSASetCreateProc';
1336 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
1337 
1338 
1339 {
1340         OSAComponentFunctionInline(kOSASelectSetCreateProc, 8);
1341         If createProc is nil, the default createProc is used.
1342 
1343         Errors:
1344             badComponentInstance    invalid scripting component instance
1345             errOSASystemError
1346     }
1347 {
1348  *  OSAGetCreateProc()
1349  *
1350  *  Availability:
1351  *    Mac OS X:         in version 10.0 and later in Carbon.framework
1352  *    CarbonLib:        in CarbonLib 1.0 and later
1353  *    Non-Carbon CFM:   in AppleScriptLib 1.1 and later
1354  }
OSAGetCreateProcnull1355 function OSAGetCreateProc( scriptingComponent: ComponentInstance; var createProc: OSACreateAppleEventUPP; var refCon: SRefCon ): OSAError; external name '_OSAGetCreateProc';
1356 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
1357 
1358 
1359 {
1360         OSAComponentFunctionInline(kOSASelectGetCreateProc, 8);
1361 
1362         Errors:
1363             badComponentInstance    invalid scripting component instance
1364             errOSASystemError
1365     }
1366 {
1367  *  OSASetDefaultTarget()
1368  *
1369  *  Availability:
1370  *    Mac OS X:         in version 10.0 and later in Carbon.framework
1371  *    CarbonLib:        in CarbonLib 1.0 and later
1372  *    Non-Carbon CFM:   in AppleScriptLib 1.1 and later
1373  }
OSASetDefaultTargetnull1374 function OSASetDefaultTarget( scriptingComponent: ComponentInstance; const (*var*) target: AEAddressDesc ): OSAError; external name '_OSASetDefaultTarget';
1375 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
1376 
1377 
1378 {
1379         OSAComponentFunctionInline(kOSASelectSetDefaultTarget, 4);
1380         This routine sets the default target application for AE sending.
1381         It also establishes the default target from which terminologies come.
1382         It is effectively like having an AppleScript "tell" statement around
1383         the entire program.  If this routine is not called, or if the target
1384         is a null AEDesc, then the current application is the default target.
1385 
1386         Errors:
1387             badComponentInstance    invalid scripting component instance
1388             errOSASystemError
1389     }
1390 {*************************************************************************
1391     OSA Optional Recording Interface
1392 **************************************************************************
1393     Scripting components that support the Recording interface have the
1394     kOSASupportsRecording bit set in their ComponentDescription.
1395 *************************************************************************}
1396 {
1397  *  OSAStartRecording()
1398  *
1399  *  Availability:
1400  *    Mac OS X:         in version 10.0 and later in Carbon.framework
1401  *    CarbonLib:        in CarbonLib 1.0 and later
1402  *    Non-Carbon CFM:   in AppleScriptLib 1.1 and later
1403  }
OSAStartRecordingnull1404 function OSAStartRecording( scriptingComponent: ComponentInstance; var compiledScriptToModifyID: OSAID ): OSAError; external name '_OSAStartRecording';
1405 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
1406 
1407 
1408 {
1409         OSAComponentFunctionInline(kOSASelectStartRecording, 4);
1410         Starts recording.  If compiledScriptToModifyID is kOSANullScript, a
1411         new script ID is created and returned.  If the current application has
1412         a handler for the kOSARecordedText event, then kOSARecordedText events
1413         are sent to the application containing the text of each AppleEvent
1414         recorded.
1415 
1416         Errors:
1417             badComponentInstance    invalid scripting component instance
1418             errOSASystemError
1419             errOSAInvalidID
1420             errOSARecordingIsAlreadyOn
1421     }
1422 {
1423  *  OSAStopRecording()
1424  *
1425  *  Availability:
1426  *    Mac OS X:         in version 10.0 and later in Carbon.framework
1427  *    CarbonLib:        in CarbonLib 1.0 and later
1428  *    Non-Carbon CFM:   in AppleScriptLib 1.1 and later
1429  }
OSAStopRecordingnull1430 function OSAStopRecording( scriptingComponent: ComponentInstance; compiledScriptID: OSAID ): OSAError; external name '_OSAStopRecording';
1431 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
1432 
1433 
1434 {
1435         OSAComponentFunctionInline(kOSASelectStopRecording, 4);
1436         If compiledScriptID is not being recorded into or recording is not
1437         currently on, no error is returned.
1438 
1439         Errors:
1440             badComponentInstance    invalid scripting component instance
1441             errOSASystemError
1442             errOSAInvalidID
1443     }
1444 {*************************************************************************
1445     OSA Optional Convenience Interface
1446 **************************************************************************
1447     Scripting components that support the Convenience interface have the
1448     kOSASupportsConvenience bit set in their ComponentDescription.
1449 *************************************************************************}
1450 {
1451  *  OSALoadExecute()
1452  *
1453  *  Availability:
1454  *    Mac OS X:         in version 10.0 and later in Carbon.framework
1455  *    CarbonLib:        in CarbonLib 1.0 and later
1456  *    Non-Carbon CFM:   in AppleScriptLib 1.1 and later
1457  }
OSALoadExecutenull1458 function OSALoadExecute( scriptingComponent: ComponentInstance; const (*var*) scriptData: AEDesc; contextID: OSAID; modeFlags: SInt32; var resultingScriptValueID: OSAID ): OSAError; external name '_OSALoadExecute';
1459 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
1460 
1461 
1462 {
1463         OSAComponentFunctionInline(kOSASelectLoadExecute, 16);
1464         This routine is effectively equivalent to calling OSALoad followed by
1465         OSAExecute.  After execution, the compiled source is disposed.  Only the
1466         resulting value ID is retained.
1467 
1468         Errors:
1469             badComponentInstance        invalid scripting component instance
1470             errOSASystemError
1471             errOSABadStorageType:       scriptData not for this scripting component
1472             errOSACorruptData:          data seems to be corrupt
1473             errOSADataFormatObsolete    script data format is no longer supported
1474             errOSADataFormatTooNew      script data format is from a newer version
1475             errOSAInvalidID
1476             errOSAScriptError:          the executing script got an error
1477 
1478         ModeFlags:
1479             kOSAModeNeverInteract
1480             kOSAModeCanInteract
1481             kOSAModeAlwaysInteract
1482             kOSAModeCantSwitchLayer
1483             kOSAModeDontReconnect
1484             kOSAModeDoRecord
1485     }
1486 {
1487  *  OSACompileExecute()
1488  *
1489  *  Availability:
1490  *    Mac OS X:         in version 10.0 and later in Carbon.framework
1491  *    CarbonLib:        in CarbonLib 1.0 and later
1492  *    Non-Carbon CFM:   in AppleScriptLib 1.1 and later
1493  }
OSACompileExecutenull1494 function OSACompileExecute( scriptingComponent: ComponentInstance; const (*var*) sourceData: AEDesc; contextID: OSAID; modeFlags: SInt32; var resultingScriptValueID: OSAID ): OSAError; external name '_OSACompileExecute';
1495 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
1496 
1497 
1498 {
1499         OSAComponentFunctionInline(kOSASelectCompileExecute, 16);
1500         This routine is effectively equivalent to calling OSACompile followed by
1501         OSAExecute.  After execution, the compiled source is disposed.  Only the
1502         resulting value ID is retained.
1503 
1504         Errors:
1505             badComponentInstance    invalid scripting component instance
1506             errOSASystemError
1507             errAECoercionFail:      sourceData is not compilable
1508             errOSAScriptError:      sourceData was a bad script (syntax error)
1509             errOSAInvalidID:        previousAndResultingCompiledScriptID was not
1510                                     valid on input
1511             errOSAScriptError:      the executing script got an error
1512 
1513         ModeFlags:
1514             kOSAModeNeverInteract
1515             kOSAModeCanInteract
1516             kOSAModeAlwaysInteract
1517             kOSAModeCantSwitchLayer
1518             kOSAModeDontReconnect
1519             kOSAModeDoRecord
1520     }
1521 {
1522  *  OSADoScript()
1523  *
1524  *  Availability:
1525  *    Mac OS X:         in version 10.0 and later in Carbon.framework
1526  *    CarbonLib:        in CarbonLib 1.0 and later
1527  *    Non-Carbon CFM:   in AppleScriptLib 1.1 and later
1528  }
OSADoScriptnull1529 function OSADoScript( scriptingComponent: ComponentInstance; const (*var*) sourceData: AEDesc; contextID: OSAID; desiredType: DescType; modeFlags: SInt32; var resultingText: AEDesc ): OSAError; external name '_OSADoScript';
1530 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
1531 
1532 
1533 {
1534         OSAComponentFunctionInline(kOSASelectDoScript, 20);
1535         This routine is effectively equivalent to calling OSACompile followed by
1536         OSAExecute and then OSADisplay.  After execution, the compiled source
1537         and the resulting value are is disposed.  Only the resultingText
1538         descriptor is retained.  If a script error occur during processing, the
1539         resultingText gets the error message of the error, and errOSAScriptError
1540         is returned.  OSAScriptError may still be used to extract more
1541         information about the particular error.
1542 
1543         Errors:
1544             badComponentInstance    invalid scripting component instance
1545             errOSASystemError
1546             errAECoercionFail:      sourceData is not compilable or
1547                                     desiredType not supported by scripting component
1548             errOSAScriptError:      sourceData was a bad script (syntax error)
1549             errOSAInvalidID:        previousAndResultingCompiledScriptID was not
1550                                     valid on input
1551             errOSAScriptError:      the executing script got an error
1552 
1553         ModeFlags:
1554             kOSAModeNeverInteract
1555             kOSAModeCanInteract
1556             kOSAModeAlwaysInteract
1557             kOSAModeCantSwitchLayer
1558             kOSAModeDontReconnect
1559             kOSAModeDoRecord
1560             kOSAModeDisplayForHumans
1561     }
1562 {*************************************************************************
1563     OSA Optional Dialects Interface
1564 **************************************************************************
1565     Scripting components that support the Dialects interface have the
1566     kOSASupportsDialects bit set in their ComponentDescription.
1567 *************************************************************************}
1568 {
1569     These calls allows an scripting component that supports different dialects
1570     to dynamically switch between those dialects.  Although this interface is
1571     specified, the particular dialect codes are scripting component dependent.
1572 }
1573 {
1574  *  OSASetCurrentDialect()
1575  *
1576  *  Availability:
1577  *    Mac OS X:         in version 10.0 and later in Carbon.framework
1578  *    CarbonLib:        in CarbonLib 1.0 and later
1579  *    Non-Carbon CFM:   in AppleScriptLib 1.1 and later
1580  }
OSASetCurrentDialectnull1581 function OSASetCurrentDialect( scriptingComponent: ComponentInstance; dialectCode: SInt16 ): OSAError; external name '_OSASetCurrentDialect';
1582 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
1583 
1584 
1585 {
1586         OSAComponentFunctionInline(kOSASelectSetCurrentDialect, 2);
1587 
1588         Errors:
1589             badComponentInstance    invalid scripting component instance
1590             errOSASystemError
1591             errOSANoSuchDialect:    invalid dialectCode
1592     }
1593 {
1594  *  OSAGetCurrentDialect()
1595  *
1596  *  Availability:
1597  *    Mac OS X:         in version 10.0 and later in Carbon.framework
1598  *    CarbonLib:        in CarbonLib 1.0 and later
1599  *    Non-Carbon CFM:   in AppleScriptLib 1.1 and later
1600  }
OSAGetCurrentDialectnull1601 function OSAGetCurrentDialect( scriptingComponent: ComponentInstance; var resultingDialectCode: SInt16 ): OSAError; external name '_OSAGetCurrentDialect';
1602 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
1603 
1604 
1605 {
1606         OSAComponentFunctionInline(kOSASelectGetCurrentDialect, 4);
1607 
1608         Errors:
1609             badComponentInstance    invalid scripting component instance
1610             errOSASystemError
1611     }
1612 {
1613  *  OSAAvailableDialects()
1614  *
1615  *  Availability:
1616  *    Mac OS X:         in version 10.0 and later in Carbon.framework
1617  *    CarbonLib:        in CarbonLib 1.0 and later
1618  *    Non-Carbon CFM:   in AppleScriptLib 1.1 and later
1619  }
OSAAvailableDialectsnull1620 function OSAAvailableDialects( scriptingComponent: ComponentInstance; var resultingDialectInfoList: AEDesc ): OSAError; external name '_OSAAvailableDialects';
1621 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
1622 
1623 
1624 {
1625         OSAComponentFunctionInline(kOSASelectAvailableDialects, 4);
1626         This call return an AEList containing information about each of the
1627         currently available dialects of a scripting component.  Each item
1628         is an AERecord of typeOSADialectInfo that contains at least the fields
1629         keyOSADialectName, keyOSADialectCode, KeyOSADialectLangCode and
1630         keyOSADialectScriptCode.
1631 
1632         Errors:
1633             badComponentInstance    invalid scripting component instance
1634             errOSASystemError
1635     }
1636 {
1637  *  OSAGetDialectInfo()
1638  *
1639  *  Availability:
1640  *    Mac OS X:         in version 10.0 and later in Carbon.framework
1641  *    CarbonLib:        in CarbonLib 1.0 and later
1642  *    Non-Carbon CFM:   in AppleScriptLib 1.1 and later
1643  }
OSAGetDialectInfonull1644 function OSAGetDialectInfo( scriptingComponent: ComponentInstance; dialectCode: SInt16; selector: OSType; var resultingDialectInfo: AEDesc ): OSAError; external name '_OSAGetDialectInfo';
1645 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
1646 
1647 
1648 {
1649         OSAComponentFunctionInline(kOSASelectGetDialectInfo, 10);
1650         This call gives information about the specified dialect of a scripting
1651         component. It returns an AEDesc whose type depends on the selector
1652         specified. Available selectors are the same as the field keys for a
1653         dialect info record. The type of AEDesc returned is the same as the
1654         type of the field that has same key as the selector.
1655 
1656         Errors:
1657             badComponentInstance    invalid scripting component instance
1658             errOSASystemError
1659             errOSABadSelector
1660             errOSANoSuchDialect:    invalid dialectCode
1661     }
1662 {
1663  *  OSAAvailableDialectCodeList()
1664  *
1665  *  Availability:
1666  *    Mac OS X:         in version 10.0 and later in Carbon.framework
1667  *    CarbonLib:        in CarbonLib 1.0 and later
1668  *    Non-Carbon CFM:   in AppleScriptLib 1.1 and later
1669  }
OSAAvailableDialectCodeListnull1670 function OSAAvailableDialectCodeList( scriptingComponent: ComponentInstance; var resultingDialectCodeList: AEDesc ): OSAError; external name '_OSAAvailableDialectCodeList';
1671 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
1672 
1673 
1674 {
1675         OSAComponentFunctionInline(kOSASelectAvailableDialectCodeList, 4);
1676         This is alternative to OSAGetAvailableDialectCodeList. Use this call
1677         and  OSAGetDialectInfo to get information on dialects.
1678         This call return an AEList containing dialect code for each of the
1679         currently available dialects of a scripting component. Each dialect
1680         code is a short integer of type typeSInt16.
1681 
1682         Errors:
1683             badComponentInstance    invalid scripting component instance
1684             errOSASystemError
1685 
1686         Type of a dialect info record containing at least keyOSADialectName
1687         and keyOSADialectCode fields.
1688 
1689         keys for dialect info record, also used as selectors to OSAGetDialectInfo.
1690 
1691         Field of a typeOSADialectInfo record of typeChar.
1692         Field of a typeOSADialectInfo record of typeSInt16.
1693         Field of a typeOSADialectInfo record of typeSInt16.
1694         Field of a typeOSADialectInfo record of typeSInt16.
1695     }
1696 {*************************************************************************
1697     OSA Optional Event Handling Interface
1698 **************************************************************************
1699     Scripting components that support the Event Handling interface have the
1700     kOSASupportsEventHandling bit set in their ComponentDescription.
1701 *************************************************************************}
1702 {
1703  *  OSASetResumeDispatchProc()
1704  *
1705  *  Availability:
1706  *    Mac OS X:         in version 10.0 and later in Carbon.framework
1707  *    CarbonLib:        in CarbonLib 1.0 and later
1708  *    Non-Carbon CFM:   in AppleScriptLib 1.1 and later
1709  }
OSASetResumeDispatchProcnull1710 function OSASetResumeDispatchProc( scriptingComponent: ComponentInstance; resumeDispatchProc: AEEventHandlerUPP; refCon: SRefCon ): OSAError; external name '_OSASetResumeDispatchProc';
1711 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
1712 
1713 
1714 {
1715         OSAComponentFunctionInline(kOSASelectSetResumeDispatchProc, 8);
1716         This function is used to set the ResumeDispatchProc that will be used
1717         by OSAExecuteEvent and OSADoEvent if either no event handler can be
1718         found in the context, or the context event hander "continues" control
1719         onward. The two constants kOSAUseStandardDispatch and kOSANoDispatch
1720         may also be passed to this routine indicating that the handler registered
1721         in the application with AEInstallEventHandler should be used, or no
1722         dispatch should occur, respectively.
1723 
1724         Errors:
1725             badComponentInstance    invalid scripting component instance
1726             errOSASystemError
1727     }
1728 const
1729 	kOSAUseStandardDispatch = kAEUseStandardDispatch;
1730 
1731 {
1732         Special ResumeDispatchProc constant which may be passed to
1733         OSASetResumeDispatchProc indicating that the handler registered
1734         in the application with AEInstallEventHandler should be used.
1735 
1736         NOTE:   Had to remove the cast (AEEventHandlerUPP).  The C compiler
1737                 doesn't allow pointer types to be assigned to an enum.  All
1738                 constants must be assigned as enums to translate properly to
1739                 Pascal.
1740     }
1741 const
1742 	kOSANoDispatch = kAENoDispatch;
1743 
1744 {
1745         Special ResumeDispatchProc constant which may be passed to
1746         OSASetResumeDispatchProc indicating that no dispatch should occur.
1747 
1748         NOTE:   Had to remove the cast (AEEventHandlerUPP).  The C compiler
1749                 doesn't allow pointer types to be assigned to an enum.  All
1750                 constants must be assigned as enums to translate properly to
1751                 Pascal.
1752     }
1753 const
1754 	kOSADontUsePhac = $0001;
1755 
1756 {
1757         Special refCon constant that may be given to OSASetResumeDispatchProc
1758         only when kOSAUseStandardDispatch is used as the ResumeDispatchProc.
1759         This causes the standard dispatch to be performed, except the phac
1760         handler is not called.  This is useful during tinkerability, when
1761         the phac handler is used to lookup a context associated with an event's
1762         direct parameter, and call OSAExecuteEvent or OSADoEvent.  Failure to
1763         bypass the phac handler would result in an infinite loop.
1764     }
1765 {
1766  *  OSAGetResumeDispatchProc()
1767  *
1768  *  Availability:
1769  *    Mac OS X:         in version 10.0 and later in Carbon.framework
1770  *    CarbonLib:        in CarbonLib 1.0 and later
1771  *    Non-Carbon CFM:   in AppleScriptLib 1.1 and later
1772  }
OSAGetResumeDispatchProcnull1773 function OSAGetResumeDispatchProc( scriptingComponent: ComponentInstance; var resumeDispatchProc: AEEventHandlerUPP; var refCon: SRefCon ): OSAError; external name '_OSAGetResumeDispatchProc';
1774 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
1775 
1776 
1777 {
1778         OSAComponentFunctionInline(kOSASelectGetResumeDispatchProc, 8);
1779         Returns the registered ResumeDispatchProc.  If no ResumeDispatchProc has
1780         been registered, then kOSAUseStandardDispatch (the default) is returned.
1781 
1782         Errors:
1783             badComponentInstance    invalid scripting component instance
1784             errOSASystemError
1785     }
1786 {
1787  *  OSAExecuteEvent()
1788  *
1789  *  Availability:
1790  *    Mac OS X:         in version 10.0 and later in Carbon.framework
1791  *    CarbonLib:        in CarbonLib 1.0 and later
1792  *    Non-Carbon CFM:   in AppleScriptLib 1.1 and later
1793  }
OSAExecuteEventnull1794 function OSAExecuteEvent( scriptingComponent: ComponentInstance; const (*var*) theAppleEvent: AppleEvent; contextID: OSAID; modeFlags: SInt32; var resultingScriptValueID: OSAID ): OSAError; external name '_OSAExecuteEvent';
1795 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
1796 
1797 
1798 {
1799         OSAComponentFunctionInline(kOSASelectExecuteEvent, 16);
1800         This call is similar to OSAExecute except the initial command to
1801         execute comes in the form of an AppleEvent.  If the contextID
1802         defines any event handlers for that event, they are used to process
1803         the event.  If no event handler can be found in the context
1804         errAEEventNotHandled is returned.  If an event handler is found and
1805         the hander "continues" control onward, the ResumeDispatchProc
1806         (registered with OSASetResumeDispatchProc, above) is called given the
1807         AppleEvent.  The result is returned as a scriptValueID.
1808 
1809         Errors:
1810             badComponentInstance    invalid scripting component instance
1811             errOSASystemError
1812             errOSAInvalidID
1813             errOSAScriptError:      the executing script got an error
1814             errAEEventNotHandled:   no handler for event in contextID
1815 
1816         ModeFlags:
1817             kOSAModeNeverInteract
1818             kOSAModeCanInteract
1819             kOSAModeAlwaysInteract
1820             kOSAModeCantSwitchLayer
1821             kOSAModeDontReconnect
1822             kOSAModeDoRecord
1823     }
1824 {
1825  *  OSADoEvent()
1826  *
1827  *  Availability:
1828  *    Mac OS X:         in version 10.0 and later in Carbon.framework
1829  *    CarbonLib:        in CarbonLib 1.0 and later
1830  *    Non-Carbon CFM:   in AppleScriptLib 1.1 and later
1831  }
OSADoEventnull1832 function OSADoEvent( scriptingComponent: ComponentInstance; const (*var*) theAppleEvent: AppleEvent; contextID: OSAID; modeFlags: SInt32; var reply: AppleEvent ): OSAError; external name '_OSADoEvent';
1833 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
1834 
1835 
1836 {
1837         OSAComponentFunctionInline(kOSASelectDoEvent, 16);
1838         This call is similar to OSADoScript except the initial command to
1839         execute comes in the form of an AppleEvent, and the result is an
1840         AppleEvent reply record.  If the contextID defines any event handlers
1841         for that event, they are used to process the event.  If no event handler
1842         can be found in the context errAEEventNotHandled is returned.  If an
1843         event handler is found and the hander "continues" control onward, the
1844         ResumeDispatchProc (registered with OSASetResumeDispatchProc, above) is
1845         called given the AppleEvent.  The result is returned in the form of an
1846         AppleEvent reply descriptor. If at any time the script gets an error, or
1847         if the ResumeDispatchProc returns a reply event indicating an error,
1848         then the OSADoEvent call itself returns an error reply (i.e. OSADoEvent
1849         should never return errOSAScriptError).  Any error result returned by
1850         the ResumeDispatchProc will be returned by OSADoEvent.
1851 
1852         Errors:
1853             badComponentInstance    invalid scripting component instance
1854             errOSASystemError
1855             errOSAInvalidID
1856             errAEEventNotHandled:   no handler for event in contextID
1857 
1858         ModeFlags:
1859             kOSAModeNeverInteract
1860             kOSAModeCanInteract
1861             kOSAModeAlwaysInteract
1862             kOSAModeCantSwitchLayer
1863             kOSAModeDontReconnect
1864             kOSAModeDoRecord
1865     }
1866 {
1867  *  OSAMakeContext()
1868  *
1869  *  Availability:
1870  *    Mac OS X:         in version 10.0 and later in Carbon.framework
1871  *    CarbonLib:        in CarbonLib 1.0 and later
1872  *    Non-Carbon CFM:   in AppleScriptLib 1.1 and later
1873  }
OSAMakeContextnull1874 function OSAMakeContext( scriptingComponent: ComponentInstance; const (*var*) contextName: AEDesc; parentContext: OSAID; var resultingContextID: OSAID ): OSAError; external name '_OSAMakeContext';
1875 (* AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER *)
1876 
1877 
1878 {
1879         OSAComponentFunctionInline(kOSASelectMakeContext, 12);
1880         Makes a new empty context which may be passed to OSAExecute or
1881         OSAExecuteEvent.  If contextName is typeNull, an unnamed context is
1882         created. If parentContext is kOSANullScript then the resulting context
1883         does not inherit bindings from any other context.
1884 
1885         Errors:
1886             badComponentInstance    invalid scripting component instance
1887             errOSASystemError
1888             errOSAInvalidID
1889             errAECoercionFail:      contextName is invalid
1890     }
1891 
1892 
1893 {*************************************************************************
1894     OSA Script File Interface
1895 *************************************************************************}
1896 {
1897  *  OSAGetScriptDataFromURL()
1898  *
1899  *  Availability:
1900  *    Mac OS X:         in version 10.6 and later in Carbon.framework
1901  *    CarbonLib:        not available
1902  *    Non-Carbon CFM:   not available
1903  }
OSAGetScriptDataFromURLnull1904 function OSAGetScriptDataFromURL( scriptURL: CFURLRef; storable: BooleanPtr { can be NULL }; modeFlags: SInt32; var resultingScriptData: AEDesc ): OSAError; external name '_OSAGetScriptDataFromURL';
1905 (* AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER *)
1906 
1907 
1908 {
1909         This routine reads script data from a URL into a descriptor. The
1910         URL may refer to a compiled script, script application, or source
1911         text file. If "scriptURL" refers to a text file, the resulting data
1912         is the source text. If "storable" is non-NULL, it will be set to
1913         indicate whether a script can be stored into the script file using
1914         OSAStoreFile().
1915 
1916         You may use OSALoadScriptData() with the resulting descriptor to
1917         load the script into a component instance. Doing this in two steps
1918         affords the opportunity to examine the script data with
1919         OSAGetStorageType() and select a component instance.
1920 
1921         Errors:
1922             errOSASystemError
1923             File system errors.
1924 
1925         ModeFlags:
1926             No mode flags are supported at this time.
1927     }
1928 {
1929  *  OSALoadScriptData()
1930  *
1931  *  Availability:
1932  *    Mac OS X:         in version 10.6 and later in Carbon.framework
1933  *    CarbonLib:        not available
1934  *    Non-Carbon CFM:   not available
1935  }
OSALoadScriptDatanull1936 function OSALoadScriptData( scriptingComponent: ComponentInstance; const (*var*) scriptData: AEDesc; fromURL: CFURLRef { can be NULL }; modeFlags: SInt32; var resultingScriptID: OSAID ): OSAError; external name '_OSALoadScriptData';
1937 (* AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER *)
1938 
1939 
1940 {
1941         This routine loads script data from a descriptor into the specified
1942         scripting component. If "scriptData" is source, it will be compiled.
1943         If "fromURL" is non-NULL, it indicates the file from which the data
1944         was read.
1945 
1946         Errors:
1947             See OSALoad() and OSACompile().
1948 
1949         ModeFlags:
1950             See OSALoad() and OSACompile().
1951     }
1952 {
1953  *  OSALoadFile()
1954  *
1955  *  Availability:
1956  *    Mac OS X:         in version 10.3 and later in Carbon.framework
1957  *    CarbonLib:        not available
1958  *    Non-Carbon CFM:   not available
1959  }
OSALoadFilenull1960 function OSALoadFile( scriptingComponent: ComponentInstance; const (*var*) scriptFile: FSRef; storable: BooleanPtr { can be NULL }; modeFlags: SInt32; var resultingScriptID: OSAID ): OSAError; external name '_OSALoadFile';
1961 (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
1962 
1963 
1964 {
1965         This routine loads a script into the specified scripting component.
1966         If "scriptFile" is a text file, the script will be compiled. If
1967         "storable" is non-NULL, it will be set to indicate whether a
1968         script can be stored into the script file using OSAStoreFile().
1969 
1970         Errors:
1971             See OSALoad() and OSACompile().
1972 
1973         ModeFlags:
1974             See OSALoad() and OSACompile().
1975     }
1976 {
1977  *  OSAStoreFile()
1978  *
1979  *  Availability:
1980  *    Mac OS X:         in version 10.3 and later in Carbon.framework
1981  *    CarbonLib:        not available
1982  *    Non-Carbon CFM:   not available
1983  }
OSAStoreFilenull1984 function OSAStoreFile( scriptingComponent: ComponentInstance; scriptID: OSAID; desiredType: DescType; modeFlags: SInt32; const (*var*) scriptFile: FSRef ): OSAError; external name '_OSAStoreFile';
1985 (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
1986 
1987 
1988 {
1989         This routine stores a script into the specified file.
1990 
1991         Errors:
1992             See OSAStore().
1993 
1994         ModeFlags:
1995             See OSAStore().
1996     }
1997 {
1998  *  OSALoadExecuteFile()
1999  *
2000  *  Availability:
2001  *    Mac OS X:         in version 10.3 and later in Carbon.framework
2002  *    CarbonLib:        not available
2003  *    Non-Carbon CFM:   not available
2004  }
OSALoadExecuteFilenull2005 function OSALoadExecuteFile( scriptingComponent: ComponentInstance; const (*var*) scriptFile: FSRef; contextID: OSAID; modeFlags: SInt32; var resultingScriptValueID: OSAID ): OSAError; external name '_OSALoadExecuteFile';
2006 (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
2007 
2008 
2009 {
2010         This routine is effectively equivalent to calling OSALoadFile followed by
2011         OSAExecute.  After execution, the compiled source is disposed.  Only the
2012         resulting value ID is retained.
2013 
2014         Errors:
2015             See OSALoadExecute() and OSACompileExecute().
2016 
2017         ModeFlags:
2018             See OSALoadExecute() and OSACompileExecute().
2019     }
2020 {
2021  *  OSADoScriptFile()
2022  *
2023  *  Availability:
2024  *    Mac OS X:         in version 10.3 and later in Carbon.framework
2025  *    CarbonLib:        not available
2026  *    Non-Carbon CFM:   not available
2027  }
OSADoScriptFilenull2028 function OSADoScriptFile( scriptingComponent: ComponentInstance; const (*var*) scriptFile: FSRef; contextID: OSAID; desiredType: DescType; modeFlags: SInt32; var resultingText: AEDesc ): OSAError; external name '_OSADoScriptFile';
2029 (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
2030 
2031 
2032 {
2033         This routine is effectively equivalent to calling OSALoadFile, followed by
2034         OSAExecute, OSADisplay, and then OSAStoreFile if the script has persistent
2035         properties.  After execution, the compiled source and the resulting value are
2036         disposed.  Only the resultingText descriptor is retained.  If a script error
2037         occurs during processing, the resultingText gets the error message of the error,
2038         and errOSAScriptError is returned.  OSAScriptError may still be used to extract
2039         more information about the particular error.
2040 
2041         Errors:
2042             See OSALoad(), OSACompile(), OSAExecute(), OSADisplay(), and OSAStore().
2043 
2044         ModeFlags:
2045             See OSALoad(), OSACompile(), OSAExecute(), and OSADisplay().
2046     }
2047 
2048 {$endc} {TARGET_OS_MAC}
2049 {$ifc not defined MACOSALLINCLUDE or not MACOSALLINCLUDE}
2050 
2051 end.
2052 {$endc} {not MACOSALLINCLUDE}
2053