Re: Accessing clipboard through software built on Python

2018-10-28 Thread Tim Daneliuk
On 10/27/2018 08:17 AM, Musatov wrote: > I am wondering if Python could be used to write a program that allows: > > 1. Highlight some text > 2. Ctl+HOTKEY1 stores the string of text somewhere as COPIEDTEXT1 > 3. Highlight another string of text > 4. Ctl+HOTKEY1 stores another string of text somewh

Re: Accessing clipboard through software built on Python

2018-10-28 Thread Brian Oney via Python-list
You don't have to start from scratch. You don't to do anything other than learn to use anamnesis. I use anamnesis as my clipboard manager. I you can easily tell to get which ever one you want (i.e. the thousandth item). # Inform yourself https://sourceforge.net/projects/anamnesis/ # Install it

regular expression problem

2018-10-28 Thread Karsten Hilbert
Dear list members, I cannot figure out why my regular expression does not work as I expect it to: #--- #!/usr/bin/python from __future__ import print_function import re as regex rx_works = '\$<[^<:]+?::.*?::\d*?>\$|\$<[^<:]+?::.*?::\d+-\d+>\$' # it fails if switched arou

Re: Accessing clipboard through software built on Python

2018-10-28 Thread Akkana Peck
Tim Daneliuk writes: > However, the highlighted text must be copied explicitly: > > Highlight > Ctl-C [ ... ] > X actually has several clipboard buffers and it can be tricky to get this > going. I don't recall, > but either clipboard or pyperclip have a way to get to them all IIRC ... To get th

Re: Accessing clipboard through software built on Python

2018-10-28 Thread Tim Daneliuk
On 10/28/2018 02:08 PM, Akkana Peck wrote: > Tim Daneliuk writes: >> However, the highlighted text must be copied explicitly: >> >> Highlight >> Ctl-C > [ ... ] >> X actually has several clipboard buffers and it can be tricky to get this >> going. I don't recall, >> but either clipboard or pyperc

Re: regular expression problem

2018-10-28 Thread MRAB
On 2018-10-28 18:51, Karsten Hilbert wrote: Dear list members, I cannot figure out why my regular expression does not work as I expect it to: #--- #!/usr/bin/python from __future__ import print_function import re as regex rx_works = '\$<[^<:]+?::.*?::\d*?>\$|\$<[^<:]+?

Re: Accessing clipboard through software built on Python

2018-10-28 Thread Tim Daneliuk
On 10/28/2018 02:08 PM, Akkana Peck wrote: > Tim Daneliuk writes: >> However, the highlighted text must be copied explicitly: >> >> Highlight >> Ctl-C > [ ... ] >> X actually has several clipboard buffers and it can be tricky to get this >> going. I don't recall, >> but either clipboard or pyperc

Re: regular expression problem

2018-10-28 Thread Karsten Hilbert
Now that MRAB has shown me the follies of my ways I would like to learn how to properly write the regular expression I need. This part: > rx_works = '\$<[^<:]+?::.*?::\d*?>\$|\$<[^<:]+?::.*?::\d+-\d+>\$' > # it fails if switched around: > rx_fails = '\$<[^<:]+?::.*?::\d+-\d+>\$|\$<[^<:]+?::.*?::\

Re: regular expression problem

2018-10-28 Thread Karsten Hilbert
On Sun, Oct 28, 2018 at 09:43:27PM +0100, Karsten Hilbert wrote: > Let my try to explain the expression I am actually after > (assuming .compile with re.VERBOSE): > > rx_works = ' > \$< # start of match is literal '$<' > anywhere inside string > [^<:]+?::

Re: regular expression problem

2018-10-28 Thread Karsten Hilbert
On Sun, Oct 28, 2018 at 10:04:39PM +0100, Karsten Hilbert wrote: > - options needs to be able to contain nearly anything, except '::' This seems to contradict the "nesting" requirement, but the nesting restriction "earlier parsing passes go inside" makes it possible. Karsten -- GPG 40BE 5B0E C

Re: Accessing clipboard through software built on Python

2018-10-28 Thread Peter via Python-list
On 28/10/2018 12:17 AM, Musatov wrote: I am wondering if Python could be used to write a program that allows: 1. Highlight some text 2. Ctl+HOTKEY1 stores the string of text somewhere as COPIEDTEXT1 3. Highlight another string of text 4. Ctl+HOTKEY1 stores another string of text somewhere as C

Re: regular expression problem

2018-10-28 Thread Brian Oney via Python-list
On Sun, 2018-10-28 at 22:04 +0100, Karsten Hilbert wrote: > [^<:] Would a simple regex work? I mean: ~$ python Python 2.7.13 (default, Sep 26 2018, 18:42:22)  [GCC 6.3.0 20170516] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import re >>> t = '$$' >>> re.f

Re: regular expression problem

2018-10-28 Thread MRAB
On 2018-10-28 21:04, Karsten Hilbert wrote: On Sun, Oct 28, 2018 at 09:43:27PM +0100, Karsten Hilbert wrote: Let my try to explain the expression I am actually after (assuming .compile with re.VERBOSE): rx_works = ' \$< # start of match is literal '$<' anywhere

Re: regular expression problem

2018-10-28 Thread Thomas Jollans
On 28/10/2018 22:04, Karsten Hilbert wrote: > - options needs to be able to contain nearly anything, except '::' > > Is that sufficiently defined and helpful to design the regular expression ? so options isn't '.*', but more like '(:?[^:]+)*' (Figuring out what additional restriction this imposes

Re: regular expression problem

2018-10-28 Thread Thomas Jollans
On 28/10/2018 22:04, Karsten Hilbert wrote: > - options needs to be able to contain nearly anything, except '::' Including > and $ ? -- https://mail.python.org/mailman/listinfo/python-list

zenity substitution

2018-10-28 Thread listo factor via Python-list
Hi all, I'm new to Python, but not to programming. As a teaching exercise, I am converting a bunch of bash shell scripts to Python, so that they can be run on all three OS-es (Linux, Windows, MacOS). The scripts in questions make extensive use of Linux "zenity" dialogs. Is there an equivalent f

Re: Accessing clipboard through software built on Python

2018-10-28 Thread Thomas Jollans
On 27/10/2018 20:50, Musatov wrote: > On Saturday, October 27, 2018 at 11:12:35 AM UTC-5, Marko Rauhamaa wrote: >> Michael Torrie : >>> As far as I know it's not possible for an application to directly yank >>> highlighted text from another application. >> >> That's an age-old pattern in X11. I don

Re: zenity substitution

2018-10-28 Thread Bob Gailer
On Oct 28, 2018 10:17 PM, "listo factor via Python-list" < python-list@python.org> wrote: > > Hi all, > I'm new to Python, but not to programming. > > As a teaching exercise, I am converting a bunch of bash shell > scripts to Python, so that they can be run on all three OS-es > (Linux, Windows, Mac