This script exports the selected text or current article to a temp file in the designated temp directory, loads it into the specified text editor and reimports the file when the editor closes. More specifically, if you select text—anywhere from one character to the whole article—then that is what is exported. If the text cursor is in an article but no text is block selected then the whole article is exported. If what you want is to edit the entire article in a text editor then either select the whole article or make sure that no block selection exists.
This script is distributed with PageStream and should already be installed. For reference, to install it yourself copy all files that come in the archive (they all start with SendTextToEditor) to the PageStream scripts directory. On Windows this is usually My Documents\PageStream\Scripts. On other platforms this is Documents/PageStream/Scripts. Then open Preferences either by clicking on the icon in the toolbar or using the File/Preferences... menu item. In preferences select the Editors section and select the Text Editor Script using the file browser icon for that entry. Note, the main script is SendTextToEditor.py.
The first time the script is run it will prompt you to select an editor to use. This choice is saved in a preference file kept in the same directory as the script. If you wish to select a different editor you can either remove the preference file (in which case the script will prompt again the next to it is run) or you can run the script with the parameter "SetEditor". Note: parameters only work in PageStream 22.214.171.124 and newer.
In the event that you wish the old behavior (which only used editors defined in the script itself) you can get this by specifying the "NeverAsk" parameter.
Finally, you can specify a particular preference file to use. The file must be located in the same directory as the script but there are no other restrictions. A reliable way to create a working alternate prefs file is to specify both SetEditor and an alternate prefs file name. To use the prefs file use another macro that only specifies the alternate prefs filename.
To run the script with a parameter you will need to create a macro. In PageStream, open the Script Palette by going to the Window/Show Script Palette. In the script palette use the mini menu to create a new script. Give the macro whatever name you wish and then put the appropriate command in the command window. For example:
Of course, you will need to change the path to where the script is stored on your system.
The preference file has a simple format. The parameter being set is followed by a colon, then a space, then everything to the end of the line is the value. For example, WindowsTextEditor: c:\Windows\notepad.exe sets Notepad as the editor on windows. Valid parameters are:
This only works for an editor that can be started with a file to editor as a commandline parameter and blocks the calling shell until it closes. If the editor requires a commandline parameter it will need to be specified as well. If the file browser does not allow you to do this you will need to edit the preference file (SendTextToEditor.prefs) by hand. For example, the editor Kate requires kate --nofork to work with this script.
If the modified time for the temp file has not changed when the editor closes it is assumed that the temp file was not changed and so it is not imported. A very quick edit and save can result in this assumption being false.
Some editors create temp files or backups of their own. If they don't remove their own temp files those could accumulate. The creation of backups is a feature, but could have the same effect. If the editor has a commandline parameter to disable these features that should be specified with the editor.
Emacs does this and does not appear to have a way to turn it off.
On OS X applications are actually directories, not files. The file selector conceals this, but the path saved by the script is to where the executable is expected to be. For example, TextEdit is not /Applications/TextEdit, but in truth is /Applications/TextEdit.app/Contents/MacOS/TextEdit. This is important to consider if manually editing the prefs file.
Depending on the windowing system the editor may be opened in the background. If after running the script you don't see the text editor check the taskbar (or equivalent for your operating system) to bring the editor the foreground.