際際滷

際際滷Share a Scribd company logo
StepTalk  Stefan Urbanek, 2005
StepTalk Scripting Introduction
StepTalk  Stefan Urbanek, 2005
Contents
Scripting session
Remote scripting
StepTalk  Stefan Urbanek, 2005
StepTalk Scripting Introduction - Legend
Human
Bi-directional relationship
Relationship
Temporary relationship
Script
User interface, application, window
An object
Model object Controller object
StepTalk  Stefan Urbanek, 2005
Scripting Session
How to create a scripting session
and how to communicate with objects using scripts
StepTalk  Stefan Urbanek, 2005
Before StepTalk Scripting
User
text
window
image
application
currentDocument
User thinks of and sees:
current document, active
window, application, image
Advanced user would like to talk to those
objects, automate several tasks or create
complex tasks that would take lots of time
if done manually.
?
?
?
... Therefore the developer has to map
entities, that user needs to handle, to real
objects inside the application.
1
2 3
?
Advanced user
Developer
StepTalk  Stefan Urbanek, 2005
Before StepTalk Scripting
Application
Each user-visible entity is
somehow represented inside
the application. Let us assume
that each entity on the screen
is a presentation of an object in
the application.
4
The developer prepares a mapping
between words and objects inside a given
context.
5
StepTalk  Stefan Urbanek, 2005
StepTalk Scripting
STEnvironment
execution context
Objects
accessible from scripts
object dictionary (NSDictionary)
Developer knows objects what are available for
scripting. He creates an environment (conversation
context). This context will let the computer resolve
object names. In other words, computer will know, what
is meant by 'document', 'application' or 'selectedObject'.
STEnvironment is a context that
defines what is behind object names.
User can create various environments,
one for whole application, one for each
document, etc. In the environment
objects and classes from frameworks
or modules can be included too. Also
object finders can be associated for
finding unknown objects or distant
objects.
6
Developer
StepTalk  Stefan Urbanek, 2005
StepTalk Scripting
STEnvironment
execution context
Objects
accessible from scripts
object dictionary (NSDictionary)
script (NSString)
Script is written in any StepTalk
language. The user should specify
what language the script is written in.
Script can reference objects by their
name. Objects are then resolved
according to the associated execution
context (environment)
Developer loads or creates a script  small program in
user's preferred programming language. User should
know in what language the script is written in.
7
StepTalk  Stefan Urbanek, 2005
StepTalk Scripting
STEnvironment
execution context
STConversation
Objects
accessible from scripts
object dictionary
script (NSString)
STConversation is main object for
talking to objects by scripts. It should
be associated with a context
(environment). For each execution an
engine is created according to a script
language. User can have as many
conversations as he likes.
Ok, now we are ready to 'talk to objects', so the
developer creates a conversation object. He makes
sure, that the conversation context (environment) is
known  that means that the conversation object is
connected to appropriate environment object.
8
StepTalk  Stefan Urbanek, 2005
STEngine
StepTalk Scripting
STEnvironment
execution context
STConversation
Objects
accessible from scripts
object dictionary
script (NSString)
Engine exists temporarily while code
execution. It executes the code inside
the context (environment). Life of
STEngine is undefined and depends
on STConversation implementation.
That means that for each execution
new engine is created or they can be
recycled.
An engine is created or reused for a given language.
There is different engine for Smalltalk language or Ruby
language, for example. Engine is set up to operate
inside the conversation context (environment). Then the
script is executed by the engine.
User says: Execute!
Each object referenced by a name is resolved
through context object dictionary.
9
10
StepTalk  Stefan Urbanek, 2005
Remote Scripting
Scripting in semi-persistent shared environment
StepTalk  Stefan Urbanek, 2005
Before Remote Scripting
User wants to talk to objects more than once in
different times and from different places (processes
or applications). He needs the scripting environment
with its objects to stay somewhere and to be ready
for communication. Therefore he needs semi-
persistent environment where objects are not
destroyed after each conversation and can be
reused.
1a
STEnvironment
with objects
Another user wants to bind partial tasks from several
applications into a single, larger task. Therefore he
needs a shared environment for all involved
applications.
1b
STEnvironment
with objects
StepTalk  Stefan Urbanek, 2005
Semi-persistent Scripting Environment Process
Remote Scripting
STEnvironment
execution context
STEnvironment
Process
Semi-persistent Scripting Environment process
is created. The environment will be referenced by its
name. The process contains single scripting
environment object that would serve as execution
context for future scripts.
2
STEnvrionmentProcess is created by
launching the stenvironment tool.
Currently a Distributed Objects server
object is registered that represents the
process. To the server conversation
connections are going to be created.
StepTalk  Stefan Urbanek, 2005
Semi-persistent Scripting Environment ProcessApplication 1
Remote Scripting
STEnvironment
execution context
Application 1 Conversation
STConversation
STEnvironment
Process
STDistant-
Conversation
User creates a distant
conversation object and specifies
a name of the distant environment
in which conversation is going to
happen.
3
The distant conversation object connects
to the named scripting environment
process and creates a connection. A new
conversation object is created in the
environment process.
4
StepTalk  Stefan Urbanek, 2005
Semi-persistent Scripting Environment ProcessApplication 1
Remote Scripting
STEnvironment
execution context
Application 1 Conversation
STConversation
STContext
conversation context
STEnvironment
Process
STDistant-
Conversation Conversation context is
created. The environment
(execution context) is set to be
the parent of the conversation
context.
5
Proxy of the freshly created
conversation object is vended
through the Distributed Objects
connection back to the distant
conversation on the
application side.
6
Note: The mentioned creation and use of
conversation context object is not yet
implemented. The conversation connects directly to
the environment object therefore user can not have
conversation specific objects, everything is shared.
StepTalk  Stefan Urbanek, 2005
Semi-persistent Scripting Environment Process
Application 2
Application 1
Remote Scripting
STEnvironment
execution context
Application 1 Conversation
STConversation
STContext
conversation context
STEnvironment
Process
Application 2 Conversation
STConversation
STContext
conversation context
STDistant-
Conversation
STDistant-
Conversation
Another application can connect to the
same environment and share it. Or the first
application can close the conversation and
reopen it later.
7

More Related Content

StepTalk Introduction

  • 1. StepTalk Stefan Urbanek, 2005 StepTalk Scripting Introduction
  • 2. StepTalk Stefan Urbanek, 2005 Contents Scripting session Remote scripting
  • 3. StepTalk Stefan Urbanek, 2005 StepTalk Scripting Introduction - Legend Human Bi-directional relationship Relationship Temporary relationship Script User interface, application, window An object Model object Controller object
  • 4. StepTalk Stefan Urbanek, 2005 Scripting Session How to create a scripting session and how to communicate with objects using scripts
  • 5. StepTalk Stefan Urbanek, 2005 Before StepTalk Scripting User text window image application currentDocument User thinks of and sees: current document, active window, application, image Advanced user would like to talk to those objects, automate several tasks or create complex tasks that would take lots of time if done manually. ? ? ? ... Therefore the developer has to map entities, that user needs to handle, to real objects inside the application. 1 2 3 ? Advanced user Developer
  • 6. StepTalk Stefan Urbanek, 2005 Before StepTalk Scripting Application Each user-visible entity is somehow represented inside the application. Let us assume that each entity on the screen is a presentation of an object in the application. 4 The developer prepares a mapping between words and objects inside a given context. 5
  • 7. StepTalk Stefan Urbanek, 2005 StepTalk Scripting STEnvironment execution context Objects accessible from scripts object dictionary (NSDictionary) Developer knows objects what are available for scripting. He creates an environment (conversation context). This context will let the computer resolve object names. In other words, computer will know, what is meant by 'document', 'application' or 'selectedObject'. STEnvironment is a context that defines what is behind object names. User can create various environments, one for whole application, one for each document, etc. In the environment objects and classes from frameworks or modules can be included too. Also object finders can be associated for finding unknown objects or distant objects. 6 Developer
  • 8. StepTalk Stefan Urbanek, 2005 StepTalk Scripting STEnvironment execution context Objects accessible from scripts object dictionary (NSDictionary) script (NSString) Script is written in any StepTalk language. The user should specify what language the script is written in. Script can reference objects by their name. Objects are then resolved according to the associated execution context (environment) Developer loads or creates a script small program in user's preferred programming language. User should know in what language the script is written in. 7
  • 9. StepTalk Stefan Urbanek, 2005 StepTalk Scripting STEnvironment execution context STConversation Objects accessible from scripts object dictionary script (NSString) STConversation is main object for talking to objects by scripts. It should be associated with a context (environment). For each execution an engine is created according to a script language. User can have as many conversations as he likes. Ok, now we are ready to 'talk to objects', so the developer creates a conversation object. He makes sure, that the conversation context (environment) is known that means that the conversation object is connected to appropriate environment object. 8
  • 10. StepTalk Stefan Urbanek, 2005 STEngine StepTalk Scripting STEnvironment execution context STConversation Objects accessible from scripts object dictionary script (NSString) Engine exists temporarily while code execution. It executes the code inside the context (environment). Life of STEngine is undefined and depends on STConversation implementation. That means that for each execution new engine is created or they can be recycled. An engine is created or reused for a given language. There is different engine for Smalltalk language or Ruby language, for example. Engine is set up to operate inside the conversation context (environment). Then the script is executed by the engine. User says: Execute! Each object referenced by a name is resolved through context object dictionary. 9 10
  • 11. StepTalk Stefan Urbanek, 2005 Remote Scripting Scripting in semi-persistent shared environment
  • 12. StepTalk Stefan Urbanek, 2005 Before Remote Scripting User wants to talk to objects more than once in different times and from different places (processes or applications). He needs the scripting environment with its objects to stay somewhere and to be ready for communication. Therefore he needs semi- persistent environment where objects are not destroyed after each conversation and can be reused. 1a STEnvironment with objects Another user wants to bind partial tasks from several applications into a single, larger task. Therefore he needs a shared environment for all involved applications. 1b STEnvironment with objects
  • 13. StepTalk Stefan Urbanek, 2005 Semi-persistent Scripting Environment Process Remote Scripting STEnvironment execution context STEnvironment Process Semi-persistent Scripting Environment process is created. The environment will be referenced by its name. The process contains single scripting environment object that would serve as execution context for future scripts. 2 STEnvrionmentProcess is created by launching the stenvironment tool. Currently a Distributed Objects server object is registered that represents the process. To the server conversation connections are going to be created.
  • 14. StepTalk Stefan Urbanek, 2005 Semi-persistent Scripting Environment ProcessApplication 1 Remote Scripting STEnvironment execution context Application 1 Conversation STConversation STEnvironment Process STDistant- Conversation User creates a distant conversation object and specifies a name of the distant environment in which conversation is going to happen. 3 The distant conversation object connects to the named scripting environment process and creates a connection. A new conversation object is created in the environment process. 4
  • 15. StepTalk Stefan Urbanek, 2005 Semi-persistent Scripting Environment ProcessApplication 1 Remote Scripting STEnvironment execution context Application 1 Conversation STConversation STContext conversation context STEnvironment Process STDistant- Conversation Conversation context is created. The environment (execution context) is set to be the parent of the conversation context. 5 Proxy of the freshly created conversation object is vended through the Distributed Objects connection back to the distant conversation on the application side. 6 Note: The mentioned creation and use of conversation context object is not yet implemented. The conversation connects directly to the environment object therefore user can not have conversation specific objects, everything is shared.
  • 16. StepTalk Stefan Urbanek, 2005 Semi-persistent Scripting Environment Process Application 2 Application 1 Remote Scripting STEnvironment execution context Application 1 Conversation STConversation STContext conversation context STEnvironment Process Application 2 Conversation STConversation STContext conversation context STDistant- Conversation STDistant- Conversation Another application can connect to the same environment and share it. Or the first application can close the conversation and reopen it later. 7