[texworks] SCRIPTING: Getting Take Aways (sending out) - TW.system() and \write18
Stefan Löffler
st.loeffler at gmail.com
Wed Aug 3 20:10:23 CEST 2011
Hi,
I've looked over
http://twscript.paulanorman.com/docs/html/TexWorksQtScripting.htm?systemQString.html
and have a few minor remarks:
-) It's a nice overview
-) I would add something about the dangers of allowing execution of
system commands, that it shouldn't be done lightly, and that script
authors should inform the users about the risks (and benefits) involved.
Only if they do that security measures can really work (otherwise, the
click on "run system command" is just one more click that everybody
carries out to get the script XY to work).
-) Expand a little on the return code (retVal["result"]) - some people
might not be familiar with this. For some applications, this can even
have a (significant) meaning, beyond a simple error number. I don't have
a proper definition/explanation at hand right now, be the internet
certainly has some pages on this. Also, it might be good to state that
for most applications, a return code of 0 means success.
-) Explain the difference between "c) Failed to execute..." and "d)Error
executing..." (c) occurs, e.g., when the program you're trying to run is
not found (e.g., TW.system("thisprogramdoesntexist")), whereas (d)
occurs when the program was started, but crashed somewhere in the middle
of execution. Both (c) and (d) can only occur with waitForResult=true
-) I don't fully understand what you mean by "retVal["output"] Any
String returned by the (even partially) executed command line". First,
"returned" should probably be "printed" or "output" or something -
programs technically can't return strings. Second, retVal["output"] only
contains the complete output of the program after the program ended. It
is correct that - if the program crashed - that can be called the output
of the partially executed program. But it is not dynamic, in the sense
that retVal["output"] change repeatedly if the program is running in the
background. With waitForResult=false, retVal["status"] = SystemAccess_OK
and all other variables are set to undefined.
HTH
Stefan
PS: I have to check out that JabRef connection sometime :).
More information about the texworks
mailing list