[texworks] SCRIPTING: 1. __FILE__ not quite true and 2. TW.system not handling - or _ in path structure(?)
st.loeffler at gmail.com
Thu May 19 12:38:09 CEST 2011
On 2011-05-19 04:03, Paul A Norman wrote:
> TW.information(null, "", __FILE__);
> Shows the path and file name - but the first segment between the first
> delimeter / / set is set to lowercase and I have some capitals there.
> Real path is:
> But __FILE__ copies to clipboard in Script as:
Hm, this is weird. __FILE__ is provided directly by the QtScript API,
though, AFAIK. Tw doesn't do anything with it (nor does it exist in,
e.g., lua). So this might be a Qt bug (but then again, I'm not sure if
this feature is documented at all - probably that should be checked first).
> Also, If I change this part of the path /Image Handling/ to either
> of /Image-Handling/ /Image_Handling/
> I get strange results when I try to pass this through TW.system even
> just for: cmd /c dir /b \" + scriptPath + "\\*.txt\""
> "Parameter format not correct - "latexportable"."
> The above works fine when it is /Image Handling/ in the path (with the space).
> And copying cmd /c dir /b \" + scriptPath + "\\*.txt\"" in expanded
> form to the clipboard in script and then pasting it into a dos prompt
> works fine for all three path versions of /Image Handling/
> /Image-Handling/ /Image_Handling/
This is strange, too. Again, Tw doesn't do anything with the command
line, it passes is straight to
http://doc.trolltech.com/4.7/qprocess.html#start-2. So, two suggestons:
* Does it work (for a path without spaces) if you remove the quotes?
* Does it work if you escape the quotes
(http://doc.trolltech.com/4.7/qprocess.html#start-2 actually has an
example on `dir`).
More information about the texworks