StrongED:Applying scripts: Difference between revisions
Line 2: | Line 2: | ||
[[Image:apply26x26.gif]] |
[[Image:apply26x26.gif]] |
||
In the toolbar of versions of StrongED from 4.67 onwards you will see this icon. Its purpose is to let you ''apply'' a script to the text in the window. |
In the toolbar of versions of StrongED from 4.67 onwards you will see this icon. Its purpose is to let you ''apply'' a script to the text in the window. This facility is very powerful; it lets you extend the capabilities of StrongED without limit, and it turns StrongED into a handy development environment for any scripting language. |
||
* If you '''shift-drag''' the icon of the script file onto the apply icon the action of the script will be applied to the contents of the window. |
* If you '''shift-drag''' the icon of the script file onto the apply icon the action of the script will be applied to the contents of the window. |
||
* If you '''ctrl-drag''' the icon of the script file onto the apply icon then the result will be displayed in a new StrongED window; the original window will be unchanged. |
* If you '''ctrl-drag''' the icon of the script file onto the apply icon then the result will be displayed in a new StrongED window; the original window will be unchanged. |
Revision as of 10:55, 11 May 2008
Applying scripts to StrongED windows
In the toolbar of versions of StrongED from 4.67 onwards you will see this icon. Its purpose is to let you apply a script to the text in the window. This facility is very powerful; it lets you extend the capabilities of StrongED without limit, and it turns StrongED into a handy development environment for any scripting language.
- If you shift-drag the icon of the script file onto the apply icon the action of the script will be applied to the contents of the window.
- If you ctrl-drag the icon of the script file onto the apply icon then the result will be displayed in a new StrongED window; the original window will be unchanged.
- If you shift-ctrl-drag the icon of the script file onto the apply icon the action of the script will be applied to all the open StrongED windows; this can be useful for mailshots.
The mechanism for achieving this has evolved with the different versions of StrongED, but for version 4.68a4 it is achieved by the application !ScriptSED in the !StrongED.Defaults.Tools directory. The application !ScriptSED will try to recognize the scripting language from the filetype of the file whose icon is dragged, but if that fails because its filetype is text then it will examine its first line. For a generic scripting language foo, foo-scripts should begin with the line
#! foo
the foo binary should be on your system's Run$Path and an Obey file called foo should be put in the !ScriptSED.Languages directory telling StrongED how to apply the script. Its syntax will depend on foo's requirements for a correct commandline. The languages
- awk
- basic
- lua
- perl
- python
are already provided with appropriate Obey files. Their contents should be sufficient to enable a foo-enthusiast to get foo working with StrongED.