Squeak Class Documentation category index | class index  
 
Applescript
  category: VMConstruction-Applescript
  superclass: Object
  subclasses:

I represent a Squeak front-end to Applescript. My instances represent either compiled scripts, contexts or both. My instances maintain separately the original source code from which I was compiled, and then a CompiledApplescript corresponding to that source code in its "current state." I provide facilities for executing my scripts, alone or in various contexts, as well as for recompiling my script to restore the script to its initial state (if the script bears context information).

Examples:

To execute some text:

Applescript doIt: 'beep 3'

To compile code into a script object (for MUCH faster execution of repeated tasks, and to maintain state between execution), and then to execute the code:

|aVariable|
aVariable _ Applescript on: '
property sam: 0
set sam to sam + 1
beep sam'.
aVariable doIt

Other. somewhat more general operations

Applescript doIt: aString mode: anInteger
Applescript doIt: aString in: aContext mode: anInteger

s _ Applescript on: aString mode: anInteger

s doItMode: anInteger
s doItIn: aContext
s doItIn: aContext mode: anInteger
s recompile

Also note the examples in the class side of me.

instance methods
  accessing
  compiledScript
modeDocumentation
source

  interpreting
  asContextDoOSAID:mode:
doIt
doItIn:
doItIn:mode:
doItMode:

  printing
  printOn:

  private
  doAsOSAID:
doAsOSAID:onErrorDo:
on:
on:mode:
on:mode:onErrorDo:

  recompiling
  recompile
recompileMode:

  testing
  hasSource
isCompiledScript
isScriptContext
isScriptValue
timesModified

class methods
  generic scripting component
  doIt:
doIt:in:mode:
doIt:mode:
generic
lastError

  initialize-release
  initialize
reopen
startUp

  instance creation
  on:
on:mode:

  sample scripts
  beep:
browse:
distill
mandatoryDemo
playQT4Movie
say:
selectFile
selectFolder
silly
sillyButtons
sillyDialog
sillyList
sleep
with:say:

instance methods
  accessing top  
 

compiledScript


 

modeDocumentation


16r0000 kOSAModeNull (kOSANullMode)
16r0001 kOSAModePreventGetSource
16r0002 kOSAModeCompileIntoContext
16r0004 kOSAModeAugmentContext
16r0008 kOSAModeDisplayForHumans
kOSAModeNeverInteract
kOSAModeCanInteract
kOSAModeAlwaysInteract
kOSAModeDontReconnect
16r0040 kOSAModeCantSwitchLayer
16r1000 kOSAModeDoRecord
16r4000 kOSAModeDontStoreParent


 

source


  interpreting top  
 

asContextDoOSAID:mode:

Answer a string corresponding to the result of executing preloaded scptOSAID using my compiledScript as the context, and using mode anInteger. As a side-effect, update my script information as necessary. (This routine will not update any stored versions of scptOSAID


 

doIt

Answer a string corresponding to the result of executing my script in the default context. mode 0. As a side-effect, update my script information as necessary.


 

doItIn:

Answer a string corresponding to the result of executing my script in aContext. mode 0. As a side-effect, update my script and the aContext information as necessary.


 

doItIn:mode:

Answer a string corresponding to the result of executing my script in aContext. mode anInteger. As a side-effect, update my script and the aContext information as necessary.


 

doItMode:

Answer a string corresponding to the result of executing my script in the default context. mode anInteger. As a side-effect, update my script information as necessary.


  printing top  
 

printOn:

Append to the argument, aStream, a sequence of characters that
identifies the receiver.


  private top  
 

doAsOSAID:

Answer the result of performing aBlock on my compiledScript, converted to OSAID form. As a side-effect, update compiledScript to conform to any changes that may have occurred inside the Applescript scripting component.


 

doAsOSAID:onErrorDo:

Answer the result of performing aBlock on my compiledScript, converted to OSAID form. As a side-effect, update compiledScript to conform to any changes that may have occurred inside the Applescript scripting component.


 

on:


 

on:mode:


 

on:mode:onErrorDo:


  recompiling top  
 

recompile


 

recompileMode:


  testing top  
 

hasSource


 

isCompiledScript


 

isScriptContext


 

isScriptValue


 

timesModified


class methods
  generic scripting component top  
 

doIt:


 

doIt:in:mode:


 

doIt:mode:


 

generic

Answer an ApplescriptInstance (Applescript Generic Scripting Component) that is guaranteed to be active from startUp, but is not (at present) guaranteed to be identical across startups. Additional instances can be created for multi-threaded applications by using ApplescriptInstance.


 

lastError


  initialize-release top  
 

initialize

Object initialize


 

reopen


 

startUp

This message is sent to registered classes when the system is coming up.


  instance creation top  
 

on:


 

on:mode:


  sample scripts top  
 

beep:

Beep n times


 

browse:

Open Microsoft's Web Browser to a page


 

distill


 

mandatoryDemo

A mandatory first script


 

playQT4Movie

Demonstrate Access to Quicktime


 

say:

Speak the string


 

selectFile

Harness Apple's select file dialog for Squeak


 

selectFolder

Harness Apple's select Folder dialog for Squeak


 

silly


 

sillyButtons

A silly Apple GUI demo


 

sillyDialog

A silly Apple GUI demo


 

sillyList

A silly Apple GUI demo


 

sleep


 

with:say:

Speak the string