Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: Interapplication Communication /
Chapter 10 - Scripting Components / Scripting Components Reference
AppleScript Component Routines / Initializing AppleScript


ASInit

You can use the ASInit function to initialize the AppleScript component.

FUNCTION ASInit (scriptingComponent: ComponentInstance; 
                 modeFlags: LongInt; 
                 minStackSize: LongInt; 
                 preferredStackSize: LongInt; 
                 maxStackSize: LongInt;
                 minHeapSize: LongInt;
                 preferredHeapSize: LongInt;
                 maxHeapSize: LongInt): OSAError;
scriptingComponent
A component instance created by a prior call to the Component Manager function OpenDefaultComponent or OpenComponent (see page 10-4).
modeFlags
Reserved for future use. Set to kOSAModeNull.
minStackSize
The minimum size for the portion of the application's heap used by the AppleScript component's application-specific stack.
preferredStackSize
The preferred size for the portion of the application's heap used by the AppleScript component's application-specific stack.
maxStackSize
The maximum size for the portion of the application's heap used by the AppleScript component's application-specific stack.
minHeapSize
The minimum size for the portion of the application's heap used by the AppleScript component's application-specific heap.
preferredHeapSize
The preferred size for the portion of the application's heap used by the AppleScript component's application-specific heap.
maxHeapSize
The maximum size for the portion of the application's heap used by the AppleScript component's application-specific heap.
DESCRIPTION
Your application should set the modeFlags parameter to kOSAModeNull. You can use the other parameters to specify memory sizes for the portion of your application's heap used by the AppleScript component for its application-specific heap and stack. If your application sets any of these parameters to 0, the AppleScript component uses the corresponding value in your application's 'scsz' resource. If that value is also set to 0, the AppleScript component uses the corresponding default value:

CONST
   kASDefaultMinStackSize           = 1 * 1024;
   kASDefaultPreferredStackSize     = 4 * 1024;
   kASDefaultMaxStackSize           = 16 * 1024;
   kASDefaultMinHeapSize            = 4 * 1024;
   kASDefaultPreferredHeapSize      = 64 * 1024;
   kASDefaultMaxHeapSize            = 32 * 1024 * 1024;
If your application doesn't call ASInit explicitly, the AppleScript component initializes itself using the values specified in your application's 'scsz' resource when your application first calls any scripting component routine. If any of these values are set to 0, the AppleScript component uses the corresponding default value.

If your application doesn't call ASInit explicitly and doesn't call any scripting component routines, the AppleScript component will not be initialized. For example, if your application opens and closes the AppleScript component or calls Component Manager routines such as OpenDefaultComponent or FindNextComponent but doesn't call any scripting component routines, the AppleScript component is not initialized.

When the AppleScript component is initialized, it uses your application's high memory to create the blocks that it locks for its own use. If you expect to lock any portion of high memory for a shorter time than you expect the AppleScript component to be available, you should call ASInit explicitly.

RESULT CODES
noErr0No error
errOSASystemError-1750General scripting system error
badComponentInstance$80008001Invalid component instance

Previous Book Contents Book Index Next

© Apple Computer, Inc.
7 JUL 1996