# [texworks] ver 567 Script Menu scripts present but not working

Paul A Norman paul.a.norman at gmail.com
Mon Mar 15 07:09:48 CET 2010

Ok, tried to follow what was in the wiki as of October 2009, and
mangled a script I use, did it this way successfully.

Perhaps I'll convert all mine to Qt-script -- then  I will see the TW
object model?

LUA:
txt = TW.target.selection

env = "\\begin{multicols}{3}\n" .. txt .. "\n\\end{multicols}\n"

TW.target.insertText(env)

Paul

On 15 March 2010 18:47, Paul A Norman <paul.a.norman at gmail.com> wrote:
> 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() ?
>
> Paul
>
> On 14 March 2010 14:35, Jonathan Kew <jfkthame at googlemail.com> wrote:
>> On 14 Mar 2010, at 01:23, Paul A Norman wrote:
>>
>>> Dear Jonathan / Stefan,
>>>
>>> I have upgraded/  installed ver 567 for Windows.
>>>
>>> My scripts (lua at moment) show on the Script menu, but nothing
>>> happens when I invoke them.
>>>
>>> The script manager shows them with a checked check box beside each one.
>>>
>>> They all worked under the 300 series release.
>>>
>>> Not even the standard issue Make Bold script works.
>>>
>>> Looked through the wiki, and did a search here but must have missed something.
>>>
>>> changing but I can not find that post again, does that apply?
>>>
>>>
>>> Paul
>>
>> You probably need to update your scripts to the new scripting APIs... what used to be "target" and "app" (or "TWTarget" and "TWApp" in Lua, or just "TW" for the "target" in the earliest Lua implementation) are now "TW.target" and "TW.app" for all languages, and scripts that want to return a result should assign it to "TW.result".
>>
>> Most of this was discussed in various comments on issue #27, IIRC.
>>
>> (If you remove the entire scripts folder, texworks will recreate it with new copies of the sample scripts, which you can use as a guide to the changes for your own scripts.)
>>
>> Hmmm, we need to update the Scripting wiki page........
>>
>> JK
>>
>>
>>
>