Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Something like a Keylogger

Status
Not open for further replies.

P3rlKill3r

Programmer
Aug 22, 2011
2
US
I'm editing a text file that requires a lot of copy and paste. And when I say "a lot" I mean I have at least 50+ (probably more) items that I need to copy and paste in various locations as I type. I want to write a perl script that runs in the background and replaces texts as I type, instead of me having to copy and paste.

For example, I might type something like this:

"The RGHBn1209 is contained in 12 DyHUTBB409-14 with Acrobyztani. But the RGHBn1209 and the Acrobyztani has only 11 DyHUTBB409-14."

But instead of writing all that, I want to be able to write this:

"The $RGH is contained in 12 $DyH with $Acr. But the $RGH and the $Acr has only 11 $DyH."

So, when the perl process detects $RGH, it automatically repleaces it with RGHBn1209, and $DyH with DyHUTBB409-14, and etc.

Can someone help me?
 
I would just use AutoHotKey for this, running on my Windows client and capturing the macros as I typed them into a PuTTY session.

But you haven't said anything about what platform(s) you're working with...?

Annihilannic.
[small]tgmlify - code syntax highlighting for your tek-tips posts[/small]
 
Yeah, if you're using windows, I second Annihilannic's suggestion - AutoHotKey is the easiest way to go.

If you're using command line in something other than Windows, expect, and specifically the interactive command, is a good way to go (though that does require learning a bit of TCL, but the basics are pretty easy to learn.) If you want to stay with perl in a command line (again, not Windows) environment, you may be able to use the perl expect module, but I am unsure if it has interactive mode.
 
Thanks, I'll look into AutoHotKey. I appreciate both of your comments.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top