[texworks] Scripting Api TW.app.openFileFromScript()
Stefan Löffler
st.loeffler at gmail.com
Sun Feb 13 08:51:08 CET 2011
Hi,
On 2011-02-13 04:10, Paul A Norman wrote:
> Just finally getting my head around TW.app.openFileFromScript()
I've been meaning to read what you got so far for ages, but haven't had
time so far.
Just so you know, I'm going on vacation for one week today, so I won't
be able to reply to mails on the list, fix bugs, etc. in that time.
> So far I can not discern fileStartPosition in (2) below doing anything
> different to (1) - is it supposed to set where the position where the
> file is read from? So far I always seem to end up with all of the file
> even when I set say 200 for fileStartPosition.
I just checked, and you're right of course. By design,
"fileStartPosition" should put the cursor to whichever line you specify
here. The problem is that if you open a recent document, it will have
its last cursor position stored in the preferences and those will
override the positioning defined by fileStartPosition. Please report
this as a bug - I'm not sure how/if this can be solved, but it certainly
doesn't work out as intended.
BTW: it would probably be better to call this something line lineNumber.
> Are there advantages in setting what I have as null to anything else -
> is that needed for script directory files to be read without
> permissions being set?
Yes, exactly. You should always set this to TW instead of null. The
system uses this to determine opening permissions. If set to null, you
will not be able to read any files unless "allow scripts to read all
files" is set.
HTH
Stefan
More information about the texworks
mailing list