[texworks] Mail list and other issues

Paul A Norman paul.a.norman at gmail.com
Wed Mar 13 11:30:09 CET 2019


Hi Iggor,

Sorry about that I had been rushing to another commitment.

Here is a simple Script that should show you your containing directory.

Place it (as "showContainingDirectory.js") on your hard-drive as described
before, and reload the TeXworks Script list as also described before.

Once the Script list is reloaded you can invoke it from within a current
document by using the
holding down ALT key

tap once each of:

S C D keys

Or from the TeXworks Scripts menu itself as, "Show Containing Directory"

Apologies again,

Paul
- - - -

// TeXworksScript
// Title: Show Containing Directory
// Description: Showss the directory containing the current file in the
default file browser
// Author: Paul A. Norman
// Version: 0.1.0
// Date: 2019-03-13
// Script-Type: standalone
// Shortcut: Alt+S, Alt+C, Alt+D


function basename(str) {
    var base;

    base = str.replace(/\/[^\/]*$/, "");

    if(base == "") {
                        // should never happen; there should always be
<letter>: left

        if(TW.platform() == "Windows")
            base = "C:/"
        else
            base = "/";
    }

    // if(TW.platform() == "Windows") // Windows 8.1 wants backslashes in
*some* system calls
    //        base = base.replace(/\//g,"\\");

    return base;
}


 var path = basename(TW.target.fileName);

 TW.information(null, 'Document Path-', path);

  // Uncomment the following if you want to automatically copy the path to
the clipboard as well ...

 // TW.app.clipboard = path;


  null;


On Wed, 13 Mar 2019 at 23:00, Paul A Norman <paul.a.norman at gmail.com> wrote:

> P.S.
>
> I'll write you a direct script later.
>
> There are a couple of prerequisites in what I sent you, that you won't
> want to bother with downloading and setting up
> (eval(TW.app.getGlobal("helper_twPan"));)
>
> And eventually you will need to check your Scripting Security settings
> under...
>
> Edit/ Preferences / Scripts
>
> May need most boxes ticked ok
>
> and also "Stefan Löffler & Jonathan Kew" - didn't actually write that
> script, the initial header was copied with their names in it - apologies.
>
>
> On Wed, 13 Mar 2019 at 20:34, Paul A Norman <paul.a.norman at gmail.com>
> wrote:
>
>> Hi Iggor,
>>
>> I can help you with 2. finding the current file directory.
>>
>> I have a Script for TeXworks I often use :-)
>> See if it helps or what you need - lets know...
>>
>> Use the TeXworks menu for Scripts/Scripting TeXworks, ask it to "Show
>> Scripts Folder"
>>
>> Then place the following in a plain text file in there called something
>> like "openContainingDirectory.js"
>>
>> Then in the Scripts Menu - use Scripting TeXworks, ask it to "Reload
>> Scripts"
>>
>> Next time you use your Scripts Menu you should see an item - " Open
>> containing directory"
>> Use it from within the TeXworks document you want to open.
>>
>> (The following Script could be modified to just only show the path on the
>> status panel at the bottom of TeXworks as well perhaps.)
>>
>> I hope this helps,
>> kind regards,
>>
>> Paul
>>
>>
>> // TeXworksScript
>> // Title: Open containing directory
>> // Description: Opens the directory containing the current file in the
>> default file browser
>> // Author: Stefan Löffler & Jonathan Kew
>> // Version: 0.1.1
>> // Date: 2011-07-26
>> // Script-Type: standalone
>> // Shortcut: Alt+O, Alt+C, Alt+D
>>
>>   eval(TW.app.getGlobal("helper_twPan")); //  Comment if NOT Needed -
>> This includes PhpJs ($P), twConst, msgBox, twPan ($tw),
>> string.toTitleCase()
>>
>> function basename(str) {
>>     var base;
>>
>>     base = str.replace(/\/[^\/]*$/, "");
>>
>>     if(base == "") {
>>         if(TW.platform() == "Windows") // should never happen; there
>> should always be <letter>: left
>>             base = "C:/"
>>         else
>>             base = "/";
>>     }
>>
>>     if(TW.platform() == "Windows") // Windows 8.1 wants backslashes in
>> *some* system calls
>>             base = base.replace(/\//g,"\\");
>>
>>     return base;
>> }
>>
>>
>> // WIndows 81 has broken this... TeXworks needs to be "Run as
>> Administrator"
>>    TW.launchFile(basename(TW.target.fileName));
>>
>>   //TW.launchFile( TW.target.fileName );
>> /*
>>   var thisDirectory = basename(TW.target.fileName);
>>  // thisDirectory =TW.target.fileName;
>>
>>   cmd = "%windir%\\explorer.exe /E,\"" +  thisDirectory + "\"";
>>
>>   twPan.file_put_contents( thisDirectory + "\\open.bat", cmd);
>>
>>   twPan.osCmd("cmd /c \""+  thisDirectory  +"\\open.bat\"", true);
>>
>>
>>   TW.app.clipboard = cmd;
>>
>>   twPan.alert(cmd);
>>   */
>>
>> On Wed, 13 Mar 2019 at 03:22, Iggor Ya. D. <iggor at sci.lebedev.ru> wrote:
>>
>>> Hello!
>>>
>>> I work for some time with Texworks under Windows (primarily Win7 32).
>>> Now I have the newest version:
>>> TeXworks-win-setup-0.6.2-201704300708-git_7ecce17.exe
>>> While working I have encountered some issues with the program:
>>>
>>> 1. Automated mailing form the Texworks to the mail list don't work:
>>> mailto:texworks at tug.org?... etc  - failed due to unknown reason. Mail
>>> agent was setup and mailto works from Firefox (but not from command
>>> prompt, of course).
>>>
>>> 2. Very annoying issue:  while working with different versions of the
>>> same text it is almost impossible to figure out what version is opened
>>> (in which directory lays the current file). The only method is to try
>>> to save the file, but it is not so good and the user can rewrite the
>>> file unwillingly.
>>>
>>> Is there any ways to make available solution?
>>>
>>> --
>>> С уважением,
>>>  Iggor                          mailto:iggor at sci.lebedev.ru
>>>
>>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://tug.org/pipermail/texworks/attachments/20190313/197dcc78/attachment-0001.html>


More information about the texworks mailing list