[texworks] Mail list and other issues

Paul A Norman paul.a.norman at gmail.com
Mon Mar 18 01:00:11 CET 2019


Dear Iggor,

I'm pleased that gave you some immediate help, sounds like  Stefan Löffler
may be planning something more directly integrated into TeXworks.

I have not been able to repeat what you see with Alt D by itself activating
the Script(?)

You could alter the Shortcut section at the top of the script to just be...

// Shortcut: Alt+D

or

// Shortcut: Alt+S, Alt+D

I use three letter ones to keep more options open going forward for new
scripts, using just Alt D rules out later using anything else starting with
D, and you soon run out of letters of the alphabet :-)

There's a little bit more Scripting information here if you want to make
your own...
http://twscript.paulanorman.info/

A few Docs...
http://twscript.paulanorman.info/docs/index.html

Online Api...
http://twscript.paulanorman.info/docs/html/TexWorksQtScripting.htm

*TeXworks 0.7*

> " *and newest *[TeXworks]* 0.7 don't work with my mikTeX* (???). "

You may want to raise that as a separate issue - as I'm sure Stefan Löffler
and others may want to review that situation.

I'm not sure which MiKTeX  you're running, I currently run an *older*
MiKTeX Portable.

I have found in the past that using a "Command Prompt" generated from
within the MiKTeX (Portable) icon in the Windows Notification area
(normally pushing the mouse at the bottom right of your screen), and
starting TeXworks from within that MiKTeX Command Prompt, gives you any
needed environment variables, and paths that might otherwise be missing.

(Some of this is specific to my particular situation, but you'll get the
gist of it...)

Inside the MikTeX "Command Prompt" I run a batch file "golatex.bat" which
is in my general path..

g:
cd G:\LaTeXPortable
TW.bat

And for reasons of calling it from elsewhere and also making it easier to
change which TeXworks I'm running, I have "TW.bat" simply as...

\latexportable\LaTexUtils\TeXWorks\texworks\texworks.exe %1 %2 %3 %4

Any way by whatever means, perhaps try running TeXworks 0.7 from within a
MiKTex created "Command Prompt" (or Powershell if your system intercepts
the call, and presents Powershell instead) and see what happens?

Paul

On Fri, 15 Mar 2019 at 23:48, Iggor Ya. D. <iggor at sci.lebedev.ru> wrote:

> Hi Paul,
>
> Thank you very much! Actually, I returned to Texworks 0.4, since it
> works, and newest 0.7 don't work with my mikTeX (???). But your
> script works excellent in my current version too! I has one more question:
> why it worked namely for Alt-D? The script seems to have no settings
> for this, isn't it?
>
>
>
> Вы писали 13 марта 2019 г., 13:30:09:
> PAN> Hi Iggor,
>
> PAN> Sorry about that I had been rushing to another commitment.
>
> PAN> Here is a simple Script that should show you your containing
> directory.
>
> PAN> Place it (as "showContainingDirectory.js") on your hard-drive as
> PAN> described before, and reload the TeXworks Script list as also
> described before.
>
> PAN> Once the Script list is reloaded you can invoke it from within a
> current document by using the
> PAN> holding down ALT key
>
> PAN> tap once each of:
>
> PAN> S C D keys
>
> PAN> Or from the TeXworks Scripts menu itself as, "Show Containing
> Directory"
>
> PAN> Apologies again,
>
> PAN> Paul
> PAN> - - - -
>
>
> PAN> // TeXworksScript
> PAN> // Title: Show Containing Directory
> PAN> // Description: Showss the directory containing the current file in
> the default file browser
> PAN> // Author: Paul A. Norman
> PAN> // Version: 0.1.0
> PAN> // Date: 2019-03-13
> PAN> // Script-Type: standalone
> PAN> // Shortcut: Alt+S, Alt+C, Alt+D
>
> PAN>
> PAN> function basename(str) {
> PAN>     var base;
>
> PAN>     base = str.replace(/\/[^\/]*$/, "");
>
> PAN>     if(base == "") {
> PAN>                         // should never happen; there should always
> be <letter>: left
>
> PAN>         if(TW.platform() == "Windows")
> PAN>             base = "C:/"
> PAN>         else
> PAN>             base = "/";
> PAN>     }
> PAN>
> PAN>     // if(TW.platform() == "Windows") // Windows 8.1 wants
> PAN> backslashes in *some* system calls
> PAN>     //        base = base.replace(/\//g,"\\");
> PAN>
> PAN>     return base;
> PAN> }
>
>
> PAN>  var path = basename(TW.target.fileName);
> PAN>
> PAN>  TW.information(null, 'Document Path-', path);
> PAN>
> PAN>   // Uncomment the following if you want to automatically copy
> PAN> the path to the clipboard as well ...
>
> PAN>  // TW.app.clipboard = path;
> PAN>
> PAN>
> PAN>   null;
>
>
> PAN> On Wed, 13 Mar 2019 at 23:00, Paul A Norman
> PAN> <paul.a.norman at gmail.com> wrote:
> PAN> P.S.
>
> PAN> I'll write you a direct script later.
>
> PAN> There are a couple of prerequisites in what I sent you, that you
> PAN> won't want to bother with downloading and setting up
> PAN> (eval(TW.app.getGlobal("helper_twPan"));)
>
> PAN> And eventually you will need to check your Scripting Security
> settings under...
>
> PAN> Edit/ Preferences / Scripts
>
> PAN> May need most boxes ticked ok
>
> PAN> and also "Stefan Löffler & Jonathan Kew" - didn't actually write
> PAN> that script, the initial header was copied with their names in it -
> apologies.
>
>
> PAN> On Wed, 13 Mar 2019 at 20:34, Paul A Norman
> PAN> <paul.a.norman at gmail.com> wrote:
> PAN> Hi Iggor,
>
> PAN> I can help you with 2. finding the current file directory.
>
> PAN> I have a Script for TeXworks I often use
> PAN> See if it helps or what you need - lets know...
>
> PAN> Use the TeXworks menu for Scripts/Scripting TeXworks, ask it to "Show
> Scripts Folder"
>
> PAN> Then place the following in a plain text file in there called
> PAN> something like "openContainingDirectory.js"
>
> PAN> Then in the Scripts Menu - use Scripting TeXworks, ask it to "Reload
> Scripts"
>
> PAN> Next time you use your Scripts Menu you should see an item - " Open
> containing directory"
> PAN> Use it from within the TeXworks document you want to open.
>
> PAN> (The following Script could be modified to just only show the
> PAN> path on the status panel at the bottom of TeXworks as well perhaps.)
>
> PAN> I hope this helps,
> PAN> kind regards,
>
> PAN> Paul
>
>
> PAN> // TeXworksScript
> PAN> // Title: Open containing directory
> PAN> // Description: Opens the directory containing the current file in
> the default file browser
> PAN> // Author: Stefan Löffler & Jonathan Kew
> PAN> // Version: 0.1.1
> PAN> // Date: 2011-07-26
> PAN> // Script-Type: standalone
> PAN> // Shortcut: Alt+O, Alt+C, Alt+D
>
> PAN>   eval(TW.app.getGlobal("helper_twPan")); //  Comment if NOT
> PAN> Needed - This includes PhpJs ($P), twConst, msgBox, twPan ($tw),
> string.toTitleCase()
>
> PAN> function basename(str) {
> PAN>     var base;
>
> PAN>     base = str.replace(/\/[^\/]*$/, "");
>
> PAN>     if(base == "") {
> PAN>         if(TW.platform() == "Windows") // should never happen;
> PAN> there should always be <letter>: left
> PAN>             base = "C:/"
> PAN>         else
> PAN>             base = "/";
> PAN>     }
> PAN>
> PAN>     if(TW.platform() == "Windows") // Windows 8.1 wants
> PAN> backslashes in *some* system calls
> PAN>             base = base.replace(/\//g,"\\");
> PAN>
> PAN>     return base;
> PAN> }
>
>
> PAN> // WIndows 81 has broken this... TeXworks needs to be "Run as
> Administrator"
> PAN>    TW.launchFile(basename(TW.target.fileName));
> PAN>
> PAN>   //TW.launchFile( TW.target.fileName );
> PAN> /*
> PAN>   var thisDirectory = basename(TW.target.fileName);
> PAN>  // thisDirectory =TW.target.fileName;
> PAN>
> PAN>   cmd = "%windir%\\explorer.exe /E,\"" +  thisDirectory + "\"";
> PAN>
> PAN>   twPan.file_put_contents( thisDirectory + "\\open.bat", cmd);
> PAN>
> PAN>   twPan.osCmd("cmd /c \""+  thisDirectory  +"\\open.bat\"", true);
> PAN>
> PAN>
> PAN>   TW.app.clipboard = cmd;
> PAN>
> PAN>   twPan.alert(cmd);
> PAN>   */
>
> PAN> On Wed, 13 Mar 2019 at 03:22, Iggor Ya. D. <iggor at sci.lebedev.ru>
> wrote:
> PAN> Hello!
>
> PAN> I work for some time with Texworks under Windows (primarily Win7 32).
> PAN> Now I have the newest version:
> PAN> TeXworks-win-setup-0.6.2-201704300708-git_7ecce17.exe
> PAN> While working I have encountered some issues with the program:
>
> PAN> 1. Automated mailing form the Texworks to the mail list don't work:
> PAN> mailto:texworks at tug.org?... etc  - failed due to unknown reason. Mail
> PAN> agent was setup and mailto works from Firefox (but not from command
> PAN> prompt, of course).
>
> PAN> 2. Very annoying issue:  while working with different versions of the
> PAN> same text it is almost impossible to figure out what version is opened
> PAN> (in which directory lays the current file). The only method is to try
> PAN> to save the file, but it is not so good and the user can rewrite the
> PAN> file unwillingly.
>
> PAN> Is there any ways to make available solution?
>
>
>
>
> --
> Sincerely,
>  Iggor                          mailto:iggor at sci.lebedev.ru
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://tug.org/pipermail/texworks/attachments/20190318/48a1a6ed/attachment-0001.html>


More information about the texworks mailing list