public abstract class UserDefinedScript
extends java.lang.Object
| Constructor and Description | 
|---|
| UserDefinedScript()Constructor. | 
| Modifier and Type | Method and Description | 
|---|---|
| boolean | atPrompt(int validPrompts)Checks if you are at any of the valid prompts. | 
| void | beginTurboCycle()This marks the start of a turbo cycle. | 
| void | endScript(boolean finished)Called by the framework when the script is finished. You can override this method to clean up after the script if needed. | 
| void | endTurboCycle()This marks the end of a turbo cycle. | 
| void | execInstance()Executes a script instance. Should only be called from static exec()methods. | 
| java.lang.String | getClassName()Gets the class name. | 
| java.lang.String | getDescription()Called by the framework to get the description of the script. You should override this method to provide a script description. The script description can be an URL to a HTML page or file. | 
| java.lang.String | getName()Called by the framework to get the name of the script. You should override this method. | 
| java.util.Enumeration | getParams()Gets the script parameters. | 
| java.net.URL | getResource(java.lang.String resource)Finds a resource with a given name. | 
| void | initInstance()Initialises a script instance. Should only be called from static exec()methods. | 
| boolean | initScript()Called by the framework to initialise the script. You should override this method to make your own initialisation. | 
| void | onEvent(EventIfc event)This method is called for each posted event. You can override this method to handle events. You can execute commands during the event handling and they will all be executed in one sequence between normal script commands. | 
| void | postEvent(UserDefinedEvent event)This method posts an event in the SWATH event queue. | 
| void | printTrace(java.lang.Exception e)Print an exception and the complete stack trace
 in the SWATH console window. | 
| void | printTrace(java.lang.String text)Print trace text in the SWATH console window. | 
| void | registerParam(Parameter param)This method is used to register a script parameter. | 
| void | repeatTurboCycle()This method will repeat the recorded turbo cycle. | 
| boolean | runScript()Called by the framework to run the script. You should override this method to define the script body. | 
| boolean | showUserParamWindow(javax.swing.JPanel panel,
                   int width,
                   int height)Displays a Swing frame window for script parameter input. | 
| boolean | showUserParamWindow(java.awt.Panel panel,
                   int width,
                   int height)Displays an AWT frame window for script parameter input. | 
| void | sleep(long ms)Wait and sleep for a while. | 
public final java.lang.String getClassName()
public final void registerParam(Parameter param) throws ScriptException
param - The parameter to register.ScriptException - If no more parameters could be added.public final java.util.Enumeration getParams()
public final void initInstance()
                        throws ScriptException,
                               java.lang.Exception
exec() methods.ScriptException - If the script initialisation fails for some reason.java.lang.ExceptionexecInstance()public final void execInstance()
                        throws ScriptException,
                               java.lang.Exception
exec() methods.ScriptException - If the script execution fails for some reason.java.lang.ExceptioninitInstance()public final boolean atPrompt(int validPrompts)
                       throws java.lang.Exception
validPrompts - The valid prompts. (Combine several prompts with logical OR)true if you are at a valid prompt,
  otherwise false.java.lang.ExceptionSwath.NO_PROMPT, 
Swath.COMMAND_PROMPT, 
Swath.COMPUTER_PROMPT, 
Swath.PLANET_PROMPT, 
Swath.CITADEL_PROMPT, 
Swath.CORP_PROMPT, 
Swath.STARDOCK_PROMPT, 
Swath.ALL_PROMPTSpublic final void sleep(long ms)
ms - The time to sleep in milliseconds.public final java.net.URL getResource(java.lang.String resource)
resource - The name of the wanted resource.null if not found.public final void beginTurboCycle()
                           throws java.lang.Exception
endTurboCycle() method.java.lang.ExceptionendTurboCycle(), 
repeatTurboCycle()public final void endTurboCycle()
                         throws java.lang.Exception
repeatTurboCycle() method to repeat the cycle.java.lang.ExceptionbeginTurboCycle(), 
repeatTurboCycle()public final void repeatTurboCycle()
                            throws java.lang.Exception
java.lang.ExceptionbeginTurboCycle(), 
endTurboCycle()public final void postEvent(UserDefinedEvent event)
event - The event to post.public final void printTrace(java.lang.String text)
                      throws java.lang.Exception
text - The text to print.java.lang.Exceptionpublic final void printTrace(java.lang.Exception e)
                      throws java.lang.Exception
e - The exception to print.java.lang.Exceptionpublic final boolean showUserParamWindow(java.awt.Panel panel,
                                         int width,
                                         int height)
                                  throws java.lang.Exception
panel - The user defined panel that holds all components
  that should be displayed in the client area of the window.width - The width of the window.height - The height of the window.true if the user choosed to start the script,
  otherwise false.java.lang.ExceptionTools.createPanel(), 
showUserParamWindow(JPanel,int,int)public final boolean showUserParamWindow(javax.swing.JPanel panel,
                                         int width,
                                         int height)
                                  throws java.lang.Exception
panel - The user defined panel that holds all components
  that should be displayed in the client area of the window.width - The width of the window.height - The height of the window.true if the user choosed to start the script,
  otherwise false.java.lang.ExceptionTools.createJPanel(), 
showUserParamWindow(Panel,int,int)public java.lang.String getName()
public java.lang.String getDescription()
"http://www.swath.net/Help.html"
  "file:///C:/HelpDir/Help.html"
  "<html>This <b>script</b> will...</html>"
  "This script will..."
 public boolean initScript()
                   throws java.lang.Exception
true if the initialisation was successful,
  otherwise false.java.lang.ExceptionatPrompt(int), 
showUserParamWindow(Panel,int,int), 
showUserParamWindow(JPanel,int,int)public boolean runScript()
                  throws java.lang.Exception
true if the script finished correctly,
  otherwise false.java.lang.Exceptionpublic void endScript(boolean finished)
               throws java.lang.Exception
finished - true if the script finished correctly or
  false if the script was interrupted in some way.java.lang.Exceptionpublic void onEvent(EventIfc event) throws java.lang.Exception
event - The event.java.lang.Exception