public interface ScriptManager
T-Plan Robot Enterprise, (C) 2009-2022 T-Plan Limited. All rights reserved.
Modifier and Type | Field and Description |
---|---|
static String |
OUTPUT_DISABLED_FLAG |
Modifier and Type | Method and Description |
---|---|
void |
addCommandListener(CommandListener listener)
Add a command listener to all available command handlers.
|
void |
addCommandListener(Reference<CommandListener> listener)
Add a command listener through a reference to all available command
handlers.
|
void |
addScriptListener(Reference<ScriptListener> listener)
Add a script listener through a reference.
|
void |
addScriptListener(ScriptListener listener)
Add a script listener.
|
String |
assembleFileName(String fileName,
ScriptingContext repository,
String variableName)
Resolve a file path with regard to a variable which is expected to
contain a directory.
|
ScriptingContext |
createDefaultContext()
Create a scripting context instance and populate it with default data.
|
ScriptingContext |
createDefaultContext(TestScriptInterpret ti)
Create a scripting context instance and populate it with default data.
|
void |
destroy()
Destroy the script manager.
|
PauseRequestException |
fireScriptEvent(ScriptEvent evt)
Fire a script event to all registered script listeners.
|
List<Schedule> |
getActiveSchedules()
Get the list of active (opened) schedules.
|
List<TestScriptInterpret> |
getActiveTestScripts()
Get active test script interprets, i.e.
|
RemoteDesktopClient |
getClient()
Get the currently used desktop client.
|
TestScriptInterpret |
getClientOwner(RemoteDesktopClient client)
Get owner of a desktop client instance.
|
Map<String,String> |
getCliVariables()
Get the map of script variables overriden through the -v/--variable CLI
option.
|
Map<String,CommandHandler> |
getCommandHandlers()
Get the map of available command handlers.
|
TestScriptInterpret |
getDocumentOwner(Document doc)
Get owner of a document.
|
Object |
getDynamicVariableValue(String name,
Map cliVars,
Map variables,
TestWrapper wr,
ScriptingContext ctx)
Get dynamic value for a variable (if defined), such as the current time
or randiom number.
|
ScriptedExecutable |
getExecutingObject()
Get the topmost currently executing object (schedule or test script).
|
List<Schedule> |
getExecutingSchedules()
Get the list of executing schedules.
|
List<TestScriptInterpret> |
getExecutingTestScripts()
Get list of test script interprets which are being executed.
|
List<TestScriptInterpret> |
getRunningTestScripts()
Get list of test script interprets which are running.
|
Map<String,Object> |
getScriptingParams()
Get the map of scripting parameters passed from the CLI, such as
-r/--run, --fromlabel, --tolabel and --nooutput.
|
Object |
getScriptToRun()
Get a script to be executed which was passed from CLI.
|
Integer |
getScriptToRunRepeatCount()
Find out how many times the script returned by the
getScriptToRun() is to be executed. |
boolean |
hasActiveSchedule()
Find out if there's at least one active (opened) schedule.
|
boolean |
isConsoleMode()
Find out whether we run in the GUI or console mode.
|
Object |
removeCommandListener(CommandListener listener)
Remove a command listener from all available command handlers.
|
void |
removeInterpret(TestScriptInterpret interpret)
Remove an interpret from the internal list of active interprets.
|
Object |
removeScriptListener(ScriptListener listener)
Remove a script listener.
|
void |
setClient(RemoteDesktopClient client)
Set the currently used desktop client.
|
void |
setClient(RemoteDesktopClient client,
ScriptingContext context)
Set the currently used desktop client.The context argument is usually
null and it is only populated by the Connect command to indicate that the
client was created through a running script.
|
void |
setCliVariables(Map<String,String> cliVars)
Set the map of CLI variables.
|
void |
setDesktopViewer(com.tplan.robot.gui.DesktopViewer fbPanel)
Associate the script manager with a desktop viewer GUI component.
|
void |
setOwningSchedule(Schedule s)
Set the workitem (former "schedule") that is using this script manager.
|
void |
setScriptToRun(Object scriptToRun)
Set the script to be executed after the tool startup.
|
void |
setScriptToRunRepeatCount(int count)
Set how many times to execute the script returned by the
getScriptToRun() . |
static final String OUTPUT_DISABLED_FLAG
Map<String,CommandHandler> getCommandHandlers()
Object getScriptToRun()
void setScriptToRun(Object scriptToRun)
scriptToRun
- a script to be executed automatically.Integer getScriptToRunRepeatCount()
getScriptToRun()
is to be executed.void setScriptToRunRepeatCount(int count)
getScriptToRun()
.count
- number of required executions.ScriptingContext createDefaultContext()
ScriptingContext createDefaultContext(TestScriptInterpret ti)
createDefaultContext()
one to ensure that the
default output and template paths get correctly initialized to the
project ones.ti
- test script interpret owning the context.Map<String,String> getCliVariables()
void setCliVariables(Map<String,String> cliVars)
cliVars
- map of variables to override.void setDesktopViewer(com.tplan.robot.gui.DesktopViewer fbPanel)
fbPanel
- a desktop viewer component.void setClient(RemoteDesktopClient client)
client
- a desktop client.void setClient(RemoteDesktopClient client, ScriptingContext context)
client
- a desktop client.context
- a script context.RemoteDesktopClient getClient()
Map<String,Object> getScriptingParams()
void addScriptListener(ScriptListener listener)
listener
- a script listener.void addScriptListener(Reference<ScriptListener> listener)
listener
- a script listener.Object removeScriptListener(ScriptListener listener)
listener
- a script listener.void addCommandListener(CommandListener listener)
listener
- a command listener.void addCommandListener(Reference<CommandListener> listener)
listener
- a command listener.Object removeCommandListener(CommandListener listener)
listener
- a command listener.boolean isConsoleMode()
PauseRequestException fireScriptEvent(ScriptEvent evt)
evt
- a script event.String assembleFileName(String fileName, ScriptingContext repository, String variableName)
fileName
- file name.repository
- a scripting context (needed for variables).variableName
- variable to get the target directory from.List<TestScriptInterpret> getActiveTestScripts()
List<TestScriptInterpret> getExecutingTestScripts()
List<TestScriptInterpret> getRunningTestScripts()
TestScriptInterpret.isRunning()
.List<Schedule> getActiveSchedules()
boolean hasActiveSchedule()
getActiveSchedules()
and testing
whether it is empty.List<Schedule> getExecutingSchedules()
ScriptedExecutable getExecutingObject()
TestScriptInterpret getClientOwner(RemoteDesktopClient client)
client
- a clientTestScriptInterpret getDocumentOwner(Document doc)
doc
- a document.void removeInterpret(TestScriptInterpret interpret)
TestScriptInterpret.destroy()
method.interpret
- a test script interpret.Object getDynamicVariableValue(String name, Map cliVars, Map variables, TestWrapper wr, ScriptingContext ctx)
name
- variable name.cliVars
- command line variable table.variables
- standard variable table.wr
- test wrapper requesting the value.ctx
- scripting context.void destroy()
void setOwningSchedule(Schedule s)
s
- a workitem.