[texworks] shortcuts with multiple letters
Mark Yagnatinsky
markyag at gmail.com
Thu Mar 16 07:39:18 CET 2017
Re: undo: why not just use Ctrl + Z? You seem to have memorized all the
hard-to-use keyboard shortcuts :)
I spend a few minutes trying to get a script to work. The good news is
that I got save working.
The bad news is that it pops up a dialog box with nothing but the word
"true".
Something tells me your muscle memory will NOT like this.
At this point someone who actually knows something about TeXworks will have
to take over, because I'm way out of my depth here.
On Thu, Mar 16, 2017 at 12:02 AM, Z Br <breigzach at gmail.com> wrote:
> Sorry for the clutter but here are two more threads discussing
> accelerators:
> I was unable to get the attachment in the second file to work, it seems
> perhaps this is aimed for a Mac?
> Again perhaps Mark or Alain could help out on this.
> https://github.com/TeXworks/texworks/issues/17#issuecomment-80291247
> http://tug.org/pipermail/texworks/2010q2/002606.html
>
> On Wed, Mar 15, 2017 at 9:49 PM, Z Br <breigzach at gmail.com> wrote:
>
>> And sorry I need to work on my reading comprehension: one of the
>> important items Mark noted is that what I am looking for is an
>> "accelerator" (I had not heard of that term before): the Alt key activates
>> the pull down menus, and if I had that I would be set.
>>
>> I did a google search and a few years ago Alain seems to have discussed
>> this:
>> http://tug.org/pipermail/texworks/2013q2/005795.html
>> Item 1 discusses accelerators! Unfortunately the attachments have been
>> stripped off and I cannot find the directory mentioned there,
>> c:\users\<your_name>\TeXworks\translations
>>
>> So Alain if you are reading this and still have those files, can you
>> re-post them?
>>
>> Thanks again!
>> Zach
>>
>> On Wed, Mar 15, 2017 at 9:32 PM, Z Br <breigzach at gmail.com> wrote:
>>
>>> Thanks Mark. I have tried reading though that manual but am puzzled as
>>> to how to use that to have some key sequence lead the file to be saved:
>>> like where would I add in the parameters. Sorry like I said I really have
>>> little programming skill :(
>>>
>>> And as an aside yes you are correct in what I am trying for: in
>>> Microsoft Windows, the standard key sequence for:
>>> saving files is Alt <and then> F <and then> S;
>>> or to undo what was just written is Alt <and then> E <and then> U
>>> Essentially the Alt activates the pull down menu and then the other keys
>>> navigate the pulldown. So if I can create a shortcut or get a script to do
>>> this, it will be like virtually every other program I use and will speed my
>>> editing. I am guessing others in the Windows world would also benefit from
>>> this, so if I figure out a solution I will be sure to post it here!
>>>
>>> And finally not sure if there is someone on the mail list who is more
>>> familiar with the shortcuts. I am guessing there is a way to do what I want
>>> with the shortcuts.ini file but it is not well documented (what I know I
>>> pulled from manual, http://formal.korea.ac.kr/~jle
>>> e/lectures/cnce150/read/TeXworks-manual.pdf, Section A.2)
>>>
>>>
>>> On Wed, Mar 15, 2017 at 7:28 PM, Mark Yagnatinsky <markyag at gmail.com>
>>> wrote:
>>>
>>>> First off, I never knew about shortcuts.ini before; this is a great
>>>> feature and needs to be made more discoverable. I suggest, at a minimum,
>>>> that a fresh TeXworks installation creates an empty shortcuts.ini file so
>>>> that someone might wonder what it's for. Maybe someone should file a
>>>> feature request. (Maybe me??)
>>>>
>>>> Second, it seems a bit silly that the syntax for shortcuts in
>>>> shortcuts.ini does not match the syntax for shortcuts for running scripts;
>>>> surely those should be identical. Sounds like another feature request.
>>>>
>>>> Third: in what world is "Alt + F + S" a familiar keyboard shortcut for
>>>> saving a file!?! The only thing I'm aware of that comes even close is "Alt
>>>> + F, S", which simply opens the file menu, and then selects the save
>>>> option. Unfortunately, this doesn't seem to work in TeXworks, since it
>>>> seems that none of the menus on the menu bar have an accelerator key
>>>> defined, so Alt + F fails to open the file menu, and even if it did, "S"
>>>> does not activate save. Yet another missing feature.
>>>>
>>>> Finally, I'm no expert in the TeXworks scripting API, and have written
>>>> precisely zero working scripts, but this seems to do what you need:
>>>> http://twscript.paulanorman.info/docs/html/TexWorksQtScripti
>>>> ng.html?save.html
>>>> In other words, the script is a one line: TW.target.save();
>>>> Disclaimer: I have not tried it. I personally just use Ctrl + S, to
>>>> save.
>>>> (Actually, this is not true. What I actually do is Ctrl + T to
>>>> typeset, and rely on the implicit save just before typesetting.)
>>>>
>>>> Hope some of this helps.
>>>> If not, ask again.
>>>>
>>>> On Wed, Mar 15, 2017 at 12:28 AM, Z Br <breigzach at gmail.com> wrote:
>>>>
>>>>> Thanks Alain!
>>>>>
>>>>> Unfortunately I am not much of a programmer and so I am unsure how to
>>>>> modify the script you posted to get the action I had asked about. Could you
>>>>> give a bit more direction, or if someone else knows if this is possible
>>>>> with the short cuts file that would be great too.
>>>>>
>>>>> ZB
>>>>>
>>>>> On Tue, Mar 14, 2017 at 1:32 PM, Alain Delmotte <
>>>>> alain.delmotte at leliseron.org> wrote:
>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> I don't think that it is possible with a shortcut*, but you could
>>>>>> have a script to do that, like this one:
>>>>>>
>>>>>> ================================ chapter.lua
>>>>>> --[[TeXworksScript
>>>>>> Title: d: chapter \c&hapter
>>>>>> Description: Encloses the current selection in \chapter{}
>>>>>> Author: Alain Delmotte from Stefan Löffler & Jonathan Kew
>>>>>> Version: 0.1
>>>>>> Date: 2011-11-01
>>>>>> Script-Type: standalone
>>>>>> Context: TeXDocument
>>>>>> Shortcut: Alt+W, Alt+&
>>>>>> ]]
>>>>>>
>>>>>> txt = TW.target.selection
>>>>>> if (txt == nil) then txt = "" end
>>>>>> TW.target.insertText("\\chapter{" .. txt .. "}")
>>>>>> TW.target.selectRange(TW.target.selectionStart - string.len(txt) -
>>>>>> 1, string.len(txt))
>>>>>> ============================
>>>>>>
>>>>>> To create a \chapter{xyz} instruction I type "xyz", select this and
>>>>>> type Alt+W& (the key where is "1", but on my belgian keyboard it has & as
>>>>>> lower case). If I selct nothing I just have \chapter{}.
>>>>>>
>>>>>> You have to put the script file in the scripts folder.
>>>>>>
>>>>>> Regards,
>>>>>>
>>>>>> Alain
>>>>>> * to be confirmed by the specialists
>>>>>>
>>>>>>
>>>>>> Le 14/03/2017 à 14:15, Z Br a écrit :
>>>>>>
>>>>>> Hi:
>>>>>>
>>>>>> I am using a shortcuts.ini file to create some custom shortcuts. I
>>>>>> would like to have shortcuts which involve multiple letters, e.g. the
>>>>>> familiar Alt+F+S to save the file. But when I include lines like this in
>>>>>> shortcuts.ini,
>>>>>> actionSave = Alt+F+S
>>>>>> they do not work (literally nothing happens). Shortcuts with just one
>>>>>> letter like
>>>>>> actionSave = Alt+S
>>>>>> do work.
>>>>>>
>>>>>> Is there a way to create shortcuts with multiple letters?
>>>>>>
>>>>>> Regards,
>>>>>> Zach
>>>>>>
>>>>>>
>>>>>> My setup:
>>>>>> Win7 Enterprise x64
>>>>>> TexWorks 0.6.1
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> ------------------------------
>>>>>> [image: Avast logo] <https://www.avast.com/antivirus>
>>>>>>
>>>>>> L'absence de virus dans ce courrier électronique a été vérifiée par
>>>>>> le logiciel antivirus Avast.
>>>>>> www.avast.com <https://www.avast.com/antivirus>
>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://tug.org/pipermail/texworks/attachments/20170316/2d56b544/attachment.html>
More information about the texworks
mailing list