[texworks] Scripting: import libraries, retrieving saving text. web location, Api

Stefan Löffler st.loeffler at gmail.com
Mon Jul 26 19:25:35 CEST 2010


Hi,

Am 2010-07-26 07:51, schrieb Paul A Norman:
> I would really appreciate getting some clarity on the whole scripting
> area please.  Here are just a few things...
>
>   1. Did we finally agree to do a C++ Script function for file
> getText() mechanism?
>   

That was my impression, yes. Still waiting for Jonathan to reply/comment
and commit some old patches, though.

>   2. I have been holding off doing my own mechanism for importing
> QtScript function libraries thinking about these things
>   

Please note that there will most likely be a mechanism for this in the
future (when we tackle library scripts, asynchronous scripts, etc.).
This won't happen before the next release, though.

>       a)  where they can be placed
>   

<resources>/scripts sounds like a good place, doesn't it? Maybe a
subfolder, but that would probably show up in the menu. Note that Tw
only puts menu items up for script that end with .js and that have
proper headers. If you ensure your scripts don't comply with either of
these rules, they shouldn't show up in the menu.

>       b) naming conventions (perhaps our initails  or something as a
> prefix on the file names? Mine would be e.g.:    pan_someting.js )
>   

I'd suggest you'd also add something that marks it as a library. Either
by using a different extension (e.g., .jsl), or by putting "lib"
somewhere in the filename. E.g., lib-pan_something.js

>       c) I have found eval() is being used around the place in other
> projects using EMCA script for library imports
>   

Sounds reasonable. Not necessarily secure, but reasonable ;).

>       d) Are there core libraries to be maintained by the Tw project?
>   

Not at the moment. All the stuff we did so far was on the C++ side of
it. Maybe in the future, but ATM I doubt that.

>  3. Where do we stand on some sort of saveText() ?
>   

I guess at a similar spot as with the read() function. Note that it will
most likely have some limitations, like only being able to write in the
<resources>/scripts folder.

>  4.   http://twscript.paulanorman.com/   -   I'm happy to - and will
> host/ put a page up with such Tw Scripting information etc as I have,
> but ...
>   

Cool :).

>  5. If anyone has any further information on  things realting to the
> TwScript Api, could they please forward to me anything they have?
>   

As I stated some time ago, I intend to write a short documentation to
scripting, similar to Alain's (general) manual. However, when I'll have
time for that I don't know :(.

HTH
Stefan


More information about the texworks mailing list