# [texworks] SCRIPTING: Get content of specified directory

Paul A Norman paul.a.norman at gmail.com
Tue May 17 09:02:08 CEST 2011

Ok, here is a small script for completing an environment like \begin{something}

If there are alterations later, I'll put them at

I think it is multi nesting safe - place cursor on a new line, where
you want \end{something} and just activate with Alt E keys. It works
from top down to where your cursor is, so it won't know if the
environment is already ended past the cursor.

After some discussion on the list, I realised that I had always wanted
this for myself when ever someone had mentioned it, and finally felt
to have a real go at it!

And it looked too different to fit with the Crtl M work Henrik had done.

Please let me know what breaks it.

Paul

On 17 May 2011 13:36, Paul A Norman <paul.a.norman at gmail.com> wrote:
> Thanks Herb,
>
> Command Completion is really good for environments already registered,
> and I use it.
>
> I can understand for people who are using other packages that Command
> Completion is not set up for (and who maybe understand LaTeX well
> enough to have written their own), and yet who appear to not feel
> comfortable with trying to alter Tw configuration files to set it up
> themselves, why a simple completion macro would be helpful.
>
> You can use conditionals in Script and decide not to automatically put
>  \end{document} in.
>
> Paul
>
> On 17 May 2011 12:55, Herbert Schulz <herbs at wideopenwest.com> wrote:
>>
>> On May 16, 2011, at 7:12 PM, Paul A Norman wrote:
>>
>>> Looking really awesome Henrik!
>>>
>>> Haven't tried all scenarios yet, but really like the precision of
>>> operation, and the clarity of coding - made it really easy for me to
>>> try and get it running under Windows for your new feature - input of
>>> filenames.
>>>
>>> Often people have asked here whether there could be an automatic
>>> completion of environments
>>>
>>> \begin{something}   sa a s a sad sad  fd f
>>> <contorl-key M>
>>>
>>> \begin{ofsomething}   sa a s a sad sad  fd f
>>> \end{ofsomething}
>>>
>>> Is that something that you would see possibly logically fitting in
>>> with your code at all?
>>>
>>> With your new code, under Windows - I've tried these alterations, I
>>> don't think they'd break the Linux version (?)
>>>
>>> Quotes for possible spaces in file path (platform tested), and I've
>>> found that for *some* Dos commands and utilities we need to absolutely
>>> reverse the path delimiter to a backslash - fickle problem, and safer
>>> to actually sample the output to determine whether \n or \r\n is doing
>>> the line breaks and not assume it on platform.
>>>
>>> Regards,
>>> Paul
>>
>> Howdy,
>>
>> I'm not sure why that is preferable to simply using Command Completion and creating a full skeleton before yous tart to fill things in. In addition typing Ctl-M (isn't that simply a carriage return) if you are NOT in an environment would create \end{document} since that it the penultimate environment.
>>
>> Good Luck,
>>
>> Herb Schulz
>> (herbs at wideopenwest dot com)
>>
>>
>>
>>
>>
>