Multiple copy and paste thing in Perl

Discussion in 'Perl Misc' started by TefJlives, May 7, 2007.

  1. TefJlives

    TefJlives Guest

    Hi all,

    For my job, I often have a group of about 10 commands that I need to
    type very often. I am thinking that it would be nice to rig up a
    program(unless there already is one) where I could enter a bunch of
    strings, and then when I press RightControl-r it would enter one
    string, then RightContrl-q for another, etc, up to 26 possible
    strings. Just like copy and paste, but with many different
    possibilities. I thought, if possible, I could make it use the right
    control because I never use that key. So, does anyone know if
    something like that is doable in Perl? I don't know how to isolate the
    right control, I also don't know how to make it paste it where the
    cursor is. I have no idea whether this is possible, but if anyone has
    any suggestions that would be great. Also, maybe Perl isn't the right
    language, but I don't know what is.

    Greg
    TefJlives, May 7, 2007
    #1
    1. Advertising

  2. TefJlives

    TefJlives Guest

    OK, thanks, I can use shift then.

    Greg

    On May 7, 10:40 am, "Petr Vileta" <> wrote:
    > "TefJlives" <> píse v diskusním príspevkunews:...
    >
    > > Hi all,

    >
    > > For my job, I often have a group of about 10 commands that I need to
    > > type very often. I am thinking that it would be nice to rig up a
    > > program(unless there already is one) where I could enter a bunch of
    > > strings, and then when I press RightControl-r it would enter one
    > > string, then RightContrl-q for another, etc, up to 26 possible
    > > strings. Just like copy and paste, but with many different
    > > possibilities. I thought, if possible, I could make it use the right
    > > control because I never use that key. So, does anyone know if
    > > something like that is doable in Perl? I don't know how to isolate the
    > > right control, I also don't know how to make it paste it where the
    > > cursor is. I have no idea whether this is possible, but if anyone has
    > > any suggestions that would be great. Also, maybe Perl isn't the right
    > > language, but I don't know what is.

    >
    > As I know to isolate RightControl key is not possible because it is not
    > handled by hardware. You can detect right or left Shift or Alt but not
    > Control.
    > --
    >
    > Petr Vileta, Czech republic
    > (My server rejects all messages from Yahoo and Hotmail. Send me your mail
    > from another non-spammer site please.)
    TefJlives, May 7, 2007
    #2
    1. Advertising

  3. TefJlives wrote:
    > For my job, I often have a group of about 10 commands that I need to
    > type very often.


    Now, are you talking about 10 commands that you type in a command shell or
    10 commands of a programming language the you type in an editor?

    In the first case you could simply create an alias (if supported by your
    command shell) or write a tiny (shell) script or whatever that executes
    those commands.

    In the later case any decend text editor has macro capabilities. Just create
    a simple text macros, that inserts that piece of program code.
    However, if you typing the same lines of code over and over again, then
    maybe it would be better to create a subroutine for this part.

    jue
    Jürgen Exner, May 7, 2007
    #3
  4. TefJlives

    TefJlives Guest

    Thanks for your reply. Actually, I should have said strings rather
    than commands. It's in windows, too, I should have mentioned. I don't
    know how to do any of the things you mentioned in windows. Is Perl the
    right language, or should I use something else like C?

    Greg

    On May 7, 12:09 pm, "Jürgen Exner" <> wrote:
    > TefJlives wrote:
    > > For my job, I often have a group of about 10 commands that I need to
    > > type very often.

    >
    > Now, are you talking about 10 commands that you type in a command shell or
    > 10 commands of a programming language the you type in an editor?
    >
    > In the first case you could simply create an alias (if supported by your
    > command shell) or write a tiny (shell) script or whatever that executes
    > those commands.
    >
    > In the later case any decend text editor has macro capabilities. Just create
    > a simple text macros, that inserts that piece of program code.
    > However, if you typing the same lines of code over and over again, then
    > maybe it would be better to create a subroutine for this part.
    >
    > jue
    TefJlives, May 8, 2007
    #4
  5. [Please do not top-post, trying to fix]
    TefJlives wrote:
    > On May 7, 12:09 pm, "Jürgen Exner" wrote:
    >> TefJlives wrote:
    >>> For my job, I often have a group of about 10 commands that I need to
    >>> type very often.

    >>
    >> Now, are you talking about 10 commands that you type in a command
    >> shell or 10 commands of a programming language the you type in an
    >> editor?


    > Actually, I should have said strings rather than commands.


    Ok, so we have established, that some lines of code that you want to insert
    one a single button click in your text editor.

    >> In the later case any decend text editor has macro capabilities.
    >> Just create a simple text macros, that inserts that piece of program
    >> code. However, if you typing the same lines of code over and over
    >> again, then maybe it would be better to create a subroutine for this
    >> part.


    > It's in windows, too, I should have mentioned. I don't
    > know how to do any of the things you mentioned in windows.


    The operating system has no relevance on how to use or customize your
    editor.

    > Is Perl the right language, or should I use something else like C?


    I suggest again to leverage the power of your editor. Why reinvent the wheel
    (and probably a wheel with many corners) when adding a macro is a build-in
    functionality of your editor already. You didn't mention what editor you are
    using, but in any case that would be a question for a newsgroup for your
    editor, not for a Perl NG.

    jue
    Jürgen Exner, May 8, 2007
    #5
  6. On 2007-05-07 14:40, Petr Vileta <> wrote:
    > "TefJlives" <> píse v diskusním príspevku
    > news:...
    > As I know to isolate RightControl key is not possible because it is not
    > handled by hardware. You can detect right or left Shift or Alt but not
    > Control.


    Sure you can. X11 on Linux reports a keycode of 37 for the left control
    key and 109 for the right control key. (I think these are also the scan
    codes sent by the hardware, but I may be misremembering things - it's
    been about 15 years that I wrote a keyboard driver).

    hp


    --
    _ | Peter J. Holzer | I know I'd be respectful of a pirate
    |_|_) | Sysadmin WSR | with an emu on his shoulder.
    | | | |
    __/ | http://www.hjp.at/ | -- Sam in "Freefall"
    Peter J. Holzer, May 8, 2007
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    26
    Views:
    2,075
    Roland Pibinger
    Sep 1, 2006
  2. NotGiven
    Replies:
    3
    Views:
    324
    Michael D. Kersey
    May 13, 2004
  3. Zam
    Replies:
    1
    Views:
    213
    Mark Schupp
    Mar 14, 2005
  4. NotGiven
    Replies:
    3
    Views:
    284
    Michael D. Kersey
    May 13, 2004
  5. Replies:
    1
    Views:
    297
Loading...

Share This Page