[texworks] Scripting: Clips Storage - saving and retrieving portions of text to/from disk

Paul A Norman paul.a.norman at gmail.com
Thu Feb 10 06:38:31 CET 2011


Clips Storage  http://code.google.com/p/texworks/issues/detail?id=261#c51

Useful for reusable text, or blocks of LaTeX portions that need to be stored
for later insertion in documents. Especially useful where defining a new
LaTeX command in a .sty is not appropriate, as some change may be needed on
each usage.

Selected text is stored in a directory structure within your Script
directory tree. Such saved Text can be identified in a drop-down box and
inserted into a document, or the saved text can be retrieved for editing
itself. Saved portions are stored as plain uncompressed text that can be
edited/updated by other applications.

Developed under Windows, may need tweaking on line 68 for use on MacOsx or
Linux, haven't been able to test there.

Script written in QtScript and gives simple examples of the revised
readFile, writeFile, System and openFileFromScript TwScript api calls and
usage.

   Setup
   -----

   Unzip this script into its OWN ( <-essential) directory under <TeXworks
config area>/scripts Make a new folder if necessary. (See
http://code.google.com/p/texworks/wiki/TipsAndTricks?can=5#Locating_and_customizing_TeXworks_resources
 for further information if needed.)

   You'll need to turn on file access (both Read and Write) and System
commands in Tw Menu: Edit/Preferences/Scripts  note the warnings there.

   USAGE
   -----

   If any text is selected in editor, will try to store it to disk.

   - else with no text selected in editor, it will try to retrieve text clip
from disk and insert into editor / or edit previously saved text clip.

   Shortcut: Alt+S, Alt+C

Feedback much appreciated,

Paul
paul.a.norman at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://tug.org/pipermail/texworks/attachments/20110210/c133b659/attachment-0001.html>


More information about the texworks mailing list