Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Multiple copy and paste thing in Perl

Reply
Thread Tools

Multiple copy and paste thing in Perl

 
 
TefJlives
Guest
Posts: n/a
 
      05-07-2007
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

 
Reply With Quote
 
 
 
 
TefJlives
Guest
Posts: n/a
 
      05-07-2007
OK, thanks, I can use shift then.

Greg

On May 7, 10:40 am, "Petr Vileta" <(E-Mail Removed)> wrote:
> "TefJlives" <(E-Mail Removed)> píse v diskusním príspevkunews:1178502077.800790.92800@y80g2000hsf. googlegroups.com...
>
> > 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.)



 
Reply With Quote
 
 
 
 
Jürgen Exner
Guest
Posts: n/a
 
      05-07-2007
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


 
Reply With Quote
 
TefJlives
Guest
Posts: n/a
 
      05-08-2007
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" <(E-Mail Removed)> 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



 
Reply With Quote
 
Jürgen Exner
Guest
Posts: n/a
 
      05-08-2007
[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


 
Reply With Quote
 
Peter J. Holzer
Guest
Posts: n/a
 
      05-08-2007
On 2007-05-07 14:40, Petr Vileta <(E-Mail Removed)> wrote:
> "TefJlives" <(E-Mail Removed)> pÃ*se v diskusnÃ*m prÃ*spevku
> news:(E-Mail Removed) ups.com...
> 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.velocityreviews.com/forums/(E-Mail Removed) |
__/ | http://www.hjp.at/ | -- Sam in "Freefall"
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Copy Functionality w/o Using Copy/Paste Buffer al_johnson222@yahoo.com Javascript 1 12-01-2006 08:47 PM
what is Deep Copy, shallow copy and bitwises copy.? saxenavaibhav17@gmail.com C++ 26 09-01-2006 09:37 PM
Unable to type in google search box, right click and copy and paste Rob W Computer Support 5 06-19-2006 10:23 PM
copy and paste form RTF document into field in asp form cause it to bypass field length and javascript validation - how to overcome? NotGiven Javascript 3 05-13-2004 12:15 AM
copy and paste form RTF document into field in asp form cause it to bypass field length and javascript validation - how to overcome? NotGiven ASP General 3 05-13-2004 12:15 AM



Advertisments