StrongED:Applying scripts: Difference between revisions

From RISC OS
Jump to navigationJump to search
Line 7: Line 7:
* 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.
* 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. For a generic scripting language ''foo'', foo-scripts should begin with the line
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. StrongED 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


<font color="green">#! foo</font>
<font color="green">#! foo</font>

Revision as of 10:46, 11 May 2008

Applying scripts to StrongED windows

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.

  • 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. StrongED 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, and their contents should be sufficient to enable a foo-enthusiast to get foo working with StrongED.