[texworks] ver 567 Script Menu scripts present but not working
Stefan Löffler
st.loeffler at gmail.com
Mon Mar 15 07:14:11 CET 2010
Dear Paul,
Am 2010-03-15 06:47, schrieb Paul A Norman:
> Dear Jonathan,
> Just a quick point of clarification please.
>
> So in LUA what used to be
>
> txt = TW.getSelectedText()
>
> TW. replaceSelectedText(txt .. "blah blah")
>
> Becomes?
> TW.app.getSelectedText() or TW.target.getSelectedText() ?
>
In principle, it's target because it acts on the specific text of the
document, not on the whole app.
However, the getSelectedText and replaceSelectedText functions were only
present in the very first tries, AFAIR. They have since been replaced by
more powerful calls, i.e.
txt = TW.target.selection
TW.target.insertText("\\textbf{" .. txt .. "}")
(note that insertText replaces any previously selected text).
See
http://code.google.com/p/texworks/source/browse/trunk/res/resfiles/scripts/makeBold.lua
for a full example. As Jonathan has pointed out previously, it would be
a good idea to get Tw to recreate the scripts folder with all the shiny,
new example scripts (just rename/move your old script folder out of the
way for this).
HTH
Stefan
More information about the texworks
mailing list